summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject.h
Commit message (Collapse)AuthorAgeFilesLines
* Un-export QSignalBlocker: it's all inlineThiago Macieira2014-04-251-1/+1
| | | | | | Change-Id: I0fb5a30eebd9edba853b7e4bd74cc7e9b06da486 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-02-071-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qguiapplication.cpp src/plugins/platforms/android/androidjnimain.cpp src/plugins/platforms/android/qandroidplatformintegration.cpp src/plugins/platforms/android/qandroidplatformintegration.h src/plugins/platforms/android/qandroidplatformopenglcontext.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/sql/doc/src/sql-driver.qdoc src/widgets/widgets/qtoolbararealayout.cpp Change-Id: Ifd7e58760c3cb6bd8a7d1dd32ef83b7ec190d41e
| * Add the default argument for the new connection syntaxThiago Macieira2014-02-011-2/+2
| | | | | | | | | | | | | | Task-number: QTBUG-36549 Change-Id: I3addacf4b0698df91960f7b8e9c2ed93e935f848 Reviewed-by: Branislav Katreniak <katreniak@gmail.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Move-enable QSignalBlockerMarc Mutz2013-12-111-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | When QSignalBlocker was reviewed, move semantics were asked for. This patch add them. This makes QSignalBlocker usable as a by-value argument (to transfer control of signal blocking into a function) as well as as a return value (to transfer control of signal blocking out of a function). Change-Id: I714aa2a283bb33dba76e860649e88ed202e913c5 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | QSignalBlocker: (new) RAII class for QObject::blockSignals()Marc Mutz2013-10-301-0/+46
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | I don't think I ever worked on a project of non-trivial size that didn't at some point add a QSignalBlocker. This commit adds code, tests and documentation. Later commits will convert naked blockSignals() calls to use QSignalBlocker. The implementation is purely inline to avoid the heavy overhead of cross-dll function calls for this miniscule task. This should not be a problem because QSignalBlocker only uses public API and a pattern that we anyway need to keep working until Qt 6, at least, so even changing the implementation later will be no problem as the old implementation lurking in non-recompiled code will be acceptable, too. This implementation is an evolution from KDTools' KDSignalBlocker, with the following changes: - Implements unblock() and reblock() - Uses the return value of blockSignals() instead of a separate signalsBlocked() call. Change-Id: I1933dfd72a0f5190324be377cfca3c54cf3d6828 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QObject: allow connecting to functors with a receiver objectDario Freddi2013-09-161-6/+35
| | | | | | | | | | | | | | | | | | | | | | | Up to now, it was only possible to connect to functors in a direct way, without being capable of using Qt::ConnectionType. This patch allows for specifying a receiver for Functors and function pointers, hence making it possible to specify effectively the connection type. To do this properly, it was needed to add an enum in FunctionPointer representing whether the considered function is a member function or not, to reduce ambiguity upon overloaded calls. Moreover, now senders are checked for the existence of a slot obj as well. This way, should the context be freed, the slot obj and the functor contained in it will be freed as well. On a side note, connecting to a static slot (like QCoreApplication::quit) specifying the receiver object is now compiling. Change-Id: I46474099413b1dc6ca4db9934191d469baeef070 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Fix spelling in Q_STATIC_ASSERT in qobject_castOlivier Goffart2013-09-161-2/+2
| | | | | Change-Id: Ibc2b1296bf7eb20e41c1af044797a9a026bed369 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Use Q_STATIC_ASSERT to report error about missing Q_OBJECTOlivier Goffart2013-09-141-8/+18
| | | | | | | | | | Q_STATIC_ASSERT gives better error with C++11 enabled. Aslo the qt_check_for_QOBJECT_macro had warning on some compiler since it used null reference Change-Id: Ic6115da800064b00c50a5762f0b79f5f656bf750 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Support connection to functor with multiple operator()Olivier Goffart2013-03-191-5/+29
| | | | | | | | | | | | | When variadic templates and decltype are supported, detect the best overload of operator() to call. Currently, the code takes the type of the operator(), which requires that the functor only has one, and that it has no template parameter. This feature is required if we want to connect to c++1y generic lambda (N3418) Change-Id: Ifa957da6955ea39ab804b58f320da9f98ff47d63 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵Frederik Gladhorn2013-01-291-18/+6
|\ | | | | | | refs/staging/dev
| * Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-281-18/+6
| |\ | | | | | | | | | Change-Id: I12b4d8b99bdccae53b1a978cd6eb8f4ac6fb3c76
| | * Don't use the union trick to do unlawful castsThiago Macieira2013-01-281-18/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC 4.7 is printing this (bogus) warning: qobject.h:166:15: warning: 'QObject::findChildren(const QString&, Qt::FindChildOptions) const [with T = QMenuBar*; Qt::FindChildOptions = QFlags<Qt::FindChildOption>]::<anonymous union>' declared with greater visibility than the type of its field 'QObject::findChildren(const QString&, Qt::FindChildOptions) const [with T = QMenuBar*; Qt::FindChildOptions = QFlags<Qt::FindChildOption>]::<anonymous union>::typedList' [-Wattributes] Change-Id: I2d1c365e3191f3a5c7b2241deb35f0ae47d79afc Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-4/+0
|/ / | | | | | | | | | | | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-221-1/+1
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsavefile_p.h src/corelib/tools/qregularexpression.cpp src/gui/util/qvalidator.cpp src/gui/util/qvalidator.h Change-Id: I58fdf0358bd86e2fad5d9ad0556f3d3f1f535825
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Merge branch 'stable' into devSergio Ahumada2013-01-091-3/+3
|\| | | | | | | Change-Id: I7f0dab6bdb1f3cc1d3e6c30166ff6db9dfae37e9
| * Replace macro qdoc with Q_QDOCDebao Zhang2013-01-081-3/+3
| | | | | | | | | | | | | | | | Both qdoc and Q_QDOC are used in source code, which looks not good. Change-Id: I4f3a71670278b0758d92bfa5db086a07e1b1acfd Reviewed-by: hjk <qthjk@ovi.com> Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* | Rename QRegularExpression-related feature defs to QT_NO_REGULAREXPRESSIONGiuseppe D'Angelo2013-01-071-2/+2
|/ | | | | | | | | | | | QRegExp and QRegularExpression are totally independent, therefore using two different defines is the right thing to do. Also, document the new define in qfeatures.{txt,h}. Change-Id: Ice4826ea543f4b22f1cc27bf31ed6e043d0c43b0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Allow connect to functors with less parameters than the signalOlivier Goffart2012-11-061-1/+19
| | | | | | | | | | | | | | | | | | | | Before, the functor slot (or lambda expression) had to have the same amount of arguments as the signal. This shown to be a big problem to be able to connect to signals that had a QPrivateSlot. This implementation use the type of the operator() of the functor to know how many arguments we have. As a bonus, we also can check the arguments in a static assert. The test comes from https://codereview.qt-project.org/#change,38703 But this patch also works without variadic template If the compiler does not support decltype, we workaround the lack of it by using another level of indirection. Change-Id: I9850b43e8caf77356a2ec3f4c0b0ed532d96029e Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Core/kernel: Make some signals private.Stephen Kelly2012-10-251-1/+5
| | | | | | | | | | | | | | | | | | | | | | There are more opportunities in QtCore and the rest of Qt to make signals private instead of public. This is a test-dart to see if there is any reason not to do this. It would be nice to make QObject::destroyed private, but as it has a default argument it would be source incompatible to anyone connecting to the SIGNAL(destroyed()) instead of SIGNAL(destroyed(QObject*)). Currently the function-pointer-based connect syntax does not accept a functor (or lambda) with a different number of arguments than the signal. Olivier says a fix for that might come in 5.1, but for now the qfiledialog2 test is changed to not use that anymore. Also, the function pointer for a private signal can not be assigned to a local variable, so the qmetamethod test is changed to not do so anymore. Change-Id: Iaf776b822f9ba364f2c184df0c6b23811da56e44 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* QSlotObjectBase: combat virtual function "bloat"Marc Mutz2012-08-151-51/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In C++, the compiler creates extra functions and data for classes with virtual functions. This can lead to "virtual function bloat": http://www.boost.org/doc/libs/1_47_0/doc/html/function/misc.html#id1382504 This is especially true when the number of instances is of the same order of magnitute as the number of derived classes, such as is common with type erasure techniques. One such case is the QSlotObjectBase hierarchy, which this patch tackles. The mechanics of this optimisation are simple: re-implement the virtual function call mechanism by hand, with function pointers. But we go one step further and collapse the vtable into a single pointer to a function that implements all three currently-defined operations, swtching on an 'int which' argument. This even allows us to extend this in a BC way, should that become necessary later, by adding a new Operation and using the void** argument to transport arguments, if any. This approach was inspired by: Ulrich Drepper: How To Write Shared Libraries, Section 2.4.4 http://www.akkadia.org/drepper/dsohowto.pdf Also move the QSlotObjectBase hierarchy out of QObject so as not to export all the derived classes. This was pointed out in review by Thiago. Results (Linux amd64, GCC 4.8-pre -O2 -std=c++11, stripped): size tst_qobject* text data bss dec hex filename 523275 21192 48 544515 84f03 tst_qobject (old) 507343 13984 48 521375 7f49f tst_qobject (new) relinfo.pl tst_qobject* (old) tst_qobject: 473 relocations, 0 relative (0%), 240 PLT entries, 240 for local syms (100%), 0 users (new) tst_qobject: 323 relocations, 0 relative (0%), 238 PLT entries, 238 for local syms (100%), 0 users Change-Id: I40ad4744dde8c5c29ef62ed2d82d4b1ede178510 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QObject: add a macro for conveniently setting the object nameMarc Mutz2012-07-251-0/+6
| | | | | | | | | | | | | | | | | | This is a simplified port of KDTools' KDAB_SET_OBJECT_NAME. It simply assigns the variable name as the objectName of a QObject, uic-style. It uses a small helper function so that it works on references as well as pointer variables. QLabel label; QLabel *pLabel = new QLabel(); Q_SET_OBJECT_NAME(label); Q_SET_OBJECT_NAME(pLabel); Change-Id: I25fec0c90f33249a3ea5d2dd622ab708019fd101 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fix MSVC warnings about struct/class mismatch for dynamic metaobjects.Friedemann Kleint2012-05-211-1/+1
| | | | | Change-Id: I263f25161fa1861ca5e7da9440214fd3ba6e944e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Make QCoreApp::translate and related methods use UTF-8Lars Knoll2012-05-181-3/+3
| | | | | | | | | Deprecate the Encoding enum in QCoreApplication and the trUtf8() methods. Qt now assumes that source code is always encoded in UTF-8 to be consistent with QString. Change-Id: Ic62d6947046dee9be0cbd37f2d2f6976b9e572a7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Encapsulate the dynamic meta object pointerAaron Kennedy2012-05-181-6/+4
| | | | | | | | | This change allows us to delay creating the actual meta object until it is actually required. Change-Id: I1c4a4226bd82fa606b206dd60322f49b49c32463 Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove const char *-based connectNotify() APIKent Hansen2012-05-151-3/+0
| | | | | | | | | | | | | | | | This completes the transition from connectNotify(const char *) and disconnectNotify(const char *) to the new QMetaMethod-based functions. Removed the old connectNotify autotests and renamed the connectNotifyMethodXXX autotests to connectNotify, since there is no longer any ambiguity about which overload is being tested. Change-Id: Icf108a80177155f21bb73c165fb8ab5d4e997bc2 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Introduce QObject::isSignalConnected(QMetaMethod)Olivier Goffart2012-05-021-0/+1
| | | | | | | | | This is much more performant than calling QObject::receivers(const char*) Can be used instead of connectNotify in some cases. Change-Id: I19e0933f678f171f515d9a0f69f0ad4fb7d894b4 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Add QMetaMethod-based QObject::connect/disconnectNotify() APIKent Hansen2012-05-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This API will fully replace the const char *-based connectNotify() and disconnectNotify() in Qt5; the old functions will be REMOVED before Qt 5.0 final. The new implementation fixes the long-standing issue of connectNotify() not being called when using the (internal) index-based QMetaObject::connect() (e.g., from QML). As with the old API, there are still two "unintuitive" behaviors concerning disconnectNotify(): - disconnectNotify() is not called when the signal is disconnected using the QObject::disconnect(QMetaObject::Connection) overload. - disconnectNotify() is not called when a receiver is destroyed (i.e., when a connection is implicitly removed). The old versions of connectNotify() and disconnectNotify() are kept for now, and they are still called. They will be removed once known existing reimplementations (e.g., QtNetwork, QtDBus) have been ported to the new API. Change-Id: I8b4f007f3c6d89199c1ba04a3e23c8ca314e0896 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Merge remote-tracking branch 'origin/master' into api_changesLars Knoll2012-04-161-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/corelib/io/qurl.cpp src/gui/kernel/qwindow.cpp src/tools/moc/generator.cpp src/widgets/kernel/qwidget_qpa.cpp src/widgets/styles/qstyle.h src/widgets/widgets/qtabbar.cpp tests/auto/corelib/codecs/utf8/tst_utf8.cpp Change-Id: Ia457228d6f684ec8184e13e8fcc9d25857b1751e
| * doc: Fix QObject::connect documentationOlivier Goffart2012-04-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, qdoc is too simple to understand any pointer to member function syntax. (the ::* token is not even tokenized. And even if it was, it would be a difficult way to hack that into the parser. (there is already an ugly workaround for non-member pointer to function hat works by having '(*' as a token,but the same hack is not possible for pointer to member function)) So I just put verbatim 'PointerToMemberFunction' Also remove the obsolete mention that Qt::UniqueConnection is not supported in that overload. It is now. (And it even contradicts the previous paragraph) Change-Id: I8fc9544808c9a462b0f11ccea406e2e33dee15b1 Reviewed-by: Geir Vattekar <geir.vattekar@nokia.com> Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* | Mark QObject::disconnect overload constOlivier Goffart2012-04-111-2/+2
| | | | | | | | | | | | | | | | | | Consistency with the non-static connect overload Task-number: QTBUG-23622 Task-number: QTBUG-1772 Change-Id: Ic09df9cca1feaabb6b5cf335f04a0d6d4bbf011f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QRegularExpression: add QObject::findChildren overloadGiuseppe D'Angelo2012-03-211-3/+25
|/ | | | | | | | | | | This actually involved tiding up QObject sources a little bit to clearly separate QString / QRegExp overloads of findChildren. The corresponding qFindChildren overload for MSVC 6 compatibiltiy was *not* added. Change-Id: I84826b3df9275a9bda03608a5b66756890eda6f8 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fix documentation of the new connect functions.Olivier Goffart2012-03-041-0/+9
| | | | | | | | Make sure that qdoc can find the same function signature in the header than in the \fn tags in qobject.cpp Change-Id: Iccf2ba4e8f6384e9c3bfc878a446120f03e8a813 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Remove many deprecated methodsLars Knoll2012-01-311-1/+1
| | | | | | | | | | Remove methods that have been marked as deprecated before Qt 4.6. Keep others, but inline them where possible and mark them as QT_DEPRECATED_SINCE(5, 0). Change-Id: If881821ae095f054b31cc13464f19e2007c20ed7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove use of QT_MODULE from libraryGunnar Sletta2012-01-251-1/+0
| | | | | | | | | | These defines were there to aid in the commercial licensing scheme we used long ago, and are no longer needed. Keep a QT_MODULE(x) define so other modules continue compiling. Change-Id: I8fd76cd5270df8f14aee746b6cf32ebf7c23fec7 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Don't release timer ids in event dispatcher codeBradley T. Hughes2012-01-041-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3rdparty event dispatchers are impossible to write without using the internal API QAbstractEventDispatcherPrivate::releaseTimerId(). Fix this by having each QObject keep track of its own timer ids, and release them when they are no longer used. As a side effect, this makes the QObjectData::pendTimer bit unnecessary. This also removes the QObjectData::inThreadChangeEvent hack that the event dispatchers used to avoid releasing timer ids when moving timers to a new thread. QBasicTimer becomes even more low-level. It cannot use QObject::startTimer() anymore, since we do not have a way to call QObject::killTimer() from QBasicTimer::stop(). QBasicTimer uses the QAbstractEventDispatcher interface directly, and releases the timer id explicitly as well when stopping the timer. This change also fixes some rare timer id "leaks" when destroying or stopping timers after a thread has exited and destroyed its event dispatcher (the timer ids would never be released when no dispatcher exists). Globally destructed QObjects that have running timers may try to release their timer ids after the timer id freelist has been destroyed. This commit accomodates such objects by avoiding the null dereference in QAbstractEventDispatcherPrivate::releaseTimerId(). Change-Id: I2d7cd8221fae441f3cf02b6c0b4bc16063834d00 Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Add Qt::TimerType and the QTimer::timerType propertyBradley T. Hughes2012-01-021-1/+1
| | | | | | | | | | | | | | | | | | | | The timer type will control the accuracy of the timer. By default, all timers are CoarseTimers, which allows for +/- 5% interval adjustment. PreciseTimers will not have any interval adjustments, VeryCoarseTimers will have intervals adjusted to full second resolution. Use QTimer::setTimerType() or the QTimer::singleShot() overload to specify the type. QObject::startTimer() now takes a Qt::TimerType argument which defaults to Qt::CoarseTimer. QBasicTimer::startTimer() gets an overload that takes a Qt::TimerType argument. The argument is unused for now, since the QAbstractEventDispatcher interface needs to change (done in a separate commit). Author: Thiago Macieira <thiago.macieira@nokia.com> Change-Id: I3100da5aa1fe17ec30b8644897d0fe6ec4a07f52 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix typos parametter -> parameter.Stephen Kelly2011-12-271-2/+2
| | | | | Change-Id: I0ebb3658477a1afdc1af5f4f6f64f12dc20ace56 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Revert "Revert "Add QObject::objectNameChanged(con... signal""Alan Alpert2011-12-201-1/+2
| | | | | | | | | This reverts commit 9b17557f3bbd5135651bcedf9f10e61d7e078ae2. Justification: Temporary commit, see JIRA task. Task-number: QTBUG-22985 Change-Id: I3df9eb5fdbdc133349dca5e192dcfcc9e758626c Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Better error reporting in case of connection failure.Olivier Goffart2011-12-201-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use Q_STATIC_ASSERT_X give a better error message. If C++11 is used, you get the string in the error. Else, clicking on the QStaticFailure error still shows you the string in the qobject.h source code) And report better failure if the return types do not match. (Without the static assert, you would still have a compilation error, but in an unrelated place, with no reference to the actual connect() call. The error was thrown from the virtual call QSlotObject::call, without saying where it was instantiated) Previously the error was relying on the existence of a type inside CheckCompatibleArguments, but the Q_STATIC_ASSERT requires a bool (hence the introduction of CheckCompatibleArguments::value) There also was a typo in the return value of AreArgumentsCompatible::dummy that made that code not work, and that error not be reported. (Instead, the error was reported when QObjectSlot::call is instantiated) Specialization of AreArgumentsCompatible for the void type have been added because if the return value of a signal or slot is void, the connection should work. Change-Id: I5a93ec787ce2a4b94a26630ca31d5001cd294e4d Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Remove unused ownObjectName field from QObjectDataBradley T. Hughes2011-12-151-2/+1
| | | | | | | | | | This field isn't used at all in qtbase, nor in any of the qt5 submodules. Change-Id: If57d389935593f797818506a220c6a3cc04b6078 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove QT_JAMBI_BUILD codeBradley T. Hughes2011-12-151-2/+1
| | | | | Change-Id: Ic9231b11293af4352f11cf075893175f0c9a471f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Correct sizeof(QObjectData) after out-of-order cherry-picks by GerritBradley T. Hughes2011-12-151-1/+1
| | | | | | | | | | Commits a6ae75f92a8628c727a9c5a9961fa91c583c008e and 6f0f9f69288925ef423c542ef5eb7302a5431867 were cherry-picked in the wrong order (despite the dependencies shown in Gerrit), causing the QObjectData::unused bitfield to be too large. Change-Id: I65acaa8b507f7f6f2c5735f45bd0ad8343abea54 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Remove QMetaObject guards and deprecate QPointer.Bradley T. Hughes2011-12-101-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QWeakPointer is superior and preferred. Remove QMetaObject::addGuard(), QMetaObject::changeGuard(), QMetaObject::removeGuard(), and QObjectPrivate::clearGuards(). Implement QPointer using QWeakPointer<T> instead. This changes the behavior of QPointer in 2 ways: - During destruction of a QWidget. Previously, the destructor of QWidget would reset all QPointers so that they would return zero when destroying children. Update tst_QPointer to account for this change. - When constructing a QSharedPointer to take ownership of an object after a QPointer is already tracking the object. Previously, the shared pointer construction would not be affected by the QPointer, but now that QPointer is implemented using QWeakPoiner, constructing the QSharedPointer will cause an abort(). Fix tst_QSharedPointer by removing the use of QPointer in the objectCast() test. These behavior changes are documented in the QPointer class documentation and in the changes file. Change-Id: I92d0276219c076ece7bcb60f6e1b9120ce4f5747 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Don't overload the meaning of QObjectData::wasDeletedBradley T. Hughes2011-12-101-0/+1
| | | | | | | | | | | | | | | | | | The union in QObjectPrivate of declarativeData and currentChildBeingDeleted shouldn't use wasDeleted to determining the meaning of the unioned pointer. Instead, add QObjectData::isDeletingChildren, set that in QObjectPrivate::deleteChildren(), and only use the currentChildBeingDeleted member when the parent's isDeletingChildren is set. This solves aborts seen in autotests when widgets are deleting window children. The abort comes from QWeakPointer on the parent in the child's close event handler (the abort checks that wasDeleted is not set). Change-Id: I1a58449159d4a5312aad8ba12e559d05d6c43d93 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Revert "Add QObject::objectNameChanged(const QString &objectName) signal"Martin Jones2011-12-021-2/+1
| | | | | | | | | | | This reverts commit ba635d7e74472f3a54c0c4686966af46d9035c6f. Breaks tests in declarative: tst_qdeclarativeecmascript::deleteLater tst_qquickvisualdatamodel::objectListModel Change-Id: I467b45109332e66fc62f3de00f376b1b88ab19ca Reviewed-by: Alan Alpert <alan.alpert@nokia.com>