1 /* 2 输入文件见337.in.txt 3 输出文件见338.out.txt 4 */ 5 #include <iostream> 6 #include <cctype> 7 #include <fstream> 8 #include <cstring> 9 using namespace std; 10 11 const int maxList = 2048 * 10 + 10; //单词表的最大值 12 const int maxWord = 100 + 10; //单词长度的最大值 13 14 struct WordList 15 { 16 char word[maxWord]; //单词 17 int fre; //词频 18 } list[maxList]; 19 20 char *Delete(char *str,char c) //删除一个单词中的标点符号. 如: declicious! 删去! 21 { 22 char *p = str; //声明一个指针指向自己 23 char *p2 = str; //如果str自己移动指针的话,最后返回str时,返回的是尾指针,输出为空 24 while (*p2) 25 { 26 if (*p2 == c) 27 p2++; 28 else 29 *p++ = *p2++; 30 } 31 *p = '\0'; 32 return str; 33 } 34 35 36 //因为单词长度不同,所以此函数用来规范输出格式 37 void ShowOrder(WordList w, char extra, int len, ofstream& out, int findMax = 20) 38 { 39 out << w.word; 40 for (int i = 1; i < findMax - len; i++) 41 { 42 out << extra; 43 } 44 out << w.fre << endl; 45 } 46 47 int main() 48 { 49 ifstream in("337.in.txt"); //读取单词文件 50 ofstream out("337.out.txt"); //写入单词及其个数文件 51 52 if (!in) { 53 cout << "failure !" << endl; return 1; 54 } 55 56 // WordList list[maxList]; //单词表 57 long long int N = 0; //单词的数量 58 int findMax = -1, lenTmp = 0; //查找最大字符串长度 59 int wordFreMax = 0; 60 string wordMax; 61 62 char tmp[maxWord]; //读取单词 63 64 while (in >> tmp) 65 { 66 int i; 67 lenTmp = strlen(tmp); 68 if (findMax < lenTmp) findMax = lenTmp; 69 70 // if( !isalpha( tmp[strlen(tmp)-1]) ) //最后一个字符位置不是单词 71 // Delete(tmp, tmp[strlen(tmp)-1]); //删去一个单词后的标点符号 72 73 for (i = 0; i < N; i++) //在单词表中查找该单词 74 { 75 if (strcmp(list[i].word, tmp) == 0) { //找到则,fre++; 76 list[i].fre++; 77 if (wordFreMax < list[i].fre) { 78 wordFreMax = list[i].fre; 79 wordMax = list[i].word; 80 } 81 break; 82 } 83 } 84 85 if (i == N) // && isalpha(tmp[0]) 找不到则添加该单词,且该词频置为1,单词表数目N++ 86 { //标点符号不统计 87 strcpy(list[N].word, tmp); 88 list[N++].fre = 1; 89 } 90 } 91 92 out << "单词表总数:\t" << N << "\n单词频率最高:\t" << wordMax << "\t次数:\t" << wordFreMax << endl; 93 out << "所有单词为:"; 94 for (int i = 1; i < findMax - 13; i++) 95 out << ' '; 96 out << "单词数为:\n"; 97 for (int i = 0; i < N; i++) 98 { 99 ShowOrder(list[i], ' ', strlen(list[i].word), out, findMax); //标准化输出 100 } 101 return 0; 102 }
1 //337.in.txt ---- 测试输入数据 2 3 ! 4 Search: 5 Go 6 Reference<deque>deque 7 Not logged in 8 registerlog in 9 class template : 10 <deque> ? 11 std::deque ! 12 template < class T, class Alloc = allocator<T> > class deque; 13 Double ended queue 14 deque (usually pronounced like "deck") is an irregular acronym of double-ended queue. Double-ended queues are sequence containers with dynamic sizes that can be expanded or contracted on both ends (either its front or its back). 15 16 Specific libraries may implement deques in different ways, generally as some form of dynamic array. But in any case, they allow for the individual elements to be accessed directly through random access iterators, with storage handled automatically by expanding and contracting the container as needed. 17 18 Therefore, they provide a functionality similar to vectors, but with efficient insertion and deletion of elements also at the beginning of the sequence, and not only at its end. But, unlike vectors, deques are not guaranteed to store all its elements in contiguous storage locations: accessing elements in a deque by offsetting a pointer to another element causes undefined behavior. 19 20 Both vectors and deques provide a very similar interface and can be used for similar purposes, but internally both work in quite different ways: While vectors use a single array that needs to be occasionally reallocated for growth, the elements of a deque can be scattered in different chunks of storage, with the container keeping the necessary information internally to provide direct access to any of its elements in constant time and with a uniform sequential interface (through iterators). Therefore, deques are a little more complex internally than vectors, but this allows them to grow more efficiently under certain circumstances, especially with very long sequences, where reallocations become more expensive. 21 22 For operations that involve frequent insertion or removals of elements at positions other than the beginning or the end, deques perform worse and have less consistent iterators and references than lists and forward lists. 23 24 Container properties 25 Sequence 26 Elements in sequence containers are ordered in a strict linear sequence. Individual elements are accessed by their position in this sequence. 27 Dynamic array 28 Generally implemented as a dynamic array, it allows direct access to any element in the sequence and provides relatively fast addition/removal of elements at the beginning or the end of the sequence. 29 Allocator-aware 30 The container uses an allocator object to dynamically handle its storage needs. 31 32 Template parameters 33 T 34 Type of the elements. 35 Aliased as member type deque::value_type. 36 Alloc 37 Type of the allocator object used to define the storage allocation model. By default, the allocator class template is used, which defines the simplest memory allocation model and is value-independent. 38 Aliased as member type deque::allocator_type. 39 40 Member types 41 C++98C++11 42 member type definition notes 43 value_type The first template parameter (T) 44 allocator_type The second template parameter (Alloc) defaults to: allocator<value_type> 45 reference allocator_type::reference for the default allocator: value_type& 46 const_reference allocator_type::const_reference for the default allocator: const value_type& 47 pointer allocator_type::pointer for the default allocator: value_type* 48 const_pointer allocator_type::const_pointer for the default allocator: const value_type* 49 iterator a random access iterator to value_type convertible to const_iterator 50 const_iterator a random access iterator to const value_type 51 reverse_iterator reverse_iterator<iterator> 52 const_reverse_iterator reverse_iterator<const_iterator> 53 difference_type a signed integral type, identical to: iterator_traits<iterator>::difference_type usually the same as ptrdiff_t 54 size_type an unsigned integral type that can represent any non-negative value of difference_type usually the same as size_t 55 56 Member functions 57 (constructor) 58 Construct deque container (public member function ) 59 (destructor) 60 Deque destructor (public member function ) 61 operator= 62 Assign content (public member function ) 63 64 Iterators: 65 begin 66 Return iterator to beginning (public member function ) 67 end 68 Return iterator to end (public member function ) 69 rbegin 70 Return reverse iterator to reverse beginning (public member function ) 71 rend 72 Return reverse iterator to reverse end (public member function ) 73 cbegin 74 Return const_iterator to beginning (public member function ) 75 cend 76 Return const_iterator to end (public member function ) 77 crbegin 78 Return const_reverse_iterator to reverse beginning (public member function ) 79 crend 80 Return const_reverse_iterator to reverse end (public member function ) 81 82 Capacity: 83 size 84 Return size (public member function ) 85 max_size 86 Return maximum size (public member function ) 87 resize 88 Change size (public member function ) 89 empty 90 Test whether container is empty (public member function ) 91 shrink_to_fit 92 Shrink to fit (public member function ) 93 94 Element access: 95 operator[] 96 Access element (public member function ) 97 at 98 Access element (public member function ) 99 front 100 Access first element (public member function ) 101 back 102 Access last element (public member function ) 103 104 Modifiers: 105 assign 106 Assign container content (public member function ) 107 push_back 108 Add element at the end (public member function ) 109 push_front 110 Insert element at beginning (public member function ) 111 pop_back 112 Delete last element (public member function ) 113 pop_front 114 Delete first element (public member function ) 115 insert 116 Insert elements (public member function ) 117 erase 118 Erase elements (public member function ) 119 swap 120 Swap content (public member function ) 121 clear 122 Clear content (public member function ) 123 emplace 124 Construct and insert element (public member function ) 125 emplace_front 126 Construct and insert element at beginning (public member function ) 127 emplace_back 128 Construct and insert element at the end (public member function ) 129 130 Allocator: 131 get_allocator 132 Get allocator (public member function ) 133 134 Non-member functions overloads 135 relational operators 136 Relational operators for deque (function ) 137 swap 138 Exchanges the contents of two deque containers (function template ) 139 C++ 140 Information 141 Tutorials 142 Reference 143 Articles 144 Forum 145 Reference 146 C library: 147 Containers: 148 <array> 149 <deque> 150 <forward_list> 151 <list> 152 <map> 153 <queue> 154 <set> 155 <stack> 156 <unordered_map> 157 <unordered_set> 158 <vector> 159 Input/Output: 160 Multi-threading: 161 Other: 162 <deque> 163 deque 164 deque 165 deque::deque 166 deque::~deque 167 member functions: 168 deque::assign 169 deque::at 170 deque::back 171 deque::begin 172 deque::cbegin 173 deque::cend 174 deque::clear 175 deque::crbegin 176 deque::crend 177 deque::emplace 178 deque::emplace_back 179 deque::emplace_front 180 deque::empty 181 deque::end 182 deque::erase 183 deque::front 184 deque::get_allocator 185 deque::insert 186 deque::max_size 187 deque::operator= 188 deque::operator[] 189 deque::pop_back 190 deque::pop_front 191 deque::push_back 192 deque::push_front 193 deque::rbegin 194 deque::rend 195 deque::resize 196 deque::shrink_to_fit 197 deque::size 198 deque::swap 199 non-member overloads: 200 relational operators (deque) 201 swap (deque) 202 Home page | Privacy policy 203 ? cplusplus.com, 2000-2016 - All rights reserved - v3.1 204 Spotted an error? contact us 205 206 Download 207 Device Creation 208 Application Development 209 Services 210 Developers 211 Wiki Documentation Forum Bug Reports Code Review 212 Qt Documentation 213 Qt 5.7 Qt Licensing 214 Contents 215 216 Purchasing and Sales Information 217 Licenses Used in Qt 218 Additional information 219 Reference 220 221 All Qt C++ Classes 222 All QML Types 223 All Qt Modules 224 Qt Creator Manual 225 All Qt Reference Documentation 226 Getting Started 227 228 Getting Started with Qt 229 What's New in Qt 5 230 Examples and Tutorials 231 Supported Platforms 232 Qt Licensing 233 Overviews 234 235 Development Tools 236 User Interfaces 237 Core Internals 238 Data Storage 239 Multimedia 240 Networking and Connectivity 241 Graphics 242 Mobile APIs 243 QML Applications 244 All Qt Overviews 245 Qt Licensing 246 247 Qt is available under different licensing options designed to accommodate the needs of our various users: 248 249 Qt licensed under commercial licenses are appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 3. 250 Qt licensed under the GNU Lesser General Public License (LGPL) version 3 is appropriate for the development of Qt applications provided you can comply with the terms and conditions of the GNU LGPL version 3 (or GNU GPL version 3). 251 Note: Some specific parts (modules) of the Qt framework are not available under the GNU LGPL version 3, but under the GNU General Public License (GPL) instead. See Licenses Used in Qt for details. 252 253 Qt documentation is licensed under the terms of the GNU Free Documentation License (FDL) version 1.3, as published by the Free Software Foundation. Alternatively, you may use the documentation in accordance with the terms contained in a written agreement between you and The Qt Company. 254 255 See http://qt.io/licensing/ for an overview of Qt licensing. 256 257 Purchasing and Sales Information 258 259 To purchase a Qt license, visit http://www.qt.io/download/. 260 261 For further information and assistance about Qt licensing, contact our sales; see http://www.qt.io/locations/ for contact details. 262 263 Licenses Used in Qt 264 265 The following table lists parts of Qt that incorporate code licensed under licenses other than GNU Lesser General Public License (LGPL) or the commercial license, as well as Qt modules that are only available under a specific license or a version of a license. 266 267 Third-party licenses used in libraries that are supplied alongside Qt modules are also listed. 268 269 Note: Cross-module dependencies are also described on a general level. All Qt modules depend on Qt Core. 270 271 Qt Module/Tool Component Description License Type Notes 272 Qt Core 273 QSegfaultHandler Parts of implementation of QSegfaultHandler class. BSD-style 274 QUrl Implementation of QUrl::fromUserInput(). Modified BSD 275 Cocoa Platform Plugin Specific parts of the Qt for OS X Cocoa port. BSD-style Qt for OS X 276 qtmain library A helper library for writing a cross-platform main() function on Windows. Modified BSD Qt for Windows 277 Shift-JIS Text Codec A character encoding for Japanese. BSD-style 278 ISO-2022-JP (JIS) Text Codec A widely used encoding for Japanese. BSD-style 279 EUC-JP Text Codec EUC-JP is a variable-width encoding used to represent the elements of three Japanese character set standards. BSD-style 280 EUC-KR TextCodec Extended Unix Code (EUC) is a multibyte character encoding system used primarily for Japanese, Korean, and simplified Chinese. BSD-style 281 GBK Text Codec GBK is an extension of the GB2312 character set for simplified Chinese characters, used mainland China. BSD-style 282 Big5 Text Codec Big5, or BIG-5, is a Chinese character encoding method used for Traditional Chinese characters. BSD-style 283 Big5-HKSCS Text Codec Big5-HKSCS is a Chinese character set with more than 4700 characters. BSD-style 284 TSCII Text Codec The TSCII codec provides conversion to and from the Tamil TSCII encoding. BSD-style 285 Stack-less Just-In-Time compiler A platform-independent JIT compiler. BSD 286 Parts of the codecs implemented by Qt BSD 287 Unicode Unicode character data. Permissive, GPL-compatible 288 Macros for building Qt files Macros used in CMake files for building Qt. BSD 289 The PCRE library The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5. BSD-style 290 Third-party Licenses 291 Android C++ Run-time GNU C++ run-time library (libstdc++) for Android. GPLv3 with exception Qt for Android 292 forkfd A tool to facilitate spawning sub-processes. MIT Unix systems 293 FreeBSD strtoll and strtoull Functions for converting a string to long long integer. BSD 294 V8 double/string conversion library Functions for converting between strings and doubles. BSD 295 MD4 implements the MD4 message-digest algorithm. BSD 296 MD5 implements the MD5 message-digest algorithm. BSD 297 Mesa llvmpipe Mesa llvmpipe software rasterizer backend (opengl32sw.dll) for Windows builds. MIT Qt for Windows 298 SHA-1 implements the SHA-1 encryption algorithm. BSD 299 SHA-3 implements the SHA-3 encryption algorithm. BSD 300 zlib zlib is a general purpose data compression library. BSD-style 301 The Public Suffix List A list of all known public Internet suffixes. Mozilla Public License 302 Qt Gui 303 QKeyMapper Internal class for key mapping. Custom, BSD-style Qt for Linux/X11 304 QImage Code used for smooth scaling in QImage::transformed(). BSD 305 Third-party Licenses 306 FreeType Parts of FreeType project used in font rendering. GPLv2, FreeType Project License 307 HarfBuzz OpenType layout engine. BSD-style 308 FreeType 2 Parts of FreeType project used in font rendering. GPLv2, FreeType Project License 309 PNG Reference Library A library for reducing the time and effort it takes to support the PNG format. BSD-style 310 Pixman Pixman is a library that provides low-level pixel manipulation features such as image compositing and trapezoid rasterization. BSD-style 311 Drag and Drop Allows users to transfer information between and within applications. BSD-style 312 ANGLE Opensource project to map OpenGL ES API calls to DirectX API. BSD-style Qt for Windows 313 Qt Location 314 Third-party Licenses 315 Poly2Tri Poly2Tri is a sweepline constrained Delaunay Polygon Triangulation Library. BSD-style 316 Qt Multimedia 317 Third-party Licenses 318 FFTReal Fast Fourier transform of real-valued arrays. LGPL (Used in example code). 319 Qt Canvas 3D 320 Third-party Licenses 321 three.js JavaScript 3D library MIT (Used in example code) 322 Three.js Loader A parser for loading 3D models from JSON data structures. MIT (Used in example code). 323 gl-matrix.js High performance matrix and vector operations MIT (Used in example code). 324 Qt SVG 325 Qt SVG License Information Parts of code for arc handling in Qt SVG module. BSD-style Depends on Qt Gui, Qt Widgets 326 Qt Quick 327 Third-party Licenses 328 Easing Equations Easing Equations is a collection of swappable functions that add flavor to motion. BSD-style Depends on Qt QML, Qt Gui, Qt Network 329 Qt Quick Controls 330 Native Style for Android Apache License 2.0 Qt for Android 331 Qt Script (Provided for Qt 4 compatibility) 332 V8 benchmark tests V8 benchmark tests used in Qt Script. BSD-style 333 Sunspider benchmark tests Sunspider benchmark tests used in Qt Script. BSD-style 334 Third-party Licenses 335 JavaScriptCore LGPL v2 336 Qt Test 337 Testlib Parts of implementation of Qt Test library. BSD, MIT 338 Third-party Licenses 339 Valgrind A code analysis tool for detecting memory leaks. GPL v2 340 valgrind.h specific license BSD-style 341 Callgrind A performance profiling tool. GPL v2 342 Qt Print Support Depends on Qt Gui and Qt Widgets 343 PDF Licensing Notes about PDF Licensing. 344 Qt Wayland 345 Wayland Protocol MIT 346 Qt WebEngine 347 Qt WebEngine Core LGPL v3 or 348 GPL v2 + Qt commercial license 349 Third-party Licenses 350 Chromium Third-party licenses in Chromium LGPLv2.1, BSD, BSL, Apache, APSL, MIT, MPL, others See Qt WebEngine Licensing for details. 351 Qt Designer 352 Qt Designer License Information Implementation of the recursive shadow casting algorithm in Qt Designer. BSD (MIT) 353 Qt Creator 354 Third-party Licenses 355 Botan A C++ crypto library used in Qt Creator. BSD 356 Qt Image Formats 357 Third-party Licenses 358 JasPer A collection of software for the coding and manipulation of images. BSD-style 359 TIFF libtiff is a set of C functions (a library) that support the manipulation of TIFF image files. BSD 360 MNG Support decoding and displaying of MNG format image files. BSD-style 361 WebP Support decoding and displaying of WebP format image files. BSD-style 362 Qt SQL 363 SQLite A C library that implements a self-contained, embeddable, zero-configuration SQL database engine. BSD-style 364 Qt XML Patterns 365 Bison Parser Bison is a parser generator. GPL with exception Depends on Qt Network 366 Qt 3D 367 Third-party Licenses 368 assimp Open Asset Import Library BSD 369 Plugins 370 JPEG C software to implement JPEG image compression and decompression. BSD-style 371 IAccessible2 An accessibility API for Microsoft Windows applications. BSD Qt for Windows 372 Cycle A CPU tick counter. MIT 373 callgrind.h specific license BSD-style 374 xcb A C language binding for the X Window System. BSD-style Qt for Linux/X11 375 at-spi and at-spi2 A toolkit-neutral way of providing accessibility facilities in application. LGPL Qt for Linux/X11 376 xkbcommon Keymap handling library for toolkits and window systems. BSD-style Qt for Linux/X11 377 Qt Tools 378 Third-party Licenses 379 Clucene Core Library A high-performance, full-featured text search engine written in C++. LGPL/Apache 380 The following modules are available under the GNU GPL version 3 and commercial licenses: 381 382 Qt Module/Tool Component Description License Type 383 Qt Charts GPLv3 or commercial license 384 Qt Data Visualization GPLv3 or commercial license 385 Qt Purchasing GPLv3 or commercial license 386 Qt Virtual Keyboard GPLv3 or commercial license 387 Third-party Licenses 388 Lipi Toolkit An open source toolkit for online Handwriting Recognition (HWR). MIT-Style License 389 OpenWnn A Japanese IME Apache License 390 Pinyin An IME for Standard Chinese input. Apache License 391 tcime A traditional Chinese IME. Apache License 392 Qt Quick 2D Renderer GPLv3 or commercial license 393 Third-party Licenses 394 EGL 1.5 Headers These headers are based on EGL 1.5 specification. MIT License 395 OpenGL ES 2.0 Headers These headers are based on OpenGL ES 2.0 specification. MIT and SGI License 396 OpenGL ES 3.1 Headers These headers are based on OpenGL ES 3.1 specification. MIT and SGI License 397 OpenKODE Core 1.0 Header The header is based on OpenKODE Core 1.0 specification. MIT License 398 Qt Qml 399 Third-party Licenses 400 JavaScriptCore Macro Assembler The assembly code generated use by the JIT. BSD-style 401 Additional information 402 403 The documents below list related documents, such as information about Trademark and other licenses used in parts of Qt. 404 405 Android GNU C++ Run-time Licensing 406 Provides additional information about the licensing of run-time dependencies of Qt for Android 407 Contributions to the Cocoa Platform Plugin Files 408 License information for contributions by Apple, Inc. to specific parts of the Qt for OS X Cocoa port. 409 Licenses for Fonts Used in Qt for Embedded Linux 410 Information about the licenses of fonts supplied with Qt 411 Notes about PDF Licensing 412 Details of restrictions on the use of PDF-related trademarks. 413 Open Source Licensing of Qt 414 Information about open source licensing of Qt. 415 Qt SVG License Information 416 License information for Qt SVG 417 The qtmain Library 418 Describes the use and license of the qtmain helper library. 419 Third-Party Licenses Used in Qt 420 License information for third-party libraries supplied with Qt. 421 Trademarks 422 Information about trademarks owned by The Qt Company and other organizations. 423 ? 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. 424 425 426 Download 427 Start for Free 428 Qt for Application Development 429 Qt for Device Creation 430 Qt Open Source 431 Terms & Conditions 432 Licensing FAQ 433 Product 434 Qt in Use 435 Qt for Application Development 436 Qt for Device Creation 437 Commercial Features 438 Qt Creator IDE 439 Qt Quick 440 Services 441 Technology Evaluation 442 Proof of Concept 443 Design & Implementation 444 Productization 445 Qt Training 446 Partner Network 447 Developers 448 Documentation 449 Examples & Tutorials 450 Development Tools 451 Wiki 452 Forums 453 Contribute to Qt 454 About us 455 Training & Events 456 Resource Center 457 News 458 Careers 459 Locations 460 Contact Us 461 462 463 Qt MerchandiseSign InFeedback? 2016 The Qt Company 464 465 Download 466 Device Creation 467 Application Development 468 Services 469 Developers 470 Wiki Documentation Forum Bug Reports Code Review 471 Qt Documentation 472 Qt 5.7 Qt Core C++ Classes QObject 473 Contents 474 475 Properties 476 Public Functions 477 Public Slots 478 Signals 479 Static Public Members 480 Protected Functions 481 Related Non-Members 482 Macros 483 Detailed Description 484 Thread Affinity 485 No Copy Constructor or Assignment Operator 486 Auto-Connection 487 Dynamic Properties 488 Internationalization (I18n) 489 Reference 490 491 All Qt C++ Classes 492 All QML Types 493 All Qt Modules 494 Qt Creator Manual 495 All Qt Reference Documentation 496 Getting Started 497 498 Getting Started with Qt 499 What's New in Qt 5 500 Examples and Tutorials 501 Supported Platforms 502 Qt Licensing 503 Overviews 504 505 Development Tools 506 User Interfaces 507 Core Internals 508 Data Storage 509 Multimedia 510 Networking and Connectivity 511 Graphics 512 Mobile APIs 513 QML Applications 514 All Qt Overviews 515 QObject Class 516 517 The QObject class is the base class of all Qt objects. More... 518 519 Header: #include <QObject> 520 qmake: QT += core 521 Instantiated By: QtObject 522 Inherited By: 523 Q3DObject, Q3DScene, Q3DTheme, QAbstract3DAxis, QAbstract3DInputHandler, QAbstract3DSeries, QAbstractAnimation, QAbstractAxis, QAbstractDataProxy, QAbstractEventDispatcher, QAbstractItemDelegate, QAbstractItemModel, QAbstractMessageHandler, QAbstractNetworkCache, QAbstractSeries, QAbstractState, QAbstractTextDocumentLayout, QAbstractTransition, QAbstractUriResolver, QAbstractVideoFilter, QAbstractVideoSurface, QAccessiblePlugin, QAction, QActionGroup, QAudioInput, QAudioOutput, QAudioProbe, QAxFactory, QAxObject, QAxScript, QAxScriptManager, QBarSet, QBluetoothDeviceDiscoveryAgent, QBluetoothLocalDevice, QBluetoothServer, QBluetoothServiceDiscoveryAgent, QBluetoothTransferManager, QBluetoothTransferReply, QBoxSet, QButtonGroup, QCameraExposure, QCameraFocus, QCameraImageCapture, QCameraImageProcessing, QCanBus, QCanBusDevice, QClipboard, QCompleter, QCoreApplication, QCustom3DItem, QDataWidgetMapper, QDBusAbstractAdaptor, QDBusAbstractInterface, QDBusPendingCallWatcher, QDBusServer, QDBusServiceWatcher, QDBusVirtualObject, QDesignerFormEditorInterface, QDesignerFormWindowManagerInterface, QDnsLookup, QDrag, QEventLoop, QExtensionFactory, QExtensionManager, QFileSelector, QFileSystemWatcher, QGamepad, QGenericPlugin, QGeoAreaMonitorSource, QGeoCodeReply, QGeoCodingManager, QGeoCodingManagerEngine, QGeoPositionInfoSource, QGeoRouteReply, QGeoRoutingManager, QGeoRoutingManagerEngine, QGeoSatelliteInfoSource, QGeoServiceProvider, QGesture, QGLShader, QGLShaderProgram, QGraphicsAnchor, QGraphicsEffect, QGraphicsItemAnimation, QGraphicsObject, QGraphicsScene, QGraphicsTransform, QHelpEngineCore, QHelpSearchEngine, QHttpMultiPart, QIconEnginePlugin, QImageIOPlugin, QInAppProduct, QInAppStore, QInAppTransaction, QInputMethod, QIODevice, QItemSelectionModel, QJSEngine, QLayout, QLegendMarker, QLibrary, QLocalServer, QLowEnergyController, QLowEnergyService, QMacToolBar, QMacToolBarItem, QMaskGenerator, QMediaControl, QMediaObject, QMediaPlaylist, QMediaRecorder, QMediaService, QMediaServiceProviderPlugin, QMimeData, QModbusDevice, QModbusReply, QMovie, QNearFieldManager, QNearFieldShareManager, QNearFieldShareTarget, QNearFieldTarget, QNetworkAccessManager, QNetworkConfigurationManager, QNetworkCookieJar, QNetworkSession, QObjectCleanupHandler, QOffscreenSurface, QOpenGLContext, QOpenGLContextGroup, QOpenGLDebugLogger, QOpenGLShader, QOpenGLShaderProgram, QOpenGLTimeMonitor, QOpenGLTimerQuery, QOpenGLVertexArrayObject, QPdfWriter, QPictureFormatPlugin, QPieSlice, QPlaceManager, QPlaceManagerEngine, QPlaceReply, QPlatformGraphicsBuffer, QPlatformSystemTrayIcon, QPluginLoader, QQmlComponent, QQmlContext, QQmlExpression, QQmlExtensionPlugin, QQmlFileSelector, QQmlNdefRecord, QQmlPropertyMap, QQuickImageResponse, QQuickItem, QQuickItemGrabResult, QQuickRenderControl, QQuickTextDocument, QQuickTextureFactory, QQuickWebEngineProfile, QRadioData, QScreen, QScriptEngine, QScriptEngineDebugger, QScriptExtensionPlugin, QScroller, QScxmlDataModel, QScxmlStateMachine, QSensor, QSensorBackend, QSensorGesture, QSensorGestureManager, QSensorGestureRecognizer, QSensorReading, QSessionManager, QSettings, QSGAbstractRenderer, QSGEngine, QSGTexture, QSGTextureProvider, QSharedMemory, QShortcut, QSignalMapper, QSignalSpy, QSocketNotifier, QSound, QSoundEffect, QSqlDriver, QSqlDriverPlugin, QStyle, QStyleHints, QStylePlugin, QSvgRenderer, QSyntaxHighlighter, QSystemTrayIcon, Qt3DCore::QAbstractAspect, Qt3DCore::QAspectEngine, Qt3DCore::QNode, Qt3DCore::Quick::QQmlAspectEngine, Qt3DInput::QKeyEvent, Qt3DInput::QMouseEvent, Qt3DInput::QWheelEvent, Qt3DRender::QGraphicsApiFilter, Qt3DRender::QPickEvent, Qt3DRender::QTextureWrapMode, QTcpServer, QTextDocument, QTextObject, QThread, QThreadPool, QTimeLine, QTimer, QTranslator, QtVirtualKeyboard::InputContext, QtVirtualKeyboard::InputEngine, QtVirtualKeyboard::ShiftHandler, QUiLoader, QUndoGroup, QUndoStack, QValidator, QValue3DAxisFormatter, QVideoProbe, QWaylandClient, QWaylandSurfaceGrabber, QWaylandView, QWebChannel, QWebChannelAbstractTransport, QWebEngineCookieStore, QWebEngineDownloadItem, QWebEnginePage, QWebEngineProfile, QWebEngineUrlRequestInterceptor, QWebEngineUrlRequestJob, QWebEngineUrlSchemeHandler, QWebSocket, QWebSocketServer, QWidget, QWindow, QWinEventNotifier, QWinJumpList, QWinTaskbarButton, QWinTaskbarProgress, QWinThumbnailToolBar, and QWinThumbnailToolButton 524 List of all members, including inherited members 525 Obsolete members 526 Note: All functions in this class are reentrant. 527 528 Note: These functions are also thread-safe: 529 530 connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) 531 connect(const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) 532 connect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) 533 connect(const QObject *sender, PointerToMemberFunction signal, Functor functor) 534 connect(const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) 535 disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) 536 disconnect(const char *signal, const QObject *receiver, const char *method) 537 disconnect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) 538 Properties 539 540 objectName : QString 541 Public Functions 542 543 QObject(QObject *parent = Q_NULLPTR) 544 virtual ~QObject() 545 bool blockSignals(bool block) 546 const QObjectList & children() const 547 QMetaObject::Connection connect(const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type = Qt::AutoConnection) const 548 bool disconnect(const char *signal = Q_NULLPTR, const QObject *receiver = Q_NULLPTR, const char *method = Q_NULLPTR) const 549 bool disconnect(const QObject *receiver, const char *method = Q_NULLPTR) const 550 void dumpObjectInfo() 551 void dumpObjectTree() 552 QList<QByteArray> dynamicPropertyNames() const 553 virtual bool event(QEvent *e) 554 virtual bool eventFilter(QObject *watched, QEvent *event) 555 T findChild(const QString &name = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const 556 QList<T> findChildren(const QString &name = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const 557 QList<T> findChildren(const QRegExp ®Exp, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const 558 QList<T> findChildren(const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const 559 bool inherits(const char *className) const 560 void installEventFilter(QObject *filterObj) 561 bool isWidgetType() const 562 bool isWindowType() const 563 void killTimer(int id) 564 virtual const QMetaObject * metaObject() const 565 void moveToThread(QThread *targetThread) 566 QString objectName() const 567 QObject * parent() const 568 QVariant property(const char *name) const 569 void removeEventFilter(QObject *obj) 570 void setObjectName(const QString &name) 571 void setParent(QObject *parent) 572 bool setProperty(const char *name, const QVariant &value) 573 bool signalsBlocked() const 574 int startTimer(int interval, Qt::TimerType timerType = Qt::CoarseTimer) 575 QThread * thread() const 576 Public Slots 577 578 void deleteLater() 579 Signals 580 581 void destroyed(QObject *obj = Q_NULLPTR) 582 void objectNameChanged(const QString &objectName) 583 Static Public Members 584 585 QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type = Qt::AutoConnection) 586 QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type = Qt::AutoConnection) 587 QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type = Qt::AutoConnection) 588 QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor) 589 QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type = Qt::AutoConnection) 590 bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) 591 bool disconnect(const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) 592 bool disconnect(const QMetaObject::Connection &connection) 593 bool disconnect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) 594 const QMetaObject staticMetaObject 595 QString tr(const char *sourceText, const char *disambiguation = Q_NULLPTR, int n = -1) 596 Protected Functions 597 598 virtual void childEvent(QChildEvent *event) 599 virtual void connectNotify(const QMetaMethod &signal) 600 virtual void customEvent(QEvent *event) 601 virtual void disconnectNotify(const QMetaMethod &signal) 602 bool isSignalConnected(const QMetaMethod &signal) const 603 int receivers(const char *signal) const 604 QObject * sender() const 605 int senderSignalIndex() const 606 virtual void timerEvent(QTimerEvent *event) 607 Related Non-Members 608 609 typedef QObjectList 610 QList<T> qFindChildren(const QObject *obj, const QRegExp ®Exp) 611 T qobject_cast(QObject *object) 612 Macros 613 614 Q_CLASSINFO(Name, Value) 615 Q_DISABLE_COPY(Class) 616 Q_EMIT 617 Q_ENUM(...) 618 Q_FLAG(...) 619 Q_GADGET 620 Q_INTERFACES(...) 621 Q_INVOKABLE 622 Q_OBJECT 623 Q_PROPERTY(...) 624 Q_REVISION 625 Q_SET_OBJECT_NAME(Object) 626 Q_SIGNAL 627 Q_SIGNALS 628 Q_SLOT 629 Q_SLOTS 630 Detailed Description 631 632 The QObject class is the base class of all Qt objects. 633 634 QObject is the heart of the Qt Object Model. The central feature in this model is a very powerful mechanism for seamless object communication called signals and slots. You can connect a signal to a slot with connect() and destroy the connection with disconnect(). To avoid never ending notification loops you can temporarily block signals with blockSignals(). The protected functions connectNotify() and disconnectNotify() make it possible to track connections. 635 636 QObjects organize themselves in object trees. When you create a QObject with another object as parent, the object will automatically add itself to the parent's children() list. The parent takes ownership of the object; i.e., it will automatically delete its children in its destructor. You can look for an object by name and optionally type using findChild() or findChildren(). 637 638 Every object has an objectName() and its class name can be found via the corresponding metaObject() (see QMetaObject::className()). You can determine whether the object's class inherits another class in the QObject inheritance hierarchy by using the inherits() function. 639 640 When an object is deleted, it emits a destroyed() signal. You can catch this signal to avoid dangling references to QObjects. 641 642 QObjects can receive events through event() and filter the events of other objects. See installEventFilter() and eventFilter() for details. A convenience handler, childEvent(), can be reimplemented to catch child events. 643 644 Last but not least, QObject provides the basic timer support in Qt; see QTimer for high-level support for timers. 645 646 Notice that the Q_OBJECT macro is mandatory for any object that implements signals, slots or properties. You also need to run the Meta Object Compiler on the source file. We strongly recommend the use of this macro in all subclasses of QObject regardless of whether or not they actually use signals, slots and properties, since failure to do so may lead certain functions to exhibit strange behavior. 647 648 All Qt widgets inherit QObject. The convenience function isWidgetType() returns whether an object is actually a widget. It is much faster than qobject_cast<QWidget *>(obj) or obj->inherits("QWidget"). 649 650 Some QObject functions, e.g. children(), return a QObjectList. QObjectList is a typedef for QList<QObject *>. 651 652 Thread Affinity 653 654 A QObject instance is said to have a thread affinity, or that it lives in a certain thread. When a QObject receives a queued signal or a posted event, the slot or event handler will run in the thread that the object lives in. 655 656 Note: If a QObject has no thread affinity (that is, if thread() returns zero), or if it lives in a thread that has no running event loop, then it cannot receive queued signals or posted events. 657 658 By default, a QObject lives in the thread in which it is created. An object's thread affinity can be queried using thread() and changed using moveToThread(). 659 660 All QObjects must live in the same thread as their parent. Consequently: 661 662 setParent() will fail if the two QObjects involved live in different threads. 663 When a QObject is moved to another thread, all its children will be automatically moved too. 664 moveToThread() will fail if the QObject has a parent. 665 If QObjects are created within QThread::run(), they cannot become children of the QThread object because the QThread does not live in the thread that calls QThread::run(). 666 Note: A QObject's member variables do not automatically become its children. The parent-child relationship must be set by either passing a pointer to the child's constructor, or by calling setParent(). Without this step, the object's member variables will remain in the old thread when moveToThread() is called. 667 668 No Copy Constructor or Assignment Operator 669 670 QObject has neither a copy constructor nor an assignment operator. This is by design. Actually, they are declared, but in a private section with the macro Q_DISABLE_COPY(). In fact, all Qt classes derived from QObject (direct or indirect) use this macro to declare their copy constructor and assignment operator to be private. The reasoning is found in the discussion on Identity vs Value on the Qt Object Model page. 671 672 The main consequence is that you should use pointers to QObject (or to your QObject subclass) where you might otherwise be tempted to use your QObject subclass as a value. For example, without a copy constructor, you can't use a subclass of QObject as the value to be stored in one of the container classes. You must store pointers. 673 674 Auto-Connection 675 676 Qt's meta-object system provides a mechanism to automatically connect signals and slots between QObject subclasses and their children. As long as objects are defined with suitable object names, and slots follow a simple naming convention, this connection can be performed at run-time by the QMetaObject::connectSlotsByName() function. 677 678 uic generates code that invokes this function to enable auto-connection to be performed between widgets on forms created with Qt Designer. More information about using auto-connection with Qt Designer is given in the Using a Designer UI File in Your Application section of the Qt Designer manual. 679 680 Dynamic Properties 681 682 From Qt 4.2, dynamic properties can be added to and removed from QObject instances at run-time. Dynamic properties do not need to be declared at compile-time, yet they provide the same advantages as static properties and are manipulated using the same API - using property() to read them and setProperty() to write them. 683 684 From Qt 4.3, dynamic properties are supported by Qt Designer, and both standard Qt widgets and user-created forms can be given dynamic properties. 685 686 Internationalization (I18n) 687 688 All QObject subclasses support Qt's translation features, making it possible to translate an application's user interface into different languages. 689 690 To make user-visible text translatable, it must be wrapped in calls to the tr() function. This is explained in detail in the Writing Source Code for Translation document. 691 692 See also QMetaObject, QPointer, QObjectCleanupHandler, Q_DISABLE_COPY(), and Object Trees & Ownership. 693 694 Property Documentation 695 696 objectName : QString 697 698 This property holds the name of this object. 699 700 You can find an object by name (and type) using findChild(). You can find a set of objects with findChildren(). 701 702 qDebug("MyClass::setPrecision(): (%s) invalid precision %f", 703 qPrintable(objectName()), newPrecision); 704 By default, this property contains an empty string. 705 706 Access functions: 707 708 QString objectName() const 709 void setObjectName(const QString &name) 710 Notifier signal: 711 712 void objectNameChanged(const QString &objectName) [see note below] 713 Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user. 714 715 See also metaObject() and QMetaObject::className(). 716 717 Member Function Documentation 718 719 QObject::QObject(QObject *parent = Q_NULLPTR) 720 721 Constructs an object with parent object parent. 722 723 The parent of an object may be viewed as the object's owner. For instance, a dialog box is the parent of the OK and Cancel buttons it contains. 724 725 The destructor of a parent object destroys all child objects. 726 727 Setting parent to 0 constructs an object with no parent. If the object is a widget, it will become a top-level window. 728 729 See also parent(), findChild(), and findChildren(). 730 731 [virtual] QObject::~QObject() 732 733 Destroys the object, deleting all its child objects. 734 735 All signals to and from the object are automatically disconnected, and any pending posted events for the object are removed from the event queue. However, it is often safer to use deleteLater() rather than deleting a QObject subclass directly. 736 737 Warning: All child objects are deleted. If any of these objects are on the stack or global, sooner or later your program will crash. We do not recommend holding pointers to child objects from outside the parent. If you still do, the destroyed() signal gives you an opportunity to detect when an object is destroyed. 738 739 Warning: Deleting a QObject while pending events are waiting to be delivered can cause a crash. You must not delete the QObject directly if it exists in a different thread than the one currently executing. Use deleteLater() instead, which will cause the event loop to delete the object after all pending events have been delivered to it. 740 741 See also deleteLater(). 742 743 bool QObject::blockSignals(bool block) 744 745 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). If block is false, no such blocking will occur. 746 747 The return value is the previous value of signalsBlocked(). 748 749 Note that the destroyed() signal will be emitted even if the signals for this object have been blocked. 750 751 Signals emitted while being blocked are not buffered. 752 753 See also signalsBlocked() and QSignalBlocker. 754 755 [virtual protected] void QObject::childEvent(QChildEvent *event) 756 757 This event handler can be reimplemented in a subclass to receive child events. The event is passed in the event parameter. 758 759 QEvent::ChildAdded and QEvent::ChildRemoved events are sent to objects when children are added or removed. In both cases you can only rely on the child being a QObject, or if isWidgetType() returns true, a QWidget. (This is because, in the ChildAdded case, the child is not yet fully constructed, and in the ChildRemoved case it might have been destructed already). 760 761 QEvent::ChildPolished events are sent to widgets when children are polished, or when polished children are added. If you receive a child polished event, the child's construction is usually completed. However, this is not guaranteed, and multiple polish events may be delivered during the execution of a widget's constructor. 762 763 For every child widget, you receive one ChildAdded event, zero or more ChildPolished events, and one ChildRemoved event. 764 765 The ChildPolished event is omitted if a child is removed immediately after it is added. If a child is polished several times during construction and destruction, you may receive several child polished events for the same child, each time with a different virtual table. 766 767 See also event(). 768 769 const QObjectList &QObject::children() const 770 771 Returns a list of child objects. The QObjectList class is defined in the <QObject> header file as the following: 772 773 typedef QList<QObject*> QObjectList; 774 The first child added is the first object in the list and the last child added is the last object in the list, i.e. new children are appended at the end. 775 776 Note that the list order changes when QWidget children are raised or lowered. A widget that is raised becomes the last object in the list, and a widget that is lowered becomes the first object in the list. 777 778 See also findChild(), findChildren(), parent(), and setParent(). 779 780 [static] QMetaObject::Connection QObject::connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type = Qt::AutoConnection) 781 782 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. Returns a handle to the connection that can be used to disconnect it later. 783 784 You must use the SIGNAL() and SLOT() macros when specifying the signal and the method, for example: 785 786 QLabel *label = new QLabel; 787 QScrollBar *scrollBar = new QScrollBar; 788 QObject::connect(scrollBar, SIGNAL(valueChanged(int)), 789 label, SLOT(setNum(int))); 790 This example ensures that the label always displays the current scroll bar value. Note that the signal and slots parameters must not contain any variable names, only the type. E.g. the following would not work and return false: 791 792 // WRONG 793 QObject::connect(scrollBar, SIGNAL(valueChanged(int value)), 794 label, SLOT(setNum(int value))); 795 A signal can also be connected to another signal: 796 797 class MyWidget : public QWidget 798 { 799 Q_OBJECT 800 801 public: 802 MyWidget(); 803 804 signals: 805 void buttonClicked(); 806 807 private: 808 QPushButton *myButton; 809 }; 810 811 MyWidget::MyWidget() 812 { 813 myButton = new QPushButton(this); 814 connect(myButton, SIGNAL(clicked()), 815 this, SIGNAL(buttonClicked())); 816 } 817 In this example, the MyWidget constructor relays a signal from a private member variable, and makes it available under a name that relates to MyWidget. 818 819 A signal can be connected to many slots and signals. Many signals can be connected to one slot. 820 821 If a signal is connected to several slots, the slots are activated in the same order in which the connections were made, when the signal is emitted. 822 823 The function returns a QMetaObject::Connection that represents a handle to a connection if it successfully connects the signal to the slot. The connection handle will be invalid if it cannot create the connection, for example, if QObject is unable to verify the existence of either signal or method, or if their signatures aren't compatible. You can check if the handle is valid by casting it to a bool. 824 825 By default, a signal is emitted for every connection you make; two signals are emitted for duplicate connections. You can break all of these connections with a single disconnect() call. If you pass the Qt::UniqueConnection type, the connection will only be made if it is not a duplicate. If there is already a duplicate (exact same signal to the exact same slot on the same objects), the connection will fail and connect will return an invalid QMetaObject::Connection. 826 827 The optional type parameter describes the type of connection to establish. In particular, it determines whether a particular signal is delivered to a slot immediately or queued for delivery at a later time. If the signal is queued, the parameters must be of types that are known to Qt's meta-object system, because Qt needs to copy the arguments to store them in an event behind the scenes. If you try to use a queued connection and get the error message 828 829 QObject::connect: Cannot queue arguments of type 'MyType' 830 (Make sure 'MyType' is registered using qRegisterMetaType().) 831 call qRegisterMetaType() to register the data type before you establish the connection. 832 833 Note: This function is thread-safe 834 835 See also disconnect(), sender(), qRegisterMetaType(), and Q_DECLARE_METATYPE(). 836 837 [static] QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type = Qt::AutoConnection) 838 839 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. Returns a handle to the connection that can be used to disconnect it later. 840 841 The Connection handle will be invalid if it cannot create the connection, for example, the parameters were invalid. You can check if the QMetaObject::Connection is valid by casting it to a bool. 842 843 This function works in the same way as connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) but it uses QMetaMethod to specify signal and method. 844 845 This function was introduced in Qt 4.8. 846 847 See also connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type). 848 849 QMetaObject::Connection QObject::connect(const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type = Qt::AutoConnection) const 850 851 This function overloads connect(). 852 853 Connects signal from the sender object to this object's method. 854 855 Equivalent to connect(sender, signal, this, method, type). 856 857 Every connection you make emits a signal, so duplicate connections emit two signals. You can break a connection using disconnect(). 858 859 Note: This function is thread-safe 860 861 See also disconnect(). 862 863 [static] QMetaObject::Connection QObject::connect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type = Qt::AutoConnection) 864 865 This function overloads connect(). 866 867 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. Returns a handle to the connection that can be used to disconnect it later. 868 869 The signal must be a function declared as a signal in the header. The slot function can be any member function that can be connected to the signal. A slot can be connected to a given signal if the signal has at least as many arguments as the slot, and there is an implicit conversion between the types of the corresponding arguments in the signal and the slot. 870 871 Example: 872 873 QLabel *label = new QLabel; 874 QLineEdit *lineEdit = new QLineEdit; 875 QObject::connect(lineEdit, &QLineEdit::textChanged, 876 label, &QLabel::setText); 877 This example ensures that the label always displays the current line edit text. 878 879 A signal can be connected to many slots and signals. Many signals can be connected to one slot. 880 881 If a signal is connected to several slots, the slots are activated in the same order as the order the connection was made, when the signal is emitted 882 883 The function returns an handle to a connection if it successfully connects the signal to the slot. The Connection handle will be invalid if it cannot create the connection, for example, if QObject is unable to verify the existence of signal (if it was not declared as a signal) You can check if the QMetaObject::Connection is valid by casting it to a bool. 884 885 By default, a signal is emitted for every connection you make; two signals are emitted for duplicate connections. You can break all of these connections with a single disconnect() call. If you pass the Qt::UniqueConnection type, the connection will only be made if it is not a duplicate. If there is already a duplicate (exact same signal to the exact same slot on the same objects), the connection will fail and connect will return an invalid QMetaObject::Connection. 886 887 The optional type parameter describes the type of connection to establish. In particular, it determines whether a particular signal is delivered to a slot immediately or queued for delivery at a later time. If the signal is queued, the parameters must be of types that are known to Qt's meta-object system, because Qt needs to copy the arguments to store them in an event behind the scenes. If you try to use a queued connection and get the error message 888 889 QObject::connect: Cannot queue arguments of type 'MyType' 890 (Make sure 'MyType' is registered using qRegisterMetaType().) 891 make sure to declare the argument type with Q_DECLARE_METATYPE 892 893 Overloaded functions can be resolved with help of qOverload. 894 895 Note: The number of arguments in the signal or slot are limited to 6 if the compiler does not support C++11 variadic templates. 896 897 Note: This function is thread-safe 898 899 [static] QMetaObject::Connection QObject::connect(const QObject *sender, PointerToMemberFunction signal, Functor functor) 900 901 This function overloads connect(). 902 903 Creates a connection from signal in sender object to functor, and returns a handle to the connection 904 905 The signal must be a function declared as a signal in the header. The slot function can be any function or functor that can be connected to the signal. A function can be connected to a given signal if the signal as at least as many argument as the slot. A functor can be connected to a signal if they have exactly the same number of arguments. There must exist implicit conversion between the types of the corresponding arguments in the signal and the slot. 906 907 Example: 908 909 void someFunction(); 910 QPushButton *button = new QPushButton; 911 QObject::connect(button, &QPushButton::clicked, someFunction); 912 If your compiler support C++11 lambda expressions, you can use them: 913 914 QByteArray page = ...; 915 QTcpSocket *socket = new QTcpSocket; 916 socket->connectToHost("qt-project.org", 80); 917 QObject::connect(socket, &QTcpSocket::connected, [=] () { 918 socket->write("GET " + page + "\r\n"); 919 }); 920 The connection will automatically disconnect if the sender is destroyed. However, you should take care that any objects used within the functor are still alive when the signal is emitted. 921 922 Overloaded functions can be resolved with help of qOverload. 923 924 Note: If the compiler does not support C++11 variadic templates, the number of arguments in the signal or slot are limited to 6, and the functor object must not have an overloaded or templated operator(). 925 926 Note: This function is thread-safe 927 928 [static] QMetaObject::Connection QObject::connect(const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type = Qt::AutoConnection) 929 930 This function overloads connect(). 931 932 Creates a connection of a given type from signal in sender object to functor to be placed in a specific event loop of context, and returns a handle to the connection 933 934 The signal must be a function declared as a signal in the header. The slot function can be any function or functor that can be connected to the signal. A function can be connected to a given signal if the signal as at least as many argument as the slot. A functor can be connected to a signal if they have exactly the same number of arguments. There must exist implicit conversion between the types of the corresponding arguments in the signal and the slot. 935 936 Example: 937 938 void someFunction(); 939 QPushButton *button = new QPushButton; 940 QObject::connect(button, &QPushButton::clicked, this, someFunction, Qt::QueuedConnection); 941 If your compiler support C++11 lambda expressions, you can use them: 942 943 QByteArray page = ...; 944 QTcpSocket *socket = new QTcpSocket; 945 socket->connectToHost("qt-project.org", 80); 946 QObject::connect(socket, &QTcpSocket::connected, this, [=] () { 947 socket->write("GET " + page + "\r\n"); 948 }, Qt::AutoConnection); 949 The connection will automatically disconnect if the sender or the context is destroyed. However, you should take care that any objects used within the functor are still alive when the signal is emitted. 950 951 Overloaded functions can be resolved with help of qOverload. 952 953 Note: If the compiler does not support C++11 variadic templates, the number of arguments in the signal or slot are limited to 6, and the functor object must not have an overloaded or templated operator(). 954 955 Note: This function is thread-safe 956 957 This function was introduced in Qt 5.2. 958 959 [virtual protected] void QObject::connectNotify(const QMetaMethod &signal) 960 961 This virtual function is called when something has been connected to signal in this object. 962 963 If you want to compare signal with a specific signal, you can use QMetaMethod::fromSignal() as follows: 964 965 if (signal == QMetaMethod::fromSignal(&MyObject::valueChanged)) { 966 // signal is valueChanged 967 } 968 Warning: This function violates the object-oriented principle of modularity. However, it might be useful when you need to perform expensive initialization only if something is connected to a signal. 969 970 Warning: This function is called from the thread which performs the connection, which may be a different thread from the thread in which this object lives. 971 972 This function was introduced in Qt 5.0. 973 974 See also connect() and disconnectNotify(). 975 976 [virtual protected] void QObject::customEvent(QEvent *event) 977 978 This event handler can be reimplemented in a subclass to receive custom events. Custom events are user-defined events with a type value at least as large as the QEvent::User item of the QEvent::Type enum, and is typically a QEvent subclass. The event is passed in the event parameter. 979 980 See also event() and QEvent. 981 982 [slot] void QObject::deleteLater() 983 984 Schedules this object for deletion. 985 986 The object will be deleted when control returns to the event loop. If the event loop is not running when this function is called (e.g. deleteLater() is called on an object before QCoreApplication::exec()), the object will be deleted once the event loop is started. If deleteLater() is called after the main event loop has stopped, the object will not be deleted. Since Qt 4.8, if deleteLater() is called on an object that lives in a thread with no running event loop, the object will be destroyed when the thread finishes. 987 988 Note that entering and leaving a new event loop (e.g., by opening a modal dialog) will not perform the deferred deletion; for the object to be deleted, the control must return to the event loop from which deleteLater() was called. 989 990 Note: It is safe to call this function more than once; when the first deferred deletion event is delivered, any pending events for the object are removed from the event queue. 991 992 See also destroyed() and QPointer. 993 994 [signal] void QObject::destroyed(QObject *obj = Q_NULLPTR) 995 996 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. 997 998 All the objects's children are destroyed immediately after this signal is emitted. 999 1000 See also deleteLater() and QPointer. 1001 1002 [static] bool QObject::disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) 1003 1004 Disconnects signal in object sender from method in object receiver. Returns true if the connection is successfully broken; otherwise returns false. 1005 1006 A signal-slot connection is removed when either of the objects involved are destroyed. 1007 1008 disconnect() is typically used in three ways, as the following examples demonstrate. 1009 1010 Disconnect everything connected to an object's signals: 1011 disconnect(myObject, 0, 0, 0); 1012 equivalent to the non-static overloaded function 1013 1014 myObject->disconnect(); 1015 Disconnect everything connected to a specific signal: 1016 disconnect(myObject, SIGNAL(mySignal()), 0, 0); 1017 equivalent to the non-static overloaded function 1018 1019 myObject->disconnect(SIGNAL(mySignal())); 1020 Disconnect a specific receiver: 1021 disconnect(myObject, 0, myReceiver, 0); 1022 equivalent to the non-static overloaded function 1023 1024 myObject->disconnect(myReceiver); 1025 0 may be used as a wildcard, meaning "any signal", "any receiving object", or "any slot in the receiving object", respectively. 1026 1027 The sender may never be 0. (You cannot disconnect signals from more than one object in a single call.) 1028 1029 If signal is 0, it disconnects receiver and method from any signal. If not, only the specified signal is disconnected. 1030 1031 If receiver is 0, it disconnects anything connected to signal. If not, slots in objects other than receiver are not disconnected. 1032 1033 If method is 0, it disconnects anything that is connected to receiver. If not, only slots named method will be disconnected, and all other slots are left alone. The method must be 0 if receiver is left out, so you cannot disconnect a specifically-named slot on all objects. 1034 1035 Note: This function is thread-safe 1036 1037 See also connect(). 1038 1039 [static] bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) 1040 1041 Disconnects signal in object sender from method in object receiver. Returns true if the connection is successfully broken; otherwise returns false. 1042 1043 This function provides the same possibilities like disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) but uses QMetaMethod to represent the signal and the method to be disconnected. 1044 1045 Additionally this function returnsfalse and no signals and slots disconnected if: 1046 1047 signal is not a member of sender class or one of its parent classes. 1048 method is not a member of receiver class or one of its parent classes. 1049 signal instance represents not a signal. 1050 QMetaMethod() may be used as wildcard in the meaning "any signal" or "any slot in receiving object". In the same way 0 can be used for receiver in the meaning "any receiving object". In this case method should also be QMetaMethod(). sender parameter should be never 0. 1051 1052 This function was introduced in Qt 4.8. 1053 1054 See also disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method). 1055 1056 bool QObject::disconnect(const char *signal = Q_NULLPTR, const QObject *receiver = Q_NULLPTR, const char *method = Q_NULLPTR) const 1057 1058 This function overloads disconnect(). 1059 1060 Disconnects signal from method of receiver. 1061 1062 A signal-slot connection is removed when either of the objects involved are destroyed. 1063 1064 Note: This function is thread-safe 1065 1066 bool QObject::disconnect(const QObject *receiver, const char *method = Q_NULLPTR) const 1067 1068 This function overloads disconnect(). 1069 1070 Disconnects all signals in this object from receiver's method. 1071 1072 A signal-slot connection is removed when either of the objects involved are destroyed. 1073 1074 [static] bool QObject::disconnect(const QMetaObject::Connection &connection) 1075 1076 Disconnect a connection. 1077 1078 If the connection is invalid or has already been disconnected, do nothing and return false. 1079 1080 See also connect(). 1081 1082 [static] bool QObject::disconnect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) 1083 1084 This function overloads diconnect(). 1085 1086 Disconnects signal in object sender from method in object receiver. Returns true if the connection is successfully broken; otherwise returns false. 1087 1088 A signal-slot connection is removed when either of the objects involved are destroyed. 1089 1090 disconnect() is typically used in three ways, as the following examples demonstrate. 1091 1092 Disconnect everything connected to an object's signals: 1093 disconnect(myObject, 0, 0, 0); 1094 Disconnect everything connected to a specific signal: 1095 disconnect(myObject, &MyObject::mySignal(), 0, 0); 1096 Disconnect a specific receiver: 1097 disconnect(myObject, 0, myReceiver, 0); 1098 Disconnect a connection from one specific signal to a specific slot: 1099 QObject::disconnect(lineEdit, &QLineEdit::textChanged, 1100 label, &QLabel::setText); 1101 0 may be used as a wildcard, meaning "any signal", "any receiving object", or "any slot in the receiving object", respectively. 1102 1103 The sender may never be 0. (You cannot disconnect signals from more than one object in a single call.) 1104 1105 If signal is 0, it disconnects receiver and method from any signal. If not, only the specified signal is disconnected. 1106 1107 If receiver is 0, it disconnects anything connected to signal. If not, slots in objects other than receiver are not disconnected. 1108 1109 If method is 0, it disconnects anything that is connected to receiver. If not, only slots named method will be disconnected, and all other slots are left alone. The method must be 0 if receiver is left out, so you cannot disconnect a specifically-named slot on all objects. 1110 1111 Note: It is not possible to use this overload to diconnect signals connected to functors or lambda expressions. That is because it is not possible to compare them. Instead, use the overload that takes a QMetaObject::Connection 1112 1113 Note: This function is thread-safe 1114 1115 See also connect(). 1116 1117 [virtual protected] void QObject::disconnectNotify(const QMetaMethod &signal) 1118 1119 This virtual function is called when something has been disconnected from signal in this object. 1120 1121 See connectNotify() for an example of how to compare signal with a specific signal. 1122 1123 If all signals were disconnected from this object (e.g., the signal argument to disconnect() was 0), disconnectNotify() is only called once, and the signal will be an invalid QMetaMethod (QMetaMethod::isValid() returns false). 1124 1125 Warning: This function violates the object-oriented principle of modularity. However, it might be useful for optimizing access to expensive resources. 1126 1127 Warning: This function is called from the thread which performs the disconnection, which may be a different thread from the thread in which this object lives. This function may also be called with a QObject internal mutex locked. It is therefore not allowed to re-enter any of any QObject functions from your reimplementation and if you lock a mutex in your reimplementation, make sure that you don't call QObject functions with that mutex held in other places or it will result in a deadlock. 1128 1129 This function was introduced in Qt 5.0. 1130 1131 See also disconnect() and connectNotify(). 1132 1133 void QObject::dumpObjectInfo() 1134 1135 Dumps information about signal connections, etc. for this object to the debug output. 1136 1137 This function is useful for debugging, but does nothing if the library has been compiled in release mode (i.e. without debugging information). 1138 1139 See also dumpObjectTree(). 1140 1141 void QObject::dumpObjectTree() 1142 1143 Dumps a tree of children to the debug output. 1144 1145 This function is useful for debugging, but does nothing if the library has been compiled in release mode (i.e. without debugging information). 1146 1147 See also dumpObjectInfo(). 1148 1149 QList<QByteArray> QObject::dynamicPropertyNames() const 1150 1151 Returns the names of all properties that were dynamically added to the object using setProperty(). 1152 1153 This function was introduced in Qt 4.2. 1154 1155 [virtual] bool QObject::event(QEvent *e) 1156 1157 This virtual function receives events to an object and should return true if the event e was recognized and processed. 1158 1159 The event() function can be reimplemented to customize the behavior of an object. 1160 1161 Make sure you call the parent event class implementation for all the events you did not handle. 1162 1163 Example: 1164 1165 class MyClass : public QWidget 1166 { 1167 Q_OBJECT 1168 1169 public: 1170 MyClass(QWidget *parent = 0); 1171 ~MyClass(); 1172 1173 bool event(QEvent* ev) 1174 { 1175 if (ev->type() == QEvent::PolishRequest) { 1176 // overwrite handling of PolishRequest if any 1177 doThings(); 1178 return true; 1179 } else if (ev->type() == QEvent::Show) { 1180 // complement handling of Show if any 1181 doThings2(); 1182 QWidget::event(ev); 1183 return true; 1184 } 1185 // Make sure the rest of events are handled 1186 return QWidget::event(ev); 1187 } 1188 }; 1189 See also installEventFilter(), timerEvent(), QCoreApplication::sendEvent(), and QCoreApplication::postEvent(). 1190 1191 [virtual] bool QObject::eventFilter(QObject *watched, QEvent *event) 1192 1193 Filters events if this object has been installed as an event filter for the watched object. 1194 1195 In your reimplementation of this function, if you want to filter the event out, i.e. stop it being handled further, return true; otherwise return false. 1196 1197 Example: 1198 1199 class MainWindow : public QMainWindow 1200 { 1201 public: 1202 MainWindow(); 1203 1204 protected: 1205 bool eventFilter(QObject *obj, QEvent *ev); 1206 1207 private: 1208 QTextEdit *textEdit; 1209 }; 1210 1211 MainWindow::MainWindow() 1212 { 1213 textEdit = new QTextEdit; 1214 setCentralWidget(textEdit); 1215 1216 textEdit->installEventFilter(this); 1217 } 1218 1219 bool MainWindow::eventFilter(QObject *obj, QEvent *event) 1220 { 1221 if (obj == textEdit) { 1222 if (event->type() == QEvent::KeyPress) { 1223 QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event); 1224 qDebug() << "Ate key press" << keyEvent->key(); 1225 return true; 1226 } else { 1227 return false; 1228 } 1229 } else { 1230 // pass the event on to the parent class 1231 return QMainWindow::eventFilter(obj, event); 1232 } 1233 } 1234 Notice in the example above that unhandled events are passed to the base class's eventFilter() function, since the base class might have reimplemented eventFilter() for its own internal purposes. 1235 1236 Warning: If you delete the receiver object in this function, be sure to return true. Otherwise, Qt will forward the event to the deleted object and the program might crash. 1237 1238 See also installEventFilter(). 1239 1240 T QObject::findChild(const QString &name = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const 1241 1242 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly. 1243 1244 If there is more than one child matching the search, the most direct ancestor is returned. If there are several direct ancestors, it is undefined which one will be returned. In that case, findChildren() should be used. 1245 1246 This example returns a child QPushButton of parentWidget named "button1", even if the button isn't a direct child of the parent: 1247 1248 QPushButton *button = parentWidget->findChild<QPushButton *>("button1"); 1249 This example returns a QListWidget child of parentWidget: 1250 1251 QListWidget *list = parentWidget->findChild<QListWidget *>(); 1252 This example returns a child QPushButton of parentWidget (its direct parent) named "button1": 1253 1254 QPushButton *button = parentWidget->findChild<QPushButton *>("button1", Qt::FindDirectChildrenOnly); 1255 This example returns a QListWidget child of parentWidget, its direct parent: 1256 1257 QListWidget *list = parentWidget->findChild<QListWidget *>(QString(), Qt::FindDirectChildrenOnly); 1258 See also findChildren(). 1259 1260 QList<T> QObject::findChildren(const QString &name = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const 1261 1262 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly. 1263 1264 The following example shows how to find a list of child QWidgets of the specified parentWidget named widgetname: 1265 1266 QList<QWidget *> widgets = parentWidget.findChildren<QWidget *>("widgetname"); 1267 This example returns all QPushButtons that are children of parentWidget: 1268 1269 QList<QPushButton *> allPButtons = parentWidget.findChildren<QPushButton *>(); 1270 This example returns all QPushButtons that are immediate children of parentWidget: 1271 1272 QList<QPushButton *> childButtons = parentWidget.findChildren<QPushButton *>(QString(), Qt::FindDirectChildrenOnly); 1273 See also findChild(). 1274 1275 QList<T> QObject::findChildren(const QRegExp ®Exp, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const 1276 1277 This function overloads findChildren(). 1278 1279 Returns the children of this object that can be cast to type T and that have names matching the regular expression regExp, or an empty list if there are no such objects. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly. 1280 1281 QList<T> QObject::findChildren(const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const 1282 1283 This function overloads findChildren(). 1284 1285 Returns the children of this object that can be cast to type T and that have names matching the regular expression re, or an empty list if there are no such objects. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly. 1286 1287 This function was introduced in Qt 5.0. 1288 1289 bool QObject::inherits(const char *className) const 1290 1291 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. 1292 1293 A class is considered to inherit itself. 1294 1295 Example: 1296 1297 QTimer *timer = new QTimer; // QTimer inherits QObject 1298 timer->inherits("QTimer"); // returns true 1299 timer->inherits("QObject"); // returns true 1300 timer->inherits("QAbstractButton"); // returns false 1301 1302 // QVBoxLayout inherits QObject and QLayoutItem 1303 QVBoxLayout *layout = new QVBoxLayout; 1304 layout->inherits("QObject"); // returns true 1305 layout->inherits("QLayoutItem"); // returns true (even though QLayoutItem is not a QObject) 1306 If you need to determine whether an object is an instance of a particular class for the purpose of casting it, consider using qobject_cast<Type *>(object) instead. 1307 1308 See also metaObject() and qobject_cast(). 1309 1310 void QObject::installEventFilter(QObject *filterObj) 1311 1312 Installs an event filter filterObj on this object. For example: 1313 1314 monitoredObj->installEventFilter(filterObj); 1315 An event filter is an object that receives all events that are sent to this object. The filter can either stop the event or forward it to this object. The event filter filterObj receives events via its eventFilter() function. The eventFilter() function must return true if the event should be filtered, (i.e. stopped); otherwise it must return false. 1316 1317 If multiple event filters are installed on a single object, the filter that was installed last is activated first. 1318 1319 Here's a KeyPressEater class that eats the key presses of its monitored objects: 1320 1321 class KeyPressEater : public QObject 1322 { 1323 Q_OBJECT 1324 ... 1325 1326 protected: 1327 bool eventFilter(QObject *obj, QEvent *event); 1328 }; 1329 1330 bool KeyPressEater::eventFilter(QObject *obj, QEvent *event) 1331 { 1332 if (event->type() == QEvent::KeyPress) { 1333 QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); 1334 qDebug("Ate key press %d", keyEvent->key()); 1335 return true; 1336 } else { 1337 // standard event processing 1338 return QObject::eventFilter(obj, event); 1339 } 1340 } 1341 And here's how to install it on two widgets: 1342 1343 KeyPressEater *keyPressEater = new KeyPressEater(this); 1344 QPushButton *pushButton = new QPushButton(this); 1345 QListView *listView = new QListView(this); 1346 1347 pushButton->installEventFilter(keyPressEater); 1348 listView->installEventFilter(keyPressEater); 1349 The QShortcut class, for example, uses this technique to intercept shortcut key presses. 1350 1351 Warning: If you delete the receiver object in your eventFilter() function, be sure to return true. If you return false, Qt sends the event to the deleted object and the program will crash. 1352 1353 Note that the filtering object must be in the same thread as this object. If filterObj is in a different thread, this function does nothing. If either filterObj or this object are moved to a different thread after calling this function, the event filter will not be called until both objects have the same thread affinity again (it is not removed). 1354 1355 See also removeEventFilter(), eventFilter(), and event(). 1356 1357 [protected] bool QObject::isSignalConnected(const QMetaMethod &signal) const 1358 1359 Returns true if the signal is connected to at least one receiver, otherwise returns false. 1360 1361 signal must be a signal member of this object, otherwise the behaviour is undefined. 1362 1363 static const QMetaMethod valueChangedSignal = QMetaMethod::fromSignal(&MyObject::valueChanged); 1364 if (isSignalConnected(valueChangedSignal)) { 1365 QByteArray data; 1366 data = get_the_value(); // expensive operation 1367 emit valueChanged(data); 1368 } 1369 As the code snippet above illustrates, you can use this function to avoid emitting a signal that nobody listens to. 1370 1371 Warning: This function violates the object-oriented principle of modularity. However, it might be useful when you need to perform expensive initialization only if something is connected to a signal. 1372 1373 This function was introduced in Qt 5.0. 1374 1375 bool QObject::isWidgetType() const 1376 1377 Returns true if the object is a widget; otherwise returns false. 1378 1379 Calling this function is equivalent to calling inherits("QWidget"), except that it is much faster. 1380 1381 bool QObject::isWindowType() const 1382 1383 Returns true if the object is a window; otherwise returns false. 1384 1385 Calling this function is equivalent to calling inherits("QWindow"), except that it is much faster. 1386 1387 void QObject::killTimer(int id) 1388 1389 Kills the timer with timer identifier, id. 1390 1391 The timer identifier is returned by startTimer() when a timer event is started. 1392 1393 See also timerEvent() and startTimer(). 1394 1395 [virtual] const QMetaObject *QObject::metaObject() const 1396 1397 Returns a pointer to the meta-object of this object. 1398 1399 A meta-object contains information about a class that inherits QObject, e.g. class name, superclass name, properties, signals and slots. Every QObject subclass that contains the Q_OBJECT macro will have a meta-object. 1400 1401 The meta-object information is required by the signal/slot connection mechanism and the property system. The inherits() function also makes use of the meta-object. 1402 1403 If you have no pointer to an actual object instance but still want to access the meta-object of a class, you can use staticMetaObject. 1404 1405 Example: 1406 1407 QObject *obj = new QPushButton; 1408 obj->metaObject()->className(); // returns "QPushButton" 1409 1410 QPushButton::staticMetaObject.className(); // returns "QPushButton" 1411 See also staticMetaObject. 1412 1413 void QObject::moveToThread(QThread *targetThread) 1414 1415 Changes the thread affinity for this object and its children. The object cannot be moved if it has a parent. Event processing will continue in the targetThread. 1416 1417 To move an object to the main thread, use QApplication::instance() to retrieve a pointer to the current application, and then use QApplication::thread() to retrieve the thread in which the application lives. For example: 1418 1419 myObject->moveToThread(QApplication::instance()->thread()); 1420 If targetThread is zero, all event processing for this object and its children stops. 1421 1422 Note that all active timers for the object will be reset. The timers are first stopped in the current thread and restarted (with the same interval) in the targetThread. As a result, constantly moving an object between threads can postpone timer events indefinitely. 1423 1424 A QEvent::ThreadChange event is sent to this object just before the thread affinity is changed. You can handle this event to perform any special processing. Note that any new events that are posted to this object will be handled in the targetThread. 1425 1426 Warning: This function is not thread-safe; the current thread must be same as the current thread affinity. In other words, this function can only "push" an object from the current thread to another thread, it cannot "pull" an object from any arbitrary thread to the current thread. 1427 1428 See also thread(). 1429 1430 [signal] void QObject::objectNameChanged(const QString &objectName) 1431 1432 This signal is emitted after the object's name has been changed. The new object name is passed as objectName. 1433 1434 Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user. 1435 1436 Note: Notifier signal for property objectName. 1437 1438 See also QObject::objectName. 1439 1440 QObject *QObject::parent() const 1441 1442 Returns a pointer to the parent object. 1443 1444 See also setParent() and children(). 1445 1446 QVariant QObject::property(const char *name) const 1447 1448 Returns the value of the object's name property. 1449 1450 If no such property exists, the returned variant is invalid. 1451 1452 Information about all available properties is provided through the metaObject() and dynamicPropertyNames(). 1453 1454 See also setProperty(), QVariant::isValid(), metaObject(), and dynamicPropertyNames(). 1455 1456 [protected] int QObject::receivers(const char *signal) const 1457 1458 Returns the number of receivers connected to the signal. 1459 1460 Since both slots and signals can be used as receivers for signals, and the same connections can be made many times, the number of receivers is the same as the number of connections made from this signal. 1461 1462 When calling this function, you can use the SIGNAL() macro to pass a specific signal: 1463 1464 if (receivers(SIGNAL(valueChanged(QByteArray))) > 0) { 1465 QByteArray data; 1466 get_the_value(&data); // expensive operation 1467 emit valueChanged(data); 1468 } 1469 Warning: This function violates the object-oriented principle of modularity. However, it might be useful when you need to perform expensive initialization only if something is connected to a signal. 1470 1471 See also isSignalConnected(). 1472 1473 void QObject::removeEventFilter(QObject *obj) 1474 1475 Removes an event filter object obj from this object. The request is ignored if such an event filter has not been installed. 1476 1477 All event filters for this object are automatically removed when this object is destroyed. 1478 1479 It is always safe to remove an event filter, even during event filter activation (i.e. from the eventFilter() function). 1480 1481 See also installEventFilter(), eventFilter(), and event(). 1482 1483 [protected] QObject *QObject::sender() const 1484 1485 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. The pointer is valid only during the execution of the slot that calls this function from this object's thread context. 1486 1487 The pointer returned by this function becomes invalid if the sender is destroyed, or if the slot is disconnected from the sender's signal. 1488 1489 Warning: This function violates the object-oriented principle of modularity. However, getting access to the sender might be useful when many signals are connected to a single slot. 1490 1491 Warning: As mentioned above, the return value of this function is not valid when the slot is called via a Qt::DirectConnection from a thread different from this object's thread. Do not use this function in this type of scenario. 1492 1493 See also senderSignalIndex() and QSignalMapper. 1494 1495 [protected] int QObject::senderSignalIndex() const 1496 1497 Returns the meta-method index of the signal that called the currently executing slot, which is a member of the class returned by sender(). If called outside of a slot activated by a signal, -1 is returned. 1498 1499 For signals with default parameters, this function will always return the index with all parameters, regardless of which was used with connect(). For example, the signal destroyed(QObject *obj = 0) will have two different indexes (with and without the parameter), but this function will always return the index with a parameter. This does not apply when overloading signals with different parameters. 1500 1501 Warning: This function violates the object-oriented principle of modularity. However, getting access to the signal index might be useful when many signals are connected to a single slot. 1502 1503 Warning: The return value of this function is not valid when the slot is called via a Qt::DirectConnection from a thread different from this object's thread. Do not use this function in this type of scenario. 1504 1505 This function was introduced in Qt 4.8. 1506 1507 See also sender(), QMetaObject::indexOfSignal(), and QMetaObject::method(). 1508 1509 void QObject::setParent(QObject *parent) 1510 1511 Makes the object a child of parent. 1512 1513 See also parent() and children(). 1514 1515 bool QObject::setProperty(const char *name, const QVariant &value) 1516 1517 Sets the value of the object's name property to value. 1518 1519 If the property is defined in the class using Q_PROPERTY then true is returned on success and false otherwise. If the property is not defined using Q_PROPERTY, and therefore not listed in the meta-object, it is added as a dynamic property and false is returned. 1520 1521 Information about all available properties is provided through the metaObject() and dynamicPropertyNames(). 1522 1523 Dynamic properties can be queried again using property() and can be removed by setting the property value to an invalid QVariant. Changing the value of a dynamic property causes a QDynamicPropertyChangeEvent to be sent to the object. 1524 1525 Note: Dynamic properties starting with "_q_" are reserved for internal purposes. 1526 1527 See also property(), metaObject(), dynamicPropertyNames(), and QMetaProperty::write(). 1528 1529 bool QObject::signalsBlocked() const 1530 1531 Returns true if signals are blocked; otherwise returns false. 1532 1533 Signals are not blocked by default. 1534 1535 See also blockSignals() and QSignalBlocker. 1536 1537 int QObject::startTimer(int interval, Qt::TimerType timerType = Qt::CoarseTimer) 1538 1539 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. 1540 1541 A timer event will occur every interval milliseconds until killTimer() is called. If interval is 0, then the timer event occurs once every time there are no more window system events to process. 1542 1543 The virtual timerEvent() function is called with the QTimerEvent event parameter class when a timer event occurs. Reimplement this function to get timer events. 1544 1545 If multiple timers are running, the QTimerEvent::timerId() can be used to find out which timer was activated. 1546 1547 Example: 1548 1549 class MyObject : public QObject 1550 { 1551 Q_OBJECT 1552 1553 public: 1554 MyObject(QObject *parent = 0); 1555 1556 protected: 1557 void timerEvent(QTimerEvent *event); 1558 }; 1559 1560 MyObject::MyObject(QObject *parent) 1561 : QObject(parent) 1562 { 1563 startTimer(50); // 50-millisecond timer 1564 startTimer(1000); // 1-second timer 1565 startTimer(60000); // 1-minute timer 1566 } 1567 1568 void MyObject::timerEvent(QTimerEvent *event) 1569 { 1570 qDebug() << "Timer ID:" << event->timerId(); 1571 } 1572 Note that QTimer's accuracy depends on the underlying operating system and hardware. The timerType argument allows you to customize the accuracy of the timer. See Qt::TimerType for information on the different timer types. Most platforms support an accuracy of 20 milliseconds; some provide more. If Qt is unable to deliver the requested number of timer events, it will silently discard some. 1573 1574 The QTimer class provides a high-level programming interface with single-shot timers and timer signals instead of events. There is also a QBasicTimer class that is more lightweight than QTimer and less clumsy than using timer IDs directly. 1575 1576 See also timerEvent(), killTimer(), and QTimer::singleShot(). 1577 1578 QThread *QObject::thread() const 1579 1580 Returns the thread in which the object lives. 1581 1582 See also moveToThread(). 1583 1584 [virtual protected] void QObject::timerEvent(QTimerEvent *event) 1585 1586 This event handler can be reimplemented in a subclass to receive timer events for the object. 1587 1588 QTimer provides a higher-level interface to the timer functionality, and also more general information about timers. The timer event is passed in the event parameter. 1589 1590 See also startTimer(), killTimer(), and event(). 1591 1592 [static] QString QObject::tr(const char *sourceText, const char *disambiguation = Q_NULLPTR, int n = -1) 1593 1594 Returns a translated version of sourceText, optionally based on a disambiguation string and value of n for strings containing plurals; otherwise returns QString::fromUtf8(sourceText) if no appropriate translated string is available. 1595 1596 Example: 1597 1598 void MainWindow::createActions() 1599 { 1600 QMenu *fileMenu = menuBar()->addMenu(tr("&File")); 1601 ... 1602 If the same sourceText is used in different roles within the same context, an additional identifying string may be passed in disambiguation (0 by default). In Qt 4.4 and earlier, this was the preferred way to pass comments to translators. 1603 1604 Example: 1605 1606 MyWindow::MyWindow() 1607 { 1608 QLabel *senderLabel = new QLabel(tr("Name:")); 1609 QLabel *recipientLabel = new QLabel(tr("Name:", "recipient")); 1610 ... 1611 See Writing Source Code for Translation for a detailed description of Qt's translation mechanisms in general, and the Disambiguation section for information on disambiguation. 1612 1613 Warning: This method is reentrant only if all translators are installed before calling this method. Installing or removing translators while performing translations is not supported. Doing so will probably result in crashes or other undesirable behavior. 1614 1615 See also QCoreApplication::translate() and Internationalization with Qt. 1616 1617 Member Variable Documentation 1618 1619 const QMetaObject QObject::staticMetaObject 1620 1621 This variable stores the meta-object for the class. 1622 1623 A meta-object contains information about a class that inherits QObject, e.g. class name, superclass name, properties, signals and slots. Every class that contains the Q_OBJECT macro will also have a meta-object. 1624 1625 The meta-object information is required by the signal/slot connection mechanism and the property system. The inherits() function also makes use of the meta-object. 1626 1627 If you have a pointer to an object, you can use metaObject() to retrieve the meta-object associated with that object. 1628 1629 Example: 1630 1631 QPushButton::staticMetaObject.className(); // returns "QPushButton" 1632 1633 QObject *obj = new QPushButton; 1634 obj->metaObject()->className(); // returns "QPushButton" 1635 See also metaObject(). 1636 1637 Related Non-Members 1638 1639 typedef QObjectList 1640 1641 Synonym for QList<QObject *>. 1642 1643 QList<T> qFindChildren(const QObject *obj, const QRegExp ®Exp) 1644 1645 This function overloads qFindChildren(). 1646 1647 This function is equivalent to obj->findChildren<T>(regExp). 1648 1649 Note: This function was provided as a workaround for MSVC 6 which did not support member template functions. It is advised to use the other form in new code. 1650 1651 See also QObject::findChildren(). 1652 1653 T qobject_cast(QObject *object) 1654 1655 Returns the given object cast to type T if the object is of type T (or of a subclass); otherwise returns 0. If object is 0 then it will also return 0. 1656 1657 The class T must inherit (directly or indirectly) QObject and be declared with the Q_OBJECT macro. 1658 1659 A class is considered to inherit itself. 1660 1661 Example: 1662 1663 QObject *obj = new QTimer; // QTimer inherits QObject 1664 1665 QTimer *timer = qobject_cast<QTimer *>(obj); 1666 // timer == (QObject *)obj 1667 1668 QAbstractButton *button = qobject_cast<QAbstractButton *>(obj); 1669 // button == 0 1670 The qobject_cast() function behaves similarly to the standard C++ dynamic_cast(), with the advantages that it doesn't require RTTI support and it works across dynamic library boundaries. 1671 1672 qobject_cast() can also be used in conjunction with interfaces; see the Plug & Paint example for details. 1673 1674 Warning: If T isn't declared with the Q_OBJECT macro, this function's return value is undefined. 1675 1676 See also QObject::inherits(). 1677 1678 Macro Documentation 1679 1680 Q_CLASSINFO(Name, Value) 1681 1682 This macro associates extra information to the class, which is available using QObject::metaObject(). Qt makes only limited use of this feature, in the Active Qt, Qt D-Bus and Qt QML. 1683 1684 The extra information takes the form of a Name string and a Value literal string. 1685 1686 Example: 1687 1688 class MyClass : public QObject 1689 { 1690 Q_OBJECT 1691 Q_CLASSINFO("Author", "Pierre Gendron") 1692 Q_CLASSINFO("URL", "http://www.my-organization.qc.ca") 1693 1694 public: 1695 ... 1696 }; 1697 See also QMetaObject::classInfo(), QAxFactory, Using Qt D-Bus Adaptors, and Extending QML. 1698 1699 Q_DISABLE_COPY(Class) 1700 1701 Disables the use of copy constructors and assignment operators for the given Class. 1702 1703 Instances of subclasses of QObject should not be thought of as values that can be copied or assigned, but as unique identities. This means that when you create your own subclass of QObject (director or indirect), you should not give it a copy constructor or an assignment operator. However, it may not enough to simply omit them from your class, because, if you mistakenly write some code that requires a copy constructor or an assignment operator (it's easy to do), your compiler will thoughtfully create it for you. You must do more. 1704 1705 The curious user will have seen that the Qt classes derived from QObject typically include this macro in a private section: 1706 1707 class MyClass : public QObject 1708 { 1709 1710 private: 1711 Q_DISABLE_COPY(MyClass) 1712 }; 1713 It declares a copy constructor and an assignment operator in the private section, so that if you use them by mistake, the compiler will report an error. 1714 1715 class MyClass : public QObject 1716 { 1717 1718 private: 1719 MyClass(const MyClass &); 1720 MyClass &operator=(const MyClass &); 1721 }; 1722 But even this might not catch absolutely every case. You might be tempted to do something like this: 1723 1724 QWidget w = QWidget(); 1725 First of all, don't do that. Most compilers will generate code that uses the copy constructor, so the privacy violation error will be reported, but your C++ compiler is not required to generate code for this statement in a specific way. It could generate code using neither the copy constructor nor the assignment operator we made private. In that case, no error would be reported, but your application would probably crash when you called a member function of w. 1726 1727 Q_EMIT 1728 1729 Use this macro to replace the emit keyword for emitting signals, when you want to use Qt Signals and Slots with a 3rd party signal/slot mechanism. 1730 1731 The macro is normally used when no_keywords is specified with the CONFIG variable in the .pro file, but it can be used even when no_keywords is not specified. 1732 1733 Q_ENUM(...) 1734 1735 This macro registers an enum type with the meta-object system. It must be placed after the enum declaration in a class that has the Q_OBJECT or the Q_GADGET macro. 1736 1737 For example: 1738 1739 class MyClass : public QObject 1740 { 1741 Q_OBJECT 1742 1743 public: 1744 MyClass(QObject *parent = 0); 1745 ~MyClass(); 1746 1747 enum Priority { High, Low, VeryHigh, VeryLow }; 1748 Q_ENUM(Priority) 1749 void setPriority(Priority priority); 1750 Priority priority() const; 1751 }; 1752 Enumerations that are declared with Q_ENUM have their QMetaEnum registered in the enclosing QMetaObject. You can also use QMetaEnum::fromType() to get the QMetaEnum. 1753 1754 Registered enumerations are automatically registered also to the Qt meta type system, making them known to QMetaType without the need to use Q_DECLARE_METATYPE(). This will enable useful features; for example, if used in a QVariant, you can convert them to strings. Likewise, passing them to QDebug will print out their names. 1755 1756 This function was introduced in Qt 5.5. 1757 1758 See also Qt's Property System. 1759 1760 Q_FLAG(...) 1761 1762 This macro registers a single flags types with the meta-object system. It is typically used in a class definition to declare that values of a given enum can be used as flags and combined using the bitwise OR operator. 1763 1764 The macro must be placed after the enum declaration. 1765 1766 For example, in QLibrary, the LoadHints flag is declared in the following way: 1767 1768 class QLibrary : public QObject 1769 { 1770 Q_OBJECT 1771 1772 public: 1773 ... 1774 1775 enum LoadHint { 1776 ResolveAllSymbolsHint = 0x01, 1777 ExportExternalSymbolsHint = 0x02, 1778 LoadArchiveMemberHint = 0x04 1779 }; 1780 Q_DECLARE_FLAGS(LoadHints, LoadHint) 1781 Q_FLAG(LoadHints) 1782 ... 1783 } 1784 The declaration of the flags themselves is performed in the public section of the QLibrary class itself, using the Q_DECLARE_FLAGS() macro. 1785 1786 Note: The Q_FLAG macro takes care of registering individual flag values with the meta-object system, so it is unnecessary to use Q_ENUM() in addition to this macro. 1787 1788 This function was introduced in Qt 5.5. 1789 1790 See also Qt's Property System. 1791 1792 Q_GADGET 1793 1794 The Q_GADGET macro is a lighter version of the Q_OBJECT macro for classes that do not inherit from QObject but still want to use some of the reflection capabilities offered by QMetaObject. Just like the Q_OBJECT macro, it must appear in the private section of a class definition. 1795 1796 Q_GADGETs can have Q_ENUM, Q_PROPERTY and Q_INVOKABLE, but they cannot have signals or slots 1797 1798 Q_GADGET makes a class member, staticMetaObject, available. staticMetaObject is of type QMetaObject and provides access to the enums declared with Q_ENUMS. 1799 1800 Q_INTERFACES(...) 1801 1802 This macro tells Qt which interfaces the class implements. This is used when implementing plugins. 1803 1804 Example: 1805 1806 class BasicToolsPlugin : public QObject, 1807 public BrushInterface, 1808 public ShapeInterface, 1809 public FilterInterface 1810 { 1811 Q_OBJECT 1812 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Examples.PlugAndPaint.BrushInterface" FILE "basictools.json") 1813 Q_INTERFACES(BrushInterface ShapeInterface FilterInterface) 1814 1815 public: 1816 ... 1817 }; 1818 See the Plug & Paint Basic Tools example for details. 1819 1820 See also Q_DECLARE_INTERFACE(), Q_PLUGIN_METADATA(), and How to Create Qt Plugins. 1821 1822 Q_INVOKABLE 1823 1824 Apply this macro to declarations of member functions to allow them to be invoked via the meta-object system. The macro is written before the return type, as shown in the following example: 1825 1826 class Window : public QWidget 1827 { 1828 Q_OBJECT 1829 1830 public: 1831 Window(); 1832 void normalMethod(); 1833 Q_INVOKABLE void invokableMethod(); 1834 }; 1835 The invokableMethod() function is marked up using Q_INVOKABLE, causing it to be registered with the meta-object system and enabling it to be invoked using QMetaObject::invokeMethod(). Since normalMethod() function is not registered in this way, it cannot be invoked using QMetaObject::invokeMethod(). 1836 1837 Q_OBJECT 1838 1839 The Q_OBJECT macro must appear in the private section of a class definition that declares its own signals and slots or that uses other services provided by Qt's meta-object system. 1840 1841 For example: 1842 1843 #include <QObject> 1844 1845 class Counter : public QObject 1846 { 1847 Q_OBJECT 1848 1849 public: 1850 Counter() { m_value = 0; } 1851 1852 int value() const { return m_value; } 1853 1854 public slots: 1855 void setValue(int value); 1856 1857 signals: 1858 void valueChanged(int newValue); 1859 1860 private: 1861 int m_value; 1862 }; 1863 Note: This macro requires the class to be a subclass of QObject. Use Q_GADGET instead of Q_OBJECT to enable the meta object system's support for enums in a class that is not a QObject subclass. 1864 1865 See also Meta-Object System, Signals and Slots, and Qt's Property System. 1866 1867 Q_PROPERTY(...) 1868 1869 This macro is used for declaring properties in classes that inherit QObject. Properties behave like class data members, but they have additional features accessible through the Meta-Object System. 1870 1871 Q_PROPERTY(type name 1872 (READ getFunction [WRITE setFunction] | 1873 MEMBER memberName [(READ getFunction | WRITE setFunction)]) 1874 [RESET resetFunction] 1875 [NOTIFY notifySignal] 1876 [REVISION int] 1877 [DESIGNABLE bool] 1878 [SCRIPTABLE bool] 1879 [STORED bool] 1880 [USER bool] 1881 [CONSTANT] 1882 [FINAL]) 1883 The property name and type and the READ function are required. The type can be any type supported by QVariant, or it can be a user-defined type. The other items are optional, but a WRITE function is common. The attributes default to true except USER, which defaults to false. 1884 1885 For example: 1886 1887 Q_PROPERTY(QString title READ title WRITE setTitle USER true) 1888 For more details about how to use this macro, and a more detailed example of its use, see the discussion on Qt's Property System. 1889 1890 See also Qt's Property System. 1891 1892 Q_REVISION 1893 1894 Apply this macro to declarations of member functions to tag them with a revision number in the meta-object system. The macro is written before the return type, as shown in the following example: 1895 1896 class Window : public QWidget 1897 { 1898 Q_OBJECT 1899 Q_PROPERTY(int normalProperty READ normalProperty) 1900 Q_PROPERTY(int newProperty READ newProperty REVISION 1) 1901 1902 public: 1903 Window(); 1904 int normalProperty(); 1905 int newProperty(); 1906 public slots: 1907 void normalMethod(); 1908 Q_REVISION(1) void newMethod(); 1909 }; 1910 This is useful when using the meta-object system to dynamically expose objects to another API, as you can match the version expected by multiple versions of the other API. Consider the following simplified example: 1911 1912 Window window; 1913 int expectedRevision = 0; 1914 const QMetaObject *windowMetaObject = window.metaObject(); 1915 for (int i=0; i < windowMetaObject->methodCount(); i++) 1916 if (windowMetaObject->method(i).revision() <= expectedRevision) 1917 exposeMethod(windowMetaObject->method(i)); 1918 for (int i=0; i < windowMetaObject->propertyCount(); i++) 1919 if (windowMetaObject->property(i).revision() <= expectedRevision) 1920 exposeProperty(windowMetaObject->property(i)); 1921 Using the same Window class as the previous example, the newProperty and newMethod would only be exposed in this code when the expected version is 1 or greater. 1922 1923 Since all methods are considered to be in revision 0 if untagged, a tag of Q_REVISION(0) is invalid and ignored. 1924 1925 This tag is not used by the meta-object system itself. Currently this is only used by the QtQml module. 1926 1927 For a more generic string tag, see QMetaMethod::tag() 1928 1929 See also QMetaMethod::revision(). 1930 1931 Q_SET_OBJECT_NAME(Object) 1932 1933 This macro assigns Object the objectName "Object". 1934 1935 It doesn't matter whether Object is a pointer or not, the macro figures that out by itself. 1936 1937 This function was introduced in Qt 5.0. 1938 1939 See also QObject::objectName(). 1940 1941 Q_SIGNAL 1942 1943 This is an additional macro that allows you to mark a single function as a signal. It can be quite useful, especially when you use a 3rd-party source code parser which doesn't understand a signals or Q_SIGNALS groups. 1944 1945 Use this macro to replace the signals keyword in class declarations, when you want to use Qt Signals and Slots with a 3rd party signal/slot mechanism. 1946 1947 The macro is normally used when no_keywords is specified with the CONFIG variable in the .pro file, but it can be used even when no_keywords is not specified. 1948 1949 Q_SIGNALS 1950 1951 Use this macro to replace the signals keyword in class declarations, when you want to use Qt Signals and Slots with a 3rd party signal/slot mechanism. 1952 1953 The macro is normally used when no_keywords is specified with the CONFIG variable in the .pro file, but it can be used even when no_keywords is not specified. 1954 1955 Q_SLOT 1956 1957 This is an additional macro that allows you to mark a single function as a slot. It can be quite useful, especially when you use a 3rd-party source code parser which doesn't understand a slots or Q_SLOTS groups. 1958 1959 Use this macro to replace the slots keyword in class declarations, when you want to use Qt Signals and Slots with a 3rd party signal/slot mechanism. 1960 1961 The macro is normally used when no_keywords is specified with the CONFIG variable in the .pro file, but it can be used even when no_keywords is not specified. 1962 1963 Q_SLOTS 1964 1965 Use this macro to replace the slots keyword in class declarations, when you want to use Qt Signals and Slots with a 3rd party signal/slot mechanism. 1966 1967 The macro is normally used when no_keywords is specified with the CONFIG variable in the .pro file, but it can be used even when no_keywords is not specified. 1968 1969 ? 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. 1970 1971 1972 Download 1973 Start for Free 1974 Qt for Application Development 1975 Qt for Device Creation 1976 Qt Open Source 1977 Terms & Conditions 1978 Licensing FAQ 1979 Product 1980 Qt in Use 1981 Qt for Application Development 1982 Qt for Device Creation 1983 Commercial Features 1984 Qt Creator IDE 1985 Qt Quick 1986 Services 1987 Technology Evaluation 1988 Proof of Concept 1989 Design & Implementation 1990 Productization 1991 Qt Training 1992 Partner Network 1993 Developers 1994 Documentation 1995 Examples & Tutorials 1996 Development Tools 1997 Wiki 1998 Forums 1999 Contribute to Qt 2000 About us 2001 Training & Events 2002 Resource Center 2003 News 2004 Careers 2005 Locations 2006 Contact Us 2007 2008 2009 Qt MerchandiseSign InFeedback? 2016 The Qt Company
//337.out.txt -- 输出数据 单词表总数: 3233 单词频率最高: the 次数: 576 所有单词为: 单词数为: ! 2 Search: 1 Go 1 Reference<deque>deque 1 Not 1 logged 1 in 201 registerlog 1 class 65 template 7 : 18 <deque> 3 ? 4 std::deque 1 < 3 T, 2 Alloc 2 = 88 allocator<T> 1 > 2 deque; 1 Double 1 ended 1 queue 3 deque 8 (usually 1 pronounced 1 like 5 "deck") 1 is 261 an 63 irregular 1 acronym 1 of 213 double-ended 1 queue. 3 Double-ended 1 queues 1 are 91 sequence 3 containers 3 with 74 dynamic 9 sizes 1 that 100 can 93 be 144 expanded 1 or 79 contracted 1 on 35 both 6 ends 1 (either 1 its 22 front 2 back). 1 Specific 2 libraries 3 may 16 implement 3 deques 5 different 18 ways, 3 generally 1 as 62 some 4 form 3 array. 1 But 2 any 25 case, 4 they 10 allow 2 for 132 the 576 individual 2 elements 12 to 288 accessed 2 directly 2 through 5 random 3 access 10 iterators, 1 storage 4 handled 4 automatically 11 by 43 expanding 1 and 194 contracting 1 container 7 needed. 1 Therefore, 2 provide 5 a 271 functionality 1 similar 3 vectors, 3 but 26 efficient 1 insertion 2 deletion 2 also 72 at 20 beginning 9 sequence, 1 not 68 only 20 end. 2 But, 1 unlike 1 guaranteed 1 store 4 all 34 contiguous 1 locations: 1 accessing 1 offsetting 1 pointer 12 another 7 element 13 causes 4 undefined 2 behavior. 3 Both 1 vectors 2 very 3 interface 5 used 51 purposes, 1 internally 3 work 2 quite 3 ways: 1 While 1 use 46 single 11 array 2 needs 4 occasionally 1 reallocated 1 growth, 1 scattered 1 chunks 1 storage, 1 keeping 1 necessary 1 information 21 direct 7 constant 1 time 4 uniform 1 sequential 1 (through 1 iterators). 1 little 1 more 15 complex 1 than 16 this 96 allows 5 them 11 grow 1 efficiently 1 under 13 certain 3 circumstances, 1 especially 3 long 4 sequences, 1 where 3 reallocations 1 become 4 expensive. 1 For 15 operations 2 involve 1 frequent 1 removals 1 positions 1 other 20 end, 1 perform 6 worse 1 have 23 less 2 consistent 1 iterators 1 references 2 lists 2 forward 3 lists. 1 Container 1 properties 11 Sequence 1 Elements 1 ordered 1 strict 1 linear 1 sequence. 3 Individual 1 their 11 position 1 Dynamic 6 Generally 1 implemented 2 array, 1 it 77 provides 9 relatively 1 fast 1 addition/removal 1 end 8 Allocator-aware 1 The 108 uses 6 allocator 4 object 104 dynamically 3 handle 13 needs. 1 Template 1 parameters 5 T 12 Type 4 elements. 1 Aliased 2 member 49 type 42 deque::value_type. 1 define 1 allocation 2 model. 1 By 5 default, 5 used, 1 which 23 defines 1 simplest 1 memory 2 model 2 value-independent. 1 deque::allocator_type. 1 Member 4 types 7 C++98C++11 1 definition 3 notes 1 value_type 3 first 8 parameter 6 (T) 1 allocator_type 1 second 1 (Alloc) 1 defaults 2 to: 2 allocator<value_type> 1 reference 1 allocator_type::reference 1 default 6 allocator: 4 value_type& 2 const_reference 1 allocator_type::const_reference 1 const 127 allocator_type::pointer 1 value_type* 2 const_pointer 1 allocator_type::const_pointer 1 iterator 7 convertible 1 const_iterator 4 reverse_iterator 1 reverse_iterator<iterator> 1 const_reverse_iterator 3 reverse_iterator<const_iterator> 1 difference_type 2 signed 1 integral 2 type, 5 identical 1 iterator_traits<iterator>::difference_type 1 usually 3 same 29 ptrdiff_t 1 size_type 1 unsigned 1 represent 3 non-negative 1 value 13 size_t 1 functions 16 (constructor) 1 Construct 4 (public 33 function 131 ) 35 (destructor) 1 Deque 1 destructor 2 operator= 1 Assign 2 content 4 Iterators: 1 begin 1 Return 10 rbegin 1 reverse 6 rend 1 cbegin 1 cend 1 crbegin 1 crend 1 Capacity: 1 size 4 max_size 1 maximum 1 resize 1 Change 1 empty 6 Test 3 whether 8 shrink_to_fit 1 Shrink 1 fit 1 Element 1 access: 1 operator[] 1 Access 5 back 1 last 6 Modifiers: 1 assign 1 push_back 1 Add 1 push_front 1 Insert 2 pop_back 1 Delete 2 pop_front 1 insert 4 erase 1 Erase 1 swap 3 Swap 1 clear 1 Clear 1 emplace 1 emplace_front 1 emplace_back 1 Allocator: 1 get_allocator 1 Get 1 Non-member 1 overloads 11 relational 2 operators 4 Relational 1 (function 2 Exchanges 1 contents 1 two 7 C++ 10 Information 11 Tutorials 5 Reference 7 Articles 1 Forum 3 C 5 library: 1 Containers: 1 <array> 1 <forward_list> 1 <list> 1 <map> 1 <queue> 1 <set> 1 <stack> 1 <unordered_map> 1 <unordered_set> 1 <vector> 1 Input/Output: 1 Multi-threading: 1 Other: 1 deque::deque 1 deque::~deque 1 functions: 2 deque::assign 1 deque::at 1 deque::back 1 deque::begin 1 deque::cbegin 1 deque::cend 1 deque::clear 1 deque::crbegin 1 deque::crend 1 deque::emplace 1 deque::emplace_back 1 deque::emplace_front 1 deque::empty 1 deque::end 1 deque::erase 1 deque::front 1 deque::get_allocator 1 deque::insert 1 deque::max_size 1 deque::operator= 1 deque::operator[] 1 deque::pop_back 1 deque::pop_front 1 deque::push_back 1 deque::push_front 1 deque::rbegin 1 deque::rend 1 deque::resize 1 deque::shrink_to_fit 1 deque::size 1 deque::swap 1 non-member 1 overloads: 1 (deque) 2 Home 1 page 5 | 3 Privacy 1 policy 1 cplusplus.com, 1 2000-2016 1 - 3 All 22 rights 1 reserved 2 v3.1 1 Spotted 1 error? 1 contact 3 us 3 Download 4 Device 6 Creation 6 Application 7 Development 10 Services 4 Developers 4 Wiki 4 Documentation 17 Bug 2 Reports 2 Code 6 Review 2 Qt 187 5.7 2 Licensing 11 Contents 2 Purchasing 3 Sales 2 Licenses 21 Used 5 Additional 2 Classes 3 QML 4 Types 2 Modules 2 Creator 5 Manual 2 Getting 4 Started 4 What's 2 New 2 5 2 Examples 4 Supported 2 Platforms 2 Overviews 4 Tools 6 User 2 Interfaces 2 Core 8 Internals 2 Data 3 Storage 2 Multimedia 3 Networking 2 Connectivity 2 Graphics 2 Mobile 2 APIs 2 Applications 2 available 8 licensing 3 options 13 designed 1 accommodate 1 our 2 various 1 users: 1 licensed 6 commercial 9 licenses 6 appropriate 3 development 2 proprietary/commercial 1 software 4 you 66 do 10 want 10 share 1 source 6 code 14 third 1 parties 1 otherwise 16 cannot 16 comply 2 terms 6 GNU 13 LGPL 7 version 14 3. 1 Lesser 2 General 3 Public 11 License 26 (LGPL) 2 3 3 applications 1 provided 7 conditions 1 (or 3 GPL 6 3). 1 Note: 26 Some 2 specific 16 parts 5 (modules) 1 framework 1 3, 1 (GPL) 1 instead. 2 See 63 details. 6 documentation 4 Free 8 (FDL) 1 1.3, 1 published 3 Software 3 Foundation. 3 Alternatively, 1 accordance 1 contained 1 written 4 agreement 1 between 9 Company. 1 http://qt.io/licensing/ 1 overview 1 licensing. 1 To 4 purchase 1 license, 2 visit 1 http://www.qt.io/download/. 1 further 1 assistance 1 about 16 licensing, 1 sales; 1 see 5 http://www.qt.io/locations/ 1 following 10 table 1 incorporate 1 well 1 modules 4 license 10 license. 1 Third-party 18 supplied 3 alongside 1 listed. 1 Cross-module 1 dependencies 2 described 1 general 3 level. 1 depend 1 Core. 1 Module/Tool 2 Component 2 Description 4 Notes 3 QSegfaultHandler 2 Parts 6 implementation 3 class. 2 BSD-style 33 QUrl 1 Implementation 4 QUrl::fromUserInput(). 1 Modified 2 BSD 17 Cocoa 4 Platform 2 Plugin 2 OS 3 X 4 port. 2 qtmain 3 library 15 A 41 helper 2 writing 1 cross-platform 1 main() 1 Windows. 1 Windows 6 Shift-JIS 1 Text 7 Codec 7 character 7 encoding 5 Japanese. 2 ISO-2022-JP 1 (JIS) 1 widely 1 EUC-JP 2 variable-width 1 three 3 Japanese 2 set 7 standards. 1 EUC-KR 1 TextCodec 1 Extended 1 Unix 2 (EUC) 1 multibyte 1 system 7 primarily 1 Japanese, 1 Korean, 1 simplified 3 Chinese. 1 GBK 2 extension 1 GB2312 1 Chinese 6 characters, 1 mainland 1 China. 1 Big5 1 Big5, 1 BIG-5, 1 method 20 Traditional 1 characters. 2 Big5-HKSCS 2 4700 1 TSCII 3 codec 1 conversion 5 from 47 Tamil 1 encoding. 1 Stack-less 1 Just-In-Time 1 compiler 9 platform-independent 1 JIT 1 compiler. 1 codecs 1 Unicode 2 data. 1 Permissive, 1 GPL-compatible 1 Macros 4 building 2 files 2 CMake 1 Qt. 5 PCRE 2 regular 3 expression 3 pattern 1 matching 4 using 26 syntax 1 semantics 1 Perl 1 5. 1 Android 6 Run-time 2 run-time 3 (libstdc++) 1 Android. 1 GPLv3 6 exception 2 forkfd 1 tool 2 facilitate 1 spawning 1 sub-processes. 1 MIT 12 systems 1 FreeBSD 1 strtoll 1 strtoull 1 Functions 6 converting 2 string 6 integer. 1 V8 3 double/string 1 strings 2 doubles. 1 MD4 2 implements 6 message-digest 2 algorithm. 4 MD5 2 Mesa 2 llvmpipe 2 rasterizer 1 backend 1 (opengl32sw.dll) 1 builds. 1 SHA-1 2 encryption 2 SHA-3 2 zlib 2 purpose 2 data 5 compression 2 library. 3 Suffix 1 List 2 list 9 known 4 public 21 Internet 1 suffixes. 1 Mozilla 1 Gui 2 QKeyMapper 1 Internal 1 key 5 mapping. 1 Custom, 1 Linux/X11 4 QImage 1 smooth 1 scaling 1 QImage::transformed(). 1 FreeType 6 project 3 font 2 rendering. 2 GPLv2, 2 Project 2 HarfBuzz 1 OpenType 1 layout 1 engine. 2 2 1 PNG 2 Library 4 reducing 1 effort 1 takes 5 support 14 format. 1 Pixman 2 low-level 1 pixel 1 manipulation 3 features 2 such 9 image 5 compositing 1 trapezoid 1 rasterization. 1 Drag 1 Drop 1 Allows 1 users 1 transfer 1 within 5 applications. 2 ANGLE 1 Opensource 1 map 1 OpenGL 5 ES 5 API 3 calls 4 DirectX 1 API. 2 Location 1 Poly2Tri 2 sweepline 1 constrained 1 Delaunay 1 Polygon 1 Triangulation 1 Library. 1 FFTReal 1 Fast 1 Fourier 1 transform 1 real-valued 1 arrays. 1 (Used 4 example 18 code). 3 Canvas 1 3D 4 three.js 1 JavaScript 1 code) 1 Three.js 1 Loader 1 parser 4 loading 1 models 1 JSON 1 structures. 1 gl-matrix.js 1 High 1 performance 2 matrix 1 vector 1 SVG 5 arc 1 handling 4 module. 2 Depends 4 Gui, 2 Widgets 2 Quick 5 Easing 2 Equations 2 collection 2 swappable 1 add 2 flavor 1 motion. 1 QML, 1 Network 4 Controls 1 Native 1 Style 1 Apache 4 2.0 3 Script 1 (Provided 1 4 1 compatibility) 1 benchmark 4 tests 4 Script. 2 Sunspider 2 JavaScriptCore 2 v2 4 Testlib 1 BSD, 2 Valgrind 1 analysis 1 detecting 1 leaks. 1 valgrind.h 1 Callgrind 1 profiling 1 tool. 1 Print 1 Support 3 PDF 3 Licensing. 1 Wayland 2 Protocol 1 WebEngine 3 v3 1 + 5 Chromium 2 LGPLv2.1, 1 BSL, 1 Apache, 1 APSL, 1 MIT, 1 MPL, 1 others 1 Designer 5 recursive 1 shadow 1 casting 5 algorithm 1 Designer. 2 (MIT) 1 Botan 1 crypto 1 Creator. 1 Image 1 Formats 1 JasPer 1 coding 1 images. 1 TIFF 2 libtiff 1 (a 1 library) 1 files. 3 MNG 2 decoding 2 displaying 2 format 2 WebP 2 SQL 2 SQLite 1 self-contained, 1 embeddable, 1 zero-configuration 1 database 1 XML 1 Patterns 1 Bison 2 Parser 1 generator. 1 assimp 1 Open 4 Asset 1 Import 1 Plugins 1 JPEG 2 decompression. 1 IAccessible2 1 An 5 accessibility 2 Microsoft 1 Cycle 1 CPU 1 tick 1 counter. 1 callgrind.h 1 xcb 1 language 1 binding 1 Window 5 System. 7 at-spi 1 at-spi2 1 toolkit-neutral 1 way 4 providing 1 facilities 1 application. 1 xkbcommon 1 Keymap 1 toolkits 1 window 2 systems. 1 Clucene 1 high-performance, 1 full-featured 1 text 2 search 5 engine 1 C++. 1 LGPL/Apache 1 licenses: 1 Charts 1 Visualization 1 Virtual 1 Keyboard 1 Lipi 1 Toolkit 1 open 2 toolkit 1 online 1 Handwriting 1 Recognition 1 (HWR). 1 MIT-Style 1 OpenWnn 1 IME 2 Pinyin 1 Standard 1 input. 1 tcime 1 traditional 1 IME. 1 2D 1 Renderer 1 EGL 2 1.5 2 Headers 3 These 4 headers 3 based 5 specification. 4 SGI 2 3.1 2 OpenKODE 2 1.0 2 Header 1 header 2 Qml 1 Macro 2 Assembler 1 assembly 1 generated 1 JIT. 1 documents 1 below 1 related 1 documents, 1 Trademark 1 Provides 1 additional 5 Contributions 1 Files 1 contributions 3 Apple, 1 Inc. 1 Fonts 1 Embedded 1 Linux 1 fonts 1 Details 1 restrictions 1 PDF-related 1 trademarks. 1 Source 5 Describes 1 Third-Party 1 third-party 1 Trademarks 1 trademarks 5 owned 1 Company 7 organizations. 1 2016 4 Ltd. 4 included 2 herein 4 copyrights 2 respective 6 owners. 4 1.3 2 logos 2 Finland 2 and/or 2 countries 2 worldwide. 2 property 15 Start 2 Terms 2 & 12 Conditions 2 FAQ 2 Product 2 Use 9 Commercial 2 Features 2 IDE 2 Technology 2 Evaluation 2 Proof 2 Concept 2 Design 2 Productization 2 Training 4 Partner 2 Forums 2 Contribute 2 About 2 Events 2 Resource 2 Center 2 News 2 Careers 2 Locations 2 Contact 2 Us 2 MerchandiseSign 2 InFeedback? 2 QObject 118 Properties 5 Slots 7 Signals 10 Static 2 Members 2 Protected 2 Related 3 Non-Members 3 Detailed 2 Thread 2 Affinity 2 No 2 Copy 2 Constructor 2 Assignment 2 Operator 2 Auto-Connection 2 Internationalization 3 (I18n) 2 Class 1 base 4 objects. 11 More... 1 Header: 1 #include 2 <QObject> 3 qmake: 1 QT 1 += 1 core 1 Instantiated 1 By: 2 QtObject 1 Inherited 1 Q3DObject, 1 Q3DScene, 1 Q3DTheme, 1 QAbstract3DAxis, 1 QAbstract3DInputHandler, 1 QAbstract3DSeries, 1 QAbstractAnimation, 1 QAbstractAxis, 1 QAbstractDataProxy, 1 QAbstractEventDispatcher, 1 QAbstractItemDelegate, 1 QAbstractItemModel, 1 QAbstractMessageHandler, 1 QAbstractNetworkCache, 1 QAbstractSeries, 1 QAbstractState, 1 QAbstractTextDocumentLayout, 1 QAbstractTransition, 1 QAbstractUriResolver, 1 QAbstractVideoFilter, 1 QAbstractVideoSurface, 1 QAccessiblePlugin, 1 QAction, 1 QActionGroup, 1 QAudioInput, 1 QAudioOutput, 1 QAudioProbe, 1 QAxFactory, 2 QAxObject, 1 QAxScript, 1 QAxScriptManager, 1 QBarSet, 1 QBluetoothDeviceDiscoveryAgent, 1 QBluetoothLocalDevice, 1 QBluetoothServer, 1 QBluetoothServiceDiscoveryAgent, 1 QBluetoothTransferManager, 1 QBluetoothTransferReply, 1 QBoxSet, 1 QButtonGroup, 1 QCameraExposure, 1 QCameraFocus, 1 QCameraImageCapture, 1 QCameraImageProcessing, 1 QCanBus, 1 QCanBusDevice, 1 QClipboard, 1 QCompleter, 1 QCoreApplication, 1 QCustom3DItem, 1 QDataWidgetMapper, 1 QDBusAbstractAdaptor, 1 QDBusAbstractInterface, 1 QDBusPendingCallWatcher, 1 QDBusServer, 1 QDBusServiceWatcher, 1 QDBusVirtualObject, 1 QDesignerFormEditorInterface, 1 QDesignerFormWindowManagerInterface, 1 QDnsLookup, 1 QDrag, 1 QEventLoop, 1 QExtensionFactory, 1 QExtensionManager, 1 QFileSelector, 1 QFileSystemWatcher, 1 QGamepad, 1 QGenericPlugin, 1 QGeoAreaMonitorSource, 1 QGeoCodeReply, 1 QGeoCodingManager, 1 QGeoCodingManagerEngine, 1 QGeoPositionInfoSource, 1 QGeoRouteReply, 1 QGeoRoutingManager, 1 QGeoRoutingManagerEngine, 1 QGeoSatelliteInfoSource, 1 QGeoServiceProvider, 1 QGesture, 1 QGLShader, 1 QGLShaderProgram, 1 QGraphicsAnchor, 1 QGraphicsEffect, 1 QGraphicsItemAnimation, 1 QGraphicsObject, 1 QGraphicsScene, 1 QGraphicsTransform, 1 QHelpEngineCore, 1 QHelpSearchEngine, 1 QHttpMultiPart, 1 QIconEnginePlugin, 1 QImageIOPlugin, 1 QInAppProduct, 1 QInAppStore, 1 QInAppTransaction, 1 QInputMethod, 1 QIODevice, 1 QItemSelectionModel, 1 QJSEngine, 1 QLayout, 1 QLegendMarker, 1 QLibrary, 2 QLocalServer, 1 QLowEnergyController, 1 QLowEnergyService, 1 QMacToolBar, 1 QMacToolBarItem, 1 QMaskGenerator, 1 QMediaControl, 1 QMediaObject, 1 QMediaPlaylist, 1 QMediaRecorder, 1 QMediaService, 1 QMediaServiceProviderPlugin, 1 QMimeData, 1 QModbusDevice, 1 QModbusReply, 1 QMovie, 1 QNearFieldManager, 1 QNearFieldShareManager, 1 QNearFieldShareTarget, 1 QNearFieldTarget, 1 QNetworkAccessManager, 1 QNetworkConfigurationManager, 1 QNetworkCookieJar, 1 QNetworkSession, 1 QObjectCleanupHandler, 2 QOffscreenSurface, 1 QOpenGLContext, 1 QOpenGLContextGroup, 1 QOpenGLDebugLogger, 1 QOpenGLShader, 1 QOpenGLShaderProgram, 1 QOpenGLTimeMonitor, 1 QOpenGLTimerQuery, 1 QOpenGLVertexArrayObject, 1 QPdfWriter, 1 QPictureFormatPlugin, 1 QPieSlice, 1 QPlaceManager, 1 QPlaceManagerEngine, 1 QPlaceReply, 1 QPlatformGraphicsBuffer, 1 QPlatformSystemTrayIcon, 1 QPluginLoader, 1 QQmlComponent, 1 QQmlContext, 1 QQmlExpression, 1 QQmlExtensionPlugin, 1 QQmlFileSelector, 1 QQmlNdefRecord, 1 QQmlPropertyMap, 1 QQuickImageResponse, 1 QQuickItem, 1 QQuickItemGrabResult, 1 QQuickRenderControl, 1 QQuickTextDocument, 1 QQuickTextureFactory, 1 QQuickWebEngineProfile, 1 QRadioData, 1 QScreen, 1 QScriptEngine, 1 QScriptEngineDebugger, 1 QScriptExtensionPlugin, 1 QScroller, 1 QScxmlDataModel, 1 QScxmlStateMachine, 1 QSensor, 1 QSensorBackend, 1 QSensorGesture, 1 QSensorGestureManager, 1 QSensorGestureRecognizer, 1 QSensorReading, 1 QSessionManager, 1 QSettings, 1 QSGAbstractRenderer, 1 QSGEngine, 1 QSGTexture, 1 QSGTextureProvider, 1 QSharedMemory, 1 QShortcut, 1 QSignalMapper, 1 QSignalSpy, 1 QSocketNotifier, 1 QSound, 1 QSoundEffect, 1 QSqlDriver, 1 QSqlDriverPlugin, 1 QStyle, 1 QStyleHints, 1 QStylePlugin, 1 QSvgRenderer, 1 QSyntaxHighlighter, 1 QSystemTrayIcon, 1 Qt3DCore::QAbstractAspect, 1 Qt3DCore::QAspectEngine, 1 Qt3DCore::QNode, 1 Qt3DCore::Quick::QQmlAspectEngine, 1 Qt3DInput::QKeyEvent, 1 Qt3DInput::QMouseEvent, 1 Qt3DInput::QWheelEvent, 1 Qt3DRender::QGraphicsApiFilter, 1 Qt3DRender::QPickEvent, 1 Qt3DRender::QTextureWrapMode, 1 QTcpServer, 1 QTextDocument, 1 QTextObject, 1 QThread, 1 QThreadPool, 1 QTimeLine, 1 QTimer, 1 QTranslator, 1 QtVirtualKeyboard::InputContext, 1 QtVirtualKeyboard::InputEngine, 1 QtVirtualKeyboard::ShiftHandler, 1 QUiLoader, 1 QUndoGroup, 1 QUndoStack, 1 QValidator, 1 QValue3DAxisFormatter, 1 QVideoProbe, 1 QWaylandClient, 1 QWaylandSurfaceGrabber, 1 QWaylandView, 1 QWebChannel, 1 QWebChannelAbstractTransport, 1 QWebEngineCookieStore, 1 QWebEngineDownloadItem, 1 QWebEnginePage, 1 QWebEngineProfile, 1 QWebEngineUrlRequestInterceptor, 1 QWebEngineUrlRequestJob, 1 QWebEngineUrlSchemeHandler, 1 QWebSocket, 1 QWebSocketServer, 1 QWidget, 1 QWindow, 1 QWinEventNotifier, 1 QWinJumpList, 1 QWinTaskbarButton, 1 QWinTaskbarProgress, 1 QWinThumbnailToolBar, 1 QWinThumbnailToolButton 1 members, 2 including 1 inherited 1 members 2 Obsolete 1 reentrant. 1 thread-safe: 1 connect(const 13 *sender, 29 char 46 *signal, 14 *receiver, 23 *method, 8 Qt::ConnectionType 16 type) 6 PointerToMemberFunction 18 signal, 17 method, 6 Functor 6 functor) 3 *context, 3 functor, 4 disconnect(const 11 *method) 5 method) 3 objectName 3 QString 15 QObject(QObject 1 *parent 5 Q_NULLPTR) 8 virtual 14 ~QObject() 1 bool 35 blockSignals(bool 1 block) 2 QObjectList 6 children() 2 QMetaObject::Connection 18 Qt::AutoConnection) 10 *signal 2 Q_NULLPTR, 6 *receiver 2 *method 4 void 46 dumpObjectInfo() 1 dumpObjectTree() 1 QList<QByteArray> 2 dynamicPropertyNames() 1 event(QEvent 1 *e) 2 eventFilter(QObject 3 *watched, 2 QEvent 7 *event) 11 findChild(const 1 &name 4 QString(), 4 Qt::FindChildOptions 8 Qt::FindChildrenRecursively) 8 QList<T> 8 findChildren(const 3 QRegExp 4 ®Exp, 2 QRegularExpression 2 &re, 2 inherits(const 1 *className) 2 installEventFilter(QObject 1 *filterObj) 2 isWidgetType() 3 isWindowType() 1 killTimer(int 1 id) 2 QMetaObject 6 * 4 metaObject() 7 moveToThread(QThread 1 *targetThread) 2 objectName() 3 parent() 2 QVariant 4 property(const 1 *name) 2 removeEventFilter(QObject 1 *obj) 2 setObjectName(const 2 &name) 2 setParent(QObject 1 *parent) 3 setProperty(const 1 *name, 2 &value) 2 signalsBlocked() 2 int 13 startTimer(int 1 interval, 2 Qt::TimerType 3 timerType 3 Qt::CoarseTimer) 2 QThread 4 thread() 3 deleteLater() 8 destroyed(QObject 2 *obj 6 objectNameChanged(const 2 &objectName) 3 QMetaMethod 18 &signal, 4 &method, 2 &method) 2 &connection) 2 staticMetaObject 2 tr(const 1 *sourceText, 2 *disambiguation 2 n 3 -1) 2 childEvent(QChildEvent 1 connectNotify(const 1 &signal) 6 customEvent(QEvent 1 disconnectNotify(const 1 isSignalConnected(const 1 receivers(const 1 *signal) 2 sender() 1 senderSignalIndex() 2 timerEvent(QTimerEvent 2 typedef 4 qFindChildren(const 2 *obj, 6 ®Exp) 2 qobject_cast(QObject 2 *object) 2 Q_CLASSINFO(Name, 2 Value) 2 Q_DISABLE_COPY(Class) 2 Q_EMIT 2 Q_ENUM(...) 2 Q_FLAG(...) 2 Q_GADGET 6 Q_INTERFACES(...) 2 Q_INVOKABLE 3 Q_OBJECT 23 Q_PROPERTY(...) 2 Q_REVISION 2 Q_SET_OBJECT_NAME(Object) 2 Q_SIGNAL 2 Q_SIGNALS 3 Q_SLOT 2 Q_SLOTS 3 heart 1 Object 6 Model. 1 central 1 feature 1 powerful 1 mechanism 4 seamless 1 communication 1 called 20 signals 31 slots. 3 You 20 connect 4 signal 90 slot 24 connect() 2 destroy 1 connection 41 disconnect(). 5 avoid 3 never 4 ending 1 notification 1 loops 1 temporarily 1 block 3 blockSignals(). 1 protected 1 connectNotify() 2 disconnectNotify() 2 make 5 possible 4 track 1 connections. 3 QObjects 5 organize 1 themselves 2 trees. 1 When 5 create 6 parent, 1 will 56 itself 1 parent's 1 list. 2 parent 11 ownership 1 object; 1 i.e., 1 delete 5 children 16 destructor. 1 look 1 name 14 optionally 2 findChild() 1 findChildren(). 6 Every 4 has 17 found 2 via 5 corresponding 4 (see 1 QMetaObject::className()). 1 determine 2 object's 13 inherits 8 inheritance 1 hierarchy 1 inherits() 3 function. 4 deleted, 2 emits 2 destroyed() 4 signal. 19 catch 3 dangling 1 QObjects. 1 receive 8 events 23 event() 3 filter 12 installEventFilter() 1 eventFilter() 7 convenience 2 handler, 1 childEvent(), 1 reimplemented 6 child 25 events. 6 Last 1 least, 1 basic 1 timer 24 Qt; 1 QTimer 8 high-level 2 timers. 2 Notice 2 macro 37 mandatory 1 signals, 4 slots 22 properties. 2 need 7 run 2 Meta 1 Compiler 1 file. 1 We 2 strongly 1 recommend 2 subclasses 4 regardless 2 actually 2 properties, 3 since 2 failure 1 so 8 lead 1 exhibit 1 strange 1 widgets 5 inherit 6 QObject. 3 returns 37 widget. 1 It 15 much 3 faster 1 qobject_cast<QWidget 1 *>(obj) 1 obj->inherits("QWidget"). 1 functions, 1 e.g. 3 children(), 1 return 32 QObjectList. 1 QList<QObject 2 *>. 2 instance 5 said 1 thread 33 affinity, 1 lives 5 thread. 4 receives 4 queued 6 posted 4 event, 3 event 54 handler 4 in. 1 If 62 no 15 affinity 5 (that 1 is, 1 if 80 zero), 1 running 3 loop, 2 then 5 created. 1 queried 2 changed 1 moveToThread(). 2 must 30 live 3 parent. 7 Consequently: 1 setParent() 2 fail 4 involved 5 threads. 1 moved 4 thread, 4 too. 1 moveToThread() 2 created 2 QThread::run(), 1 because 4 does 8 QThread::run(). 1 QObject's 1 variables 2 children. 3 parent-child 1 relationship 1 either 8 passing 2 child's 2 constructor, 3 calling 6 setParent(). 2 Without 1 step, 1 remain 1 old 1 when 54 called. 3 neither 2 copy 11 constructor 7 nor 2 assignment 7 operator. 3 This 84 design. 1 Actually, 1 declared, 1 private 8 section 6 Q_DISABLE_COPY(). 1 In 12 fact, 1 classes 4 derived 2 (direct 1 indirect) 1 declare 3 operator 4 private. 2 reasoning 1 discussion 2 Identity 1 vs 1 Value 2 Model 1 page. 1 main 3 consequence 1 should 10 pointers 2 your 14 subclass) 1 might 12 tempted 2 subclass 10 value. 3 example, 10 without 5 can't 1 stored 1 one 14 classes. 3 pointers. 1 Qt's 11 meta-object 20 As 4 objects 16 defined 4 suitable 1 names, 2 follow 1 simple 1 naming 1 convention, 1 performed 7 QMetaObject::connectSlotsByName() 1 uic 1 generates 1 invokes 1 enable 3 auto-connection 2 forms 2 More 1 given 13 Using 3 UI 1 File 1 Your 1 manual. 1 From 2 4.2, 1 added 6 removed 10 instances 1 run-time. 1 declared 10 compile-time, 1 yet 2 advantages 2 static 2 manipulated 1 property() 2 read 1 setProperty() 1 write 2 them. 2 4.3, 1 supported 2 Designer, 1 standard 3 user-created 1 translation 2 features, 1 making 2 translate 1 application's 1 user 2 into 2 languages. 1 user-visible 1 translatable, 1 wrapped 1 tr() 1 explained 1 detail 1 Writing 2 Translation 2 document. 1 QMetaObject, 1 QPointer, 1 Q_DISABLE_COPY(), 1 Trees 1 Ownership. 1 Property 6 holds 1 object. 19 find 4 (and 1 findChild(). 2 qDebug("MyClass::setPrecision(): 1 (%s) 1 invalid 11 precision 1 %f", 1 qPrintable(objectName()), 1 newPrecision); 1 contains 5 string. 2 Notifier 2 signal: 5 [see 1 note 1 below] 1 connections 8 emitted 12 user. 2 QMetaObject::className(). 1 Function 1 QObject::QObject(QObject 1 Constructs 1 viewed 1 owner. 1 instance, 1 dialog 1 box 1 OK 1 Cancel 1 buttons 1 contains. 1 destroys 1 Setting 1 0 10 constructs 1 widget, 2 top-level 1 window. 1 parent(), 2 findChild(), 2 [virtual] 4 QObject::~QObject() 1 Destroys 1 object, 4 deleting 2 disconnected, 4 pending 4 However, 11 often 1 safer 1 rather 1 directly. 2 Warning: 17 deleted. 2 these 3 stack 1 global, 1 sooner 1 later 3 program 3 crash. 4 holding 1 outside 2 still 5 do, 1 gives 1 opportunity 1 detect 1 destroyed. 8 Deleting 1 while 3 waiting 1 delivered 5 cause 2 exists 1 currently 2 executing. 1 instead, 1 loop 7 after 8 been 11 it. 1 deleteLater(). 1 QObject::blockSignals(bool 1 true, 2 blocked 3 (i.e., 1 emitting 3 invoke 1 anything 5 connected 33 it). 1 false, 2 blocking 1 occur. 1 previous 2 signalsBlocked(). 1 Note 8 even 9 blocked. 2 being 3 buffered. 1 QSignalBlocker. 2 [virtual 5 protected] 5 QObject::childEvent(QChildEvent 1 passed 6 parameter. 4 QEvent::ChildAdded 1 QEvent::ChildRemoved 1 sent 6 removed. 1 cases 1 rely 1 QObject, 4 QWidget. 1 (This 1 because, 2 ChildAdded 2 fully 1 constructed, 1 ChildRemoved 2 case 2 destructed 1 already). 1 QEvent::ChildPolished 1 polished, 1 polished 4 added. 2 construction 2 completed. 1 guaranteed, 1 multiple 4 polish 1 during 4 execution 2 widget's 1 constructor. 1 every 6 zero 2 ChildPolished 2 events, 2 event. 1 omitted 1 immediately 5 several 5 times 1 destruction, 1 child, 1 each 1 table. 1 event(). 4 &QObject::children() 1 Returns 26 file 1 following: 1 QList<QObject*> 1 QObjectList; 1 list, 2 i.e. 2 new 25 appended 1 order 4 changes 1 QWidget 6 raised 2 lowered. 1 widget 2 becomes 3 lowered 1 findChildren(), 1 [static] 10 QObject::connect(const 6 Creates 5 sender 17 receiver 15 disconnect 9 later. 3 SIGNAL() 2 SLOT() 1 macros 1 specifying 1 example: 9 QLabel 4 *label 2 QLabel; 2 QScrollBar 1 *scrollBar 1 QScrollBar; 1 QObject::connect(scrollBar, 2 SIGNAL(valueChanged(int)), 1 label, 4 SLOT(setNum(int))); 1 ensures 2 label 2 always 5 displays 2 current 8 scroll 1 bar 1 contain 1 variable 7 type. 2 E.g. 1 would 4 false: 1 // 26 WRONG 1 SIGNAL(valueChanged(int 1 value)), 1 SLOT(setNum(int 1 value))); 1 MyWidget 2 { 40 public: 11 MyWidget(); 1 signals: 4 buttonClicked(); 1 private: 5 QPushButton 8 *myButton; 1 }; 15 MyWidget::MyWidget() 1 myButton 1 QPushButton(this); 2 connect(myButton, 1 SIGNAL(clicked()), 1 this, 4 SIGNAL(buttonClicked())); 1 } 21 relays 1 variable, 1 makes 5 relates 1 MyWidget. 1 many 8 signals. 3 Many 2 slot. 12 slots, 2 activated 5 were 4 made, 2 emitted. 4 represents 2 successfully 5 connects 2 connection, 4 unable 3 verify 2 existence 2 signatures 1 aren't 1 compatible. 1 check 3 valid 6 bool. 3 make; 2 duplicate 5 break 3 disconnect() 6 call. 2 pass 5 Qt::UniqueConnection 2 made 5 duplicate. 2 there 10 already 3 (exact 2 exact 2 objects), 2 QMetaObject::Connection. 2 optional 2 describes 2 establish. 2 particular, 2 determines 2 particular 3 delivery 2 time. 2 queued, 2 system, 4 arguments 11 behind 2 scenes. 2 try 2 get 4 error 4 message 2 QObject::connect: 2 Cannot 2 'MyType' 4 (Make 2 sure 8 registered 6 qRegisterMetaType().) 2 call 4 qRegisterMetaType() 1 register 1 before 7 establish 1 connection. 2 thread-safe 8 disconnect(), 1 sender(), 2 qRegisterMetaType(), 1 Q_DECLARE_METATYPE(). 2 Connection 2 invalid. 2 works 2 specify 1 method. 4 was 22 introduced 12 4.8. 3 type). 2 connect(). 8 Connects 1 Equivalent 1 connect(sender, 1 emit 4 header. 3 least 5 slot, 2 implicit 3 Example: 14 QLineEdit 1 *lineEdit 1 QLineEdit; 1 QObject::connect(lineEdit, 1 &QLineEdit::textChanged, 2 &QLabel::setText); 2 line 1 edit 1 text. 1 (if 1 signal) 1 argument 7 Q_DECLARE_METATYPE 1 Overloaded 3 resolved 3 help 3 qOverload. 3 number 10 limited 4 6 2 C++11 5 variadic 3 templates. 1 functor 9 exactly 2 arguments. 2 There 3 exist 2 someFunction(); 2 *button 5 QPushButton; 4 QObject::connect(button, 2 &QPushButton::clicked, 2 someFunction); 1 lambda 3 expressions, 2 them: 2 QByteArray 4 ...; 2 QTcpSocket 2 *socket 2 QTcpSocket; 2 socket->connectToHost("qt-project.org", 2 80); 2 QObject::connect(socket, 2 &QTcpSocket::connected, 2 [=] 2 () 2 socket->write("GET 2 " 2 "\r\n"); 2 }); 1 take 2 care 3 alive 2 templates, 2 6, 2 overloaded 5 templated 2 operator(). 2 placed 3 context, 2 someFunction, 1 Qt::QueuedConnection); 1 }, 1 Qt::AutoConnection); 1 context 1 5.2. 1 QObject::connectNotify(const 1 something 6 compare 3 QMetaMethod::fromSignal() 1 follows: 1 (signal 1 == 8 QMetaMethod::fromSignal(&MyObject::valueChanged)) 1 valueChanged 1 violates 6 object-oriented 6 principle 6 modularity. 6 useful 10 expensive 6 initialization 3 performs 2 lives. 4 5.0. 5 disconnectNotify(). 1 QObject::customEvent(QEvent 1 custom 1 Custom 1 user-defined 2 large 1 QEvent::User 1 item 1 QEvent::Type 1 enum, 1 typically 5 subclass. 2 QEvent. 1 [slot] 1 QObject::deleteLater() 1 Schedules 1 deletion. 1 deleted 4 control 2 loop. 1 (e.g. 1 QCoreApplication::exec()), 1 once 2 started. 2 stopped, 1 Since 4 4.8, 1 destroyed 2 finishes. 1 entering 1 leaving 1 (e.g., 2 opening 1 modal 1 dialog) 1 deferred 2 deletion; 1 safe 2 once; 1 delivered, 1 QPointer. 2 [signal] 2 QObject::destroyed(QObject 1 obj 2 destroyed, 2 objects's 1 QObject::disconnect(const 6 Disconnects 5 receiver. 6 true 16 broken; 3 false. 12 signal-slot 4 examples 2 demonstrate. 2 Disconnect 8 everything 4 disconnect(myObject, 6 0, 15 0); 9 equivalent 6 non-static 3 myObject->disconnect(); 1 SIGNAL(mySignal()), 1 myObject->disconnect(SIGNAL(mySignal())); 1 receiver: 2 myReceiver, 2 myObject->disconnect(myReceiver); 1 wildcard, 2 meaning 4 "any 9 signal", 2 receiving 6 object", 4 respectively. 2 0. 6 (You 2 call.) 2 disconnects 6 not, 7 specified 8 disconnected. 5 named 5 left 4 alone. 2 out, 3 specifically-named 2 possibilities 1 Additionally 1 returnsfalse 1 disconnected 4 if: 1 QMetaMethod() 1 wildcard 1 signal" 1 object". 2 QMetaMethod(). 1 *method). 1 receiver's 1 nothing 3 diconnect(). 1 &MyObject::mySignal(), 1 slot: 1 QObject::disconnect(lineEdit, 1 overload 2 diconnect 1 functors 1 expressions. 1 That 1 Instead, 1 QObject::disconnectNotify(const 1 how 4 0), 1 once, 1 (QMetaMethod::isValid() 1 false). 1 optimizing 1 resources. 1 disconnection, 1 internal 3 mutex 3 locked. 1 therefore 2 allowed 1 re-enter 1 reimplementation 2 lock 1 reimplementation, 1 don't 2 held 1 places 1 result 2 deadlock. 1 connectNotify(). 1 QObject::dumpObjectInfo() 1 Dumps 2 connections, 1 etc. 1 debug 2 output. 2 debugging, 2 compiled 2 release 2 mode 2 (i.e. 4 debugging 2 information). 2 dumpObjectTree(). 1 QObject::dumpObjectTree() 1 tree 1 dumpObjectInfo(). 1 QObject::dynamicPropertyNames() 1 names 5 setProperty(). 1 4.2. 1 QObject::event(QEvent 1 e 1 recognized 1 processed. 1 customize 2 behavior 1 Make 2 did 2 handle. 1 MyClass 8 MyClass(QWidget 1 ~MyClass(); 2 event(QEvent* 1 ev) 1 (ev->type() 2 QEvent::PolishRequest) 1 overwrite 1 PolishRequest 1 doThings(); 1 true; 5 else 4 QEvent::Show) 1 complement 1 Show 1 doThings2(); 1 QWidget::event(ev); 2 rest 1 installEventFilter(), 2 timerEvent(), 2 QCoreApplication::sendEvent(), 1 QCoreApplication::postEvent(). 1 QObject::eventFilter(QObject 1 Filters 1 installed 4 watched 1 function, 6 stop 2 further, 1 MainWindow 1 QMainWindow 1 MainWindow(); 1 protected: 3 *ev); 1 QTextEdit 1 *textEdit; 1 MainWindow::MainWindow() 1 textEdit 1 QTextEdit; 1 setCentralWidget(textEdit); 1 textEdit->installEventFilter(this); 1 MainWindow::eventFilter(QObject 1 (obj 1 textEdit) 1 (event->type() 2 QEvent::KeyPress) 2 QKeyEvent 2 *keyEvent 2 static_cast<QKeyEvent*>(event); 1 qDebug() 2 << 4 "Ate 1 press" 1 keyEvent->key(); 1 false; 1 QMainWindow::eventFilter(obj, 1 event); 2 above 2 unhandled 1 class's 1 own 3 purposes. 2 true. 2 Otherwise, 1 installEventFilter(). 1 QObject::findChild(const 1 cast 5 name, 5 Omitting 2 matched. 2 recursively, 4 unless 4 specifies 4 option 4 FindDirectChildrenOnly. 4 search, 1 most 1 ancestor 1 returned. 4 ancestors, 1 findChildren() 1 used. 1 parentWidget 3 "button1", 1 button 2 isn't 2 parent: 2 parentWidget->findChild<QPushButton 2 *>("button1"); 1 QListWidget 4 parentWidget: 3 *list 2 parentWidget->findChild<QListWidget 2 *>(); 2 (its 1 parent) 1 "button1": 1 *>("button1", 1 Qt::FindDirectChildrenOnly); 3 parentWidget, 1 *>(QString(), 2 QObject::findChildren(const 3 shows 1 QWidgets 1 widgetname: 1 QList<QWidget 1 *> 3 parentWidget.findChildren<QWidget 1 *>("widgetname"); 1 QPushButtons 2 QList<QPushButton 2 allPButtons 1 parentWidget.findChildren<QPushButton 2 immediate 1 childButtons 1 regExp, 1 re, 1 QObject::inherits(const 1 className 1 className; 1 considered 3 itself. 4 *timer 2 QTimer; 2 timer->inherits("QTimer"); 1 timer->inherits("QObject"); 1 timer->inherits("QAbstractButton"); 1 false 3 QVBoxLayout 2 QLayoutItem 2 *layout 1 QVBoxLayout; 1 layout->inherits("QObject"); 1 layout->inherits("QLayoutItem"); 1 (even 1 though 1 QObject) 1 it, 1 consider 1 qobject_cast<Type 1 *>(object) 1 qobject_cast(). 1 QObject::installEventFilter(QObject 1 Installs 1 filterObj 4 monitoredObj->installEventFilter(filterObj); 1 filtered, 1 stopped); 1 filters 2 first. 1 Here's 1 KeyPressEater 3 eats 1 presses 1 monitored 1 objects: 1 ... 7 *event); 2 KeyPressEater::eventFilter(QObject 1 static_cast<QKeyEvent 1 *>(event); 1 qDebug("Ate 1 press 1 %d", 1 keyEvent->key()); 1 processing 3 QObject::eventFilter(obj, 1 And 1 here's 1 install 1 widgets: 1 *keyPressEater 1 KeyPressEater(this); 1 *pushButton 1 QListView 1 *listView 1 QListView(this); 1 pushButton->installEventFilter(keyPressEater); 1 listView->installEventFilter(keyPressEater); 1 QShortcut 1 class, 4 technique 1 intercept 1 shortcut 1 presses. 1 sends 1 filtering 1 nothing. 1 until 2 again 2 (it 1 removed). 1 removeEventFilter(), 1 eventFilter(), 2 [protected] 4 QObject::isSignalConnected(const 1 receiver, 1 behaviour 1 undefined. 2 valueChangedSignal 1 QMetaMethod::fromSignal(&MyObject::valueChanged); 1 (isSignalConnected(valueChangedSignal)) 1 data; 2 get_the_value(); 1 operation 2 valueChanged(data); 2 snippet 1 illustrates, 1 nobody 1 listens 1 to. 1 QObject::isWidgetType() 1 widget; 1 Calling 2 inherits("QWidget"), 1 except 3 faster. 2 QObject::isWindowType() 1 window; 2 inherits("QWindow"), 1 QObject::killTimer(int 1 Kills 1 identifier, 2 id. 1 identifier 1 returned 5 startTimer() 1 timerEvent() 2 startTimer(). 1 *QObject::metaObject() 1 superclass 2 meta-object. 4 required 3 signal/slot 7 system. 7 actual 1 staticMetaObject. 2 obj->metaObject()->className(); 2 "QPushButton" 4 QPushButton::staticMetaObject.className(); 2 QObject::moveToThread(QThread 1 Changes 1 Event 1 continue 1 targetThread. 3 move 1 QApplication::instance() 1 retrieve 3 application, 1 QApplication::thread() 1 application 2 myObject->moveToThread(QApplication::instance()->thread());1 targetThread 1 zero, 1 stops. 1 active 1 timers 4 reset. 1 stopped 1 restarted 1 (with 2 interval) 1 result, 1 constantly 1 moving 1 threads 1 postpone 1 indefinitely. 1 QEvent::ThreadChange 1 just 1 changed. 2 special 1 processing. 1 thread-safe; 1 affinity. 1 words, 1 "push" 1 "pull" 1 arbitrary 1 thread(). 1 QObject::objectNameChanged(const 1 objectName. 2 QObject::objectName. 1 *QObject::parent() 1 children(). 2 QObject::property(const 1 property. 1 exists, 1 variant 1 dynamicPropertyNames(). 3 setProperty(), 1 QVariant::isValid(), 1 metaObject(), 2 QObject::receivers(const 1 receivers 3 times, 1 (receivers(SIGNAL(valueChanged(QByteArray))) 1 0) 2 get_the_value(&data); 1 isSignalConnected(). 1 QObject::removeEventFilter(QObject 1 Removes 1 request 1 ignored 1 installed. 1 remove 1 filter, 1 activation 1 function). 1 *QObject::sender() 1 signal; 1 context. 1 sender's 1 getting 2 mentioned 1 above, 1 Qt::DirectConnection 2 Do 2 scenario. 2 QSignalMapper. 1 QObject::senderSignalIndex() 1 meta-method 1 index 4 executing 1 sender(). 1 -1 1 parameters, 2 indexes 1 parameter), 1 apply 1 overloading 1 parameters. 1 QMetaObject::indexOfSignal(), 1 QMetaObject::method(). 1 QObject::setParent(QObject 1 Makes 1 QObject::setProperty(const 1 Sets 1 Q_PROPERTY 2 success 1 otherwise. 1 Q_PROPERTY, 1 listed 1 meta-object, 1 setting 1 QVariant. 1 Changing 1 QDynamicPropertyChangeEvent 1 starting 1 "_q_" 1 property(), 1 dynamicPropertyNames(), 1 QMetaProperty::write(). 1 QObject::signalsBlocked() 1 blocked; 1 default. 1 blockSignals() 1 QObject::startTimer(int 1 Starts 1 could 2 start 1 timer. 2 occur 1 interval 2 milliseconds 1 killTimer() 1 occurs 1 process. 1 QTimerEvent 1 occurs. 1 Reimplement 1 running, 1 QTimerEvent::timerId() 1 out 3 activated. 1 MyObject 1 MyObject(QObject 1 MyObject::MyObject(QObject 1 QObject(parent) 1 startTimer(50); 1 50-millisecond 1 startTimer(1000); 1 1-second 1 startTimer(60000); 1 1-minute 1 MyObject::timerEvent(QTimerEvent 1 "Timer 1 ID:" 1 event->timerId(); 1 QTimer's 1 accuracy 3 depends 1 underlying 1 operating 1 hardware. 1 types. 1 Most 2 platforms 1 20 1 milliseconds; 1 more. 2 deliver 1 requested 1 silently 1 discard 1 some. 1 programming 1 single-shot 1 instead 2 QBasicTimer 1 lightweight 1 clumsy 1 IDs 1 killTimer(), 2 QTimer::singleShot(). 1 *QObject::thread() 1 QObject::timerEvent(QTimerEvent 1 higher-level 1 functionality, 1 startTimer(), 1 QObject::tr(const 1 translated 2 sourceText, 1 disambiguation 2 containing 1 plurals; 1 QString::fromUtf8(sourceText) 1 available. 2 MainWindow::createActions() 1 QMenu 1 *fileMenu 1 menuBar()->addMenu(tr("&File")); 1 sourceText 1 roles 1 identifying 1 (0 1 default). 1 4.4 1 earlier, 1 preferred 1 comments 1 translators. 1 MyWindow::MyWindow() 1 *senderLabel 1 QLabel(tr("Name:")); 1 *recipientLabel 1 QLabel(tr("Name:", 1 "recipient")); 1 detailed 2 description 1 mechanisms 1 general, 1 Disambiguation 1 disambiguation. 1 reentrant 1 translators 2 Installing 1 removing 1 performing 1 translations 1 supported. 1 Doing 1 probably 2 crashes 1 undesirable 1 QCoreApplication::translate() 1 Variable 1 QObject::staticMetaObject 1 stores 1 associated 1 metaObject(). 1 Synonym 1 qFindChildren(). 1 obj->findChildren<T>(regExp). 1 workaround 1 MSVC 1 functions. 1 advised 1 code. 1 QObject::findChildren(). 1 subclass); 1 (directly 1 indirectly) 1 macro. 4 qobject_cast<QTimer 1 *>(obj); 2 (QObject 1 *)obj 1 QAbstractButton 1 qobject_cast<QAbstractButton 1 qobject_cast() 2 behaves 1 similarly 1 dynamic_cast(), 1 doesn't 4 require 1 RTTI 1 across 1 boundaries. 1 conjunction 1 interfaces; 1 Plug 2 Paint 2 macro, 3 function's 1 QObject::inherits(). 1 associates 1 extra 2 QObject::metaObject(). 1 feature, 1 Active 1 Qt, 1 D-Bus 2 QML. 2 Name 1 literal 1 Q_CLASSINFO("Author", 1 "Pierre 1 Gendron") 1 Q_CLASSINFO("URL", 1 "http://www.my-organization.qc.ca") 1 QMetaObject::classInfo(), 1 Adaptors, 1 Extending 1 Disables 1 constructors 1 Class. 1 Instances 1 thought 1 values 3 copied 1 assigned, 1 unique 1 identities. 1 means 1 (director 1 indirect), 1 give 1 enough 1 simply 1 omit 1 mistakenly 1 requires 2 (it's 1 easy 1 do), 1 thoughtfully 1 you. 1 curious 1 seen 1 include 1 section: 1 Q_DISABLE_COPY(MyClass) 1 declares 2 section, 1 mistake, 1 report 1 error. 1 MyClass(const 1 &); 2 &operator=(const 1 absolutely 1 case. 1 this: 1 w 1 QWidget(); 1 First 1 all, 1 that. 1 compilers 1 generate 3 privacy 1 violation 1 reported, 2 statement 1 way. 1 we 1 crash 1 w. 1 replace 5 keyword 5 3rd 5 party 5 mechanism. 5 normally 5 no_keywords 10 CONFIG 5 .pro 5 file, 5 specified. 5 registers 2 enum 6 declaration 2 MyClass(QObject 1 Priority 2 High, 1 Low, 1 VeryHigh, 1 VeryLow 1 Q_ENUM(Priority) 1 setPriority(Priority 1 priority); 1 priority() 1 const; 1 Enumerations 1 Q_ENUM 1 QMetaEnum 1 enclosing 1 QMetaObject. 2 QMetaEnum::fromType() 1 QMetaEnum. 1 Registered 1 enumerations 1 meta 2 QMetaType 1 features; 1 QVariant, 2 convert 1 strings. 1 Likewise, 1 QDebug 1 print 1 names. 1 5.5. 2 flags 3 combined 1 bitwise 1 OR 1 declaration. 1 LoadHints 1 flag 2 way: 1 QLibrary 2 LoadHint 1 ResolveAllSymbolsHint 1 0x01, 1 ExportExternalSymbolsHint 1 0x02, 1 LoadArchiveMemberHint 1 0x04 1 Q_DECLARE_FLAGS(LoadHints, 1 LoadHint) 1 Q_FLAG(LoadHints) 1 itself, 1 Q_DECLARE_FLAGS() 1 Q_FLAG 1 registering 1 unnecessary 1 Q_ENUM() 1 addition 1 lighter 1 reflection 1 capabilities 1 offered 1 Just 1 appear 2 definition. 1 Q_GADGETs 1 Q_ENUM, 1 Q_INVOKABLE, 2 member, 1 staticMetaObject, 1 enums 2 Q_ENUMS. 1 tells 1 interfaces 1 implements. 1 implementing 1 plugins. 1 BasicToolsPlugin 1 BrushInterface, 1 ShapeInterface, 1 FilterInterface 1 Q_PLUGIN_METADATA(IID 1 "org.qt-project.Qt.Examples.PlugAndPaint.BrushInterface" 1 FILE 1 "basictools.json") 1 Q_INTERFACES(BrushInterface 1 ShapeInterface 1 FilterInterface) 1 Basic 1 Q_DECLARE_INTERFACE(), 1 Q_PLUGIN_METADATA(), 1 How 1 Create 1 Plugins. 1 Apply 2 declarations 2 invoked 3 shown 2 Window(); 2 normalMethod(); 2 invokableMethod(); 1 invokableMethod() 1 marked 1 up 1 causing 1 enabling 1 QMetaObject::invokeMethod(). 2 normalMethod() 1 way, 1 services 1 Counter 1 Counter() 1 m_value 1 0; 2 value() 1 m_value; 2 slots: 2 setValue(int 1 value); 1 valueChanged(int 1 newValue); 1 system's 1 Meta-Object 2 System, 1 Slots, 1 declaring 1 behave 1 accessible 1 Q_PROPERTY(type 1 (READ 1 getFunction 2 [WRITE 1 setFunction] 1 MEMBER 1 memberName 1 [(READ 1 WRITE 3 setFunction)]) 1 [RESET 1 resetFunction] 1 [NOTIFY 1 notifySignal] 1 [REVISION 1 int] 1 [DESIGNABLE 1 bool] 4 [SCRIPTABLE 1 [STORED 1 [USER 1 [CONSTANT] 1 [FINAL]) 1 READ 4 required. 1 items 1 optional, 1 common. 1 attributes 1 USER, 1 Q_PROPERTY(QString 1 title 2 setTitle 1 USER 1 true) 1 details 1 use, 1 tag 3 revision 2 Q_PROPERTY(int 2 normalProperty 1 normalProperty) 1 newProperty 3 REVISION 1 1) 1 normalProperty(); 1 newProperty(); 1 Q_REVISION(1) 1 newMethod(); 1 expose 1 API, 1 match 1 expected 2 versions 1 Consider 1 expectedRevision 1 *windowMetaObject 1 window.metaObject(); 1 (int 2 i=0; 2 i 2 windowMetaObject->methodCount(); 1 i++) 2 (windowMetaObject->method(i).revision() 1 <= 2 expectedRevision) 2 exposeMethod(windowMetaObject->method(i)); 1 windowMetaObject->propertyCount(); 1 (windowMetaObject->property(i).revision() 1 exposeProperty(windowMetaObject->property(i)); 1 newMethod 1 exposed 1 1 1 greater. 1 methods 1 untagged, 1 Q_REVISION(0) 1 ignored. 1 Currently 1 QtQml 1 generic 1 tag, 1 QMetaMethod::tag() 1 QMetaMethod::revision(). 1 assigns 1 "Object". 1 matter 1 figures 1 QObject::objectName(). 1 mark 2 useful, 2 3rd-party 2 understand 2 groups. 2 declarations, 4