summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtCore]Thiago Macieira2012-05-041-1/+1
| | | | | | | | | | | This operation should be a no-op anyway, since at this point in time, the fromAscii and toAscii functions simply call their fromLatin1 and toLatin1 counterparts. Task-number: QTBUG-21872 Change-Id: I38f97ad379deafebef02c75d611343ca15640c8a Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Introduce QObject::isSignalConnected(QMetaMethod)Olivier Goffart2012-05-021-3/+56
| | | | | | | | | 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-35/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Don't use the QRegExp methods that modify the object [QtCore]Thiago Macieira2012-04-271-1/+2
| | | | | | | | | | | | | | QRegExp matching methods modify the object, which we don't want to. In particular, when we receive a QRegExp from the user or we store in a context that might require thread-safety, make sure we make a copy before using it. QRegularExpression has no such shortcoming. Task-number: QTBUG-25064 Change-Id: Icf22986cd5f6fd086518c78a7d56e6cadfe9f5f6 Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove QMetaObjectExtraData and put everything into QMetaObjectOlivier Goffart2012-04-251-2/+1
| | | | | | | | | | | | | | | | QMetaObjectExtraData was added when support for QMetaObject::newInstance was added. One needed a place to put the pointer to static_metacall in the QMetaObject. But as we break binary compatibility, one can change the size of QMetaObject, and put everything back inside QMetaObject's own structure. Meaning it is not required anymore to have one QMetaObjectExtraData instance per QMetaObject anymore. Change-Id: If0b8f586cbaf633eed10045adee3ba3366826c86 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Fix warning in qobject.cppOlivier Goffart2012-04-231-0/+1
| | | | | | | Variable only used in debug mode Change-Id: I6601ca68c427b909680423ae81802f1ed5cd178a Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Don't assume QAbstractDeclarativeData::objectNameChanged is available.Michael Brasser2012-04-231-1/+1
| | | | | | | | Preparation for removal from declarative now that a proper NOTIFY signal exists. Change-Id: If0acb73b73d17c49dc8de211d95ecd1e8e80ff1b Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Minor QObject::receivers() optimization.Michael Brasser2012-04-201-0/+3
| | | | | | | | Don't lock if there are no receivers. Change-Id: I922fad10436adeb27aa4f193cc0dcbaa3f0c0f1e Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Minor QObject::receivers() cleanup.Michael Brasser2012-04-201-2/+1
| | | | | | | | Return 0 rather than false; remove extra Q_D(). Change-Id: I3dac733c3fae27c76790f09fd6b63356767a0363 Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Add a receivers callback to QAbstractDeclarativeData.Michael Brasser2012-04-201-0/+6
| | | | | Change-Id: I767fabd66c7de535db26e779855d21ec5b94e947 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Doc: Prepare for building modular QtCore docs.Casper van Donderen2012-04-191-60/+60
| | | | | | | | | | | | This change fixes most qdoc errors in QtCore. There are about 900 left. The main thing this change does is moving documentation from qtcore from /doc/src to /src/corelib/doc. Other issues resolved are mis-use of qdoc commands. Change-Id: I002d01edfb13575e8bf27ce91596a577a92562d1 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* Merge remote-tracking branch 'origin/master' into api_changesLars Knoll2012-04-161-11/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 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-11/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Remove AutoCompatConnectionDebao Zhang2012-03-281-27/+4
| | | | | | | | | | | | | | | | | | | | | | The default type when Qt 3 support is enabled. Same as AutoConnection but will also cause warnings to be output in certain situations. Change-Id: I64bf3c39a740afb716820bfd3173936fda213f4a Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | Merge master into api_changesKent Hansen2012-03-231-1/+8
|\| | | | | | | Change-Id: I93551e4d13a1b0815b359b9415060e9089477db1
| * Fix a memory leak in template QMetaObject::Connection.Jędrzej Nowacki2012-03-191-1/+8
| | | | | | | | | | | | | | | | | | QObject::QSlotObjectBase instance given as argument to QObject::connectImpl was not dereferenced in case of an unsuccessful connection. Change-Id: I206b14e986690c027aafc2593762d85dc619e0e6 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Remove support for meta-object revisions < 7Kent Hansen2012-03-221-136/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For Qt5 we no longer want to support the older revisions due to the dual codepaths that must be maintained, and because the format of the meta-object data is quite different in revision 7. The dual codepaths have been replaced by asserts that indicate the revision in which the feature was introduced, and the older-revision fallbacks have been removed. It's not possible to build code generated by moc that has revision <= 6 with Qt5 because the type of the QMetaObject::stringdata member changed from const char * to const QByteArrayData *. For the same reason it's not possible to build a dynamic meta-object generator targeting revision <= 6 with Qt5. Hence, too old meta-objects will be caught at compile time, and the code will have to be ported to generate revision 7 (e.g., by running Qt5's moc on the original class declaration). Change-Id: I33f05878a2d3ee3de53fc7009f7a367f55c25e36 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | QRegularExpression: add QObject::findChildren overloadGiuseppe D'Angelo2012-03-211-10/+66
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge master into api_changesKent Hansen2012-03-161-1/+1
|\| | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qmetatype.cpp src/gui/kernel/qplatformsurface_qpa.cpp tests/auto/corelib/tools/qtimeline/qtimeline.pro Change-Id: Iff3fff34eeeb06f02369767ddfce44cfde505178
| * Fix a memory leak in QMetaObject::connectSlotsByName function.Jędrzej Nowacki2012-03-141-1/+1
| | | | | | | | | | | | | | | | QObjectPrivate::Connection time life should be controlled by QMetaObject::Connection handle. Change-Id: Ie7fcd950082a3e6cebc29ecc0622007470914edb Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/api_changes' into containtersJoão Abecasis2012-03-081-20/+25
|\| | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qmetaobject.cpp src/corelib/kernel/qvariant.cpp src/tools/moc/moc.h Change-Id: I2cd3d95b41d2636738c6b98064864941e3b0b4e6
| * Remove codecForTr().Robin Burchell2012-03-061-6/+1
| | | | | | | | | | | | | | | | | | | | Similarly to change id I2f429fa7ef93bd75bb93a7f64c56db15b7283388, the capability to arbitrarily alter the encoding of literals is very destructive, especially in a world with libraries and plugins. Change-Id: If0d4cd8dcf89792e39c1984cbde6b036cebfc02f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * Merge remote-tracking branch 'origin/api_changes'Lars Knoll2012-03-041-0/+10
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: dist/changes-5.0.0 mkspecs/features/qt_module_config.prf qmake/project.cpp qmake/property.cpp Change-Id: I6e4af40743a9aeff8ed18533a48036e332acc296
| | * Make qobject_p.h not need qvariant.h.Stephen Kelly2012-02-291-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move definition of ExtraData to the implementation file. As a side effect, we need to include qhash.h in some other places. Change-Id: I8bb4ec0940ae51c7d6961c9a51adb80fd444e1e3 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
| * | Remove the usage of deprecated qdoc macros.Casper van Donderen2012-03-021-14/+14
| |/ | | | | | | | | | | | | | | | | | | | | QDoc now has support for Doxygen style commands for italics, bold and list items. This change applies that change in QDoc to the actual documentation. Task-number: QTBUG-24578 Change-Id: I519bf9c29b14092e3ab6067612f42bf749eeedf5 Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | Long live Qt5 meta-object method/property descriptorsKent Hansen2012-02-291-44/+171
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces two significant changes to the meta-object data format: 1) Meta-type information (QMetaType type/name) information is stored directly in the meta-data for both properties and methods; 2) The original signature (string) of a method is no longer stored in the meta-data, since it can be reconstructed from the method name and parameter type info. The motivation for this change is to enable direct access to method names and type information (avoiding string-based lookup for types if possible), since that's typically the information language bindings (e.g. QML) need. (moc already had all the desired information about methods, but it threw it away!) This change keeps support for the older (6 and below) meta-object revisions, but the support will be removed after a short grace period. The following public QMetaMethod functions have been added: name() : QByteArray returnType() : int parameterCount() : int parameterType(int index) : int The following internal QMetaMethod function has been added: getParameterTypes(int *types) : void This commit extends the meta-method data to include explicit type/name data for methods. The new data follows the existing (5-word) method descriptors in the meta-data. The method descriptor format was modified to enable this. First, the descriptor now contains the meta-data index where the method's type/name information can be found. Second, the descriptor contains the number of parameters. Third, the descriptor has a reference to the name of the method, not the full signature. Each entry of a method's type/name array contains either the type id (if it could be determined at meta-object definition time), or a reference to the name of the type (so that the type id can be resolved at runtime). Lastly, instead of storing the method parameter names as a comma-separated list that needs to be parsed at runtime (which was how it was done prior to this commit), the names are now stored as separate entries in the meta-object string table, and their indexes are stored immediately after the method type info array. Hence, parameter names can be queried through the public API without parsing/allocating/copying, too. Task-number: QTBUG-24154 Change-Id: Idb7ab81f12d4bfd658b74e18a0fce594f580cba3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | Rename QMetaMethod::signature() to methodSignature()Kent Hansen2012-02-291-25/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt5 the meta-data format will be changed to not store the method signature string explicitly; the signature will be reconstructed on demand from the method name and parameter type information. The QMetaMethod::signature() method returns a const char pointer. Changing the return type to QByteArray can lead to silent bugs due to the implicit conversion to char *. Even though it's a source- incompatible change, it's therefore better to introduce a new function, methodSignature(), and remove the old signature(). Task-number: QTBUG-24154 Change-Id: Ib3579dedd27a3c7c8914d5f1b231947be2cf4027 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* | Change the representation of meta-object string dataKent Hansen2012-02-291-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up to and including meta-object revision 6, string data have been stored as 0-terminated C-style strings, that were made directly accessible as const char pointers through the public API (QMetaMethod and friends). This commit changes moc to generate an array of QByteArrayData instead, and adapts the QObject kernel accordingly. Generating an array of QByteArrayData (byte array literals) means that the strings can now be returned from public (or private) API as QByteArrays, rather than const char *, with zero allocation or copying. Also, the string length is now computed at compile time (it's part of the QByteArrayData). This commit only changes the internal representation, and does not affect existing public API. The actual (C) string data that the byte array literals reference still consists of zero-terminated strings. The benefit of having the QByteArrayData array will only become apparent in the upcoming meta-object data format change, which changes the format of property and method descriptors. Support for the old meta-object string data format was kept; the codepaths for old revisions (6 and below) will be removed in a separate commit, once all the other meta-object changes are done and affected code has been adapted accordingly. Task-number: QTBUG-24154 Change-Id: I4ec3b363bbc31b8192e5d8915ef091c442c2efad Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Remove use of Q_BROKEN_DEBUG_STREAM.Stephen Kelly2012-02-221-6/+0
| | | | | | | | No supported compiler defines it, and it was not used consistently so it didn't work anyway. Change-Id: Icc9e911e22daaedaee3d9316c15d19be26cd2e72 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Various documentation fixes ported from 4.8Teemu Katajisto2012-02-091-1/+1
| | | | | | | | | | | | | | | | | | | Selected documentation fixes for qtbase from 4.8 commit 40fb4750910e23d3e7128ca8e0f1c5920b05bd5a Task-number: QTBUG-8625 Task-number: QTBUG-19808 Task-number: QTBUG-1231 Task-number: QTBUG-21073 Task-number: QTBUG-8939 Task-number: QTBUG-20399 Task-number: QTBUG-20944 Task-number: QTBUG-22095 Task-number: QTBUG-11278 Task-number: QTBUG-15653 Change-Id: Ia4f59fce7c85f04b6da953a3988f705d9d9a658a Reviewed-by: Casper van Donderen <casper.vandonderen@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>
* Call connectNotify when connecting with function pointerOlivier Goffart2012-01-291-1/+13
| | | | | | | | Some objects expect connectNotify to be called in order the signal to be emitted. Change-Id: Id0460d9c2aef8f9c3618a2b62b2119a790e06f30 Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* Remove all non-inline of qMalloc/qFree/qRealloc.Robin Burchell2012-01-061-4/+4
| | | | | | | | | | | | We're trying to deprecate these, so don't use them anymore. The inline uses of these have been left intact, for the moment. Inline code will need to create their own non-inline allocation methods (for future-proofing to allow alterations in how e.g. individual containers allocate) Change-Id: I1071a487c25e95b7bb81a3327b20c5481fb5ed22 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@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-12/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 argument to QAbstractEventDispatcher::registerTimer()Bradley T. Hughes2012-01-021-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | ... and deprecate the old registerTimer() functions. The new pure- virtual registerTimer() breaks source-compatibility. Subclasses cannot be instantiated anymore, since the pure virtual function signature has changed. QAbstractEventDispatcher::TimerInfo is no longer a QPair. It is now a struct with timerId, interval, and timerType members. This is a source incompatibility that should only affect subclasses of QAbstractEventDispatcher, which will need to pass 3 arguments to the TimerInfo constructor instead of 2. If the subclass used QPair<int,int> instead of the TimerInfo typedef, the QPair<int,int> declarations will need to be replaced with TimerInfo. Call the new registerTimer() function with the type from QObject::startTimer(). Change all subclasses of QAbstractEventDispatcher to reimplement the new virtual function. The type argument is unused at the momemnt, except to ensure that registeredTimers() returns the type each timer was registered with. Implementations for the various dispatchers will be done in separate commits. Author: Thiago Macieira <thiago.macieira@nokia.com> Change-Id: Ia22697e0ab0847810c5d162ef473e0e5a17a904b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add Qt::TimerType and the QTimer::timerType propertyBradley T. Hughes2012-01-021-5/+7
| | | | | | | | | | | | | | | | | | | | 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>
* Revert "Revert "Add QObject::objectNameChanged(con... signal""Alan Alpert2011-12-201-5/+12
| | | | | | | | | 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>
* Do not call QueuedConnection slot on partialy destroyed objectOlivier Goffart2011-12-191-1/+1
| | | | | | | | | | | | This is a regression introduced in Qt 4.8 When QApplication::processEvents is called from a destructor, it is possible that pending events would still be called on the already destroyed subclass. Prevent that by using the same pattern as in QMetaObject::activate Change-Id: Ida50db07ae089264402dafcde7a41a066479d08b Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Remove QT_JAMBI_BUILD codeBradley T. Hughes2011-12-151-51/+0
| | | | | Change-Id: Ic9231b11293af4352f11cf075893175f0c9a471f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix typos in QObject::(dis)connect warningsGiuseppe D'Angelo2011-12-151-11/+11
| | | | | | | | For some strange reason "Object::method ..." was printed, without the leading Q. Change-Id: I10b99e8aa8730e4020d15b3e04a01004bade76c3 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Remove QMetaObject guards and deprecate QPointer.Bradley T. Hughes2011-12-101-114/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-6/+7
| | | | | | | | | | | | | | | | | | 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>
* Remove QInternal callbacks and internal functionsBradley T. Hughes2011-12-021-39/+0
| | | | | | | | | | | | | | | | After commit 79f675a1e0f628bbc25345ebc1eb1f5809166c6b, the connect and disconnect callback API effectively becomes useless. Now that these callbacks cannot/do not, it makes little sense to keep the backdoors added for Qt Jambi support. Remove them for now. Should the Qt Jambi team want/need to port to Qt 5, we can re-add them, possibly designing a better API for doing so as well. Change-Id: I6209a1d647d683c979d5294b632b8c12c0f9f91c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Revert "Add QObject::objectNameChanged(const QString &objectName) signal"Martin Jones2011-12-021-12/+5
| | | | | | | | | | | 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>
* Add QObject::objectNameChanged(const QString &objectName) signalBradley T. Hughes2011-12-011-5/+12
| | | | | | | | | | | | | | | | | | | This is sent when the object's name changes. tst_moc must be updated since the method count of QObject has changed. The test assumed that there were 4 invokable methods in QObject. The new signal is the 5th, which breaks the test's assumptions. Fix this as well. tst_QObject must be updated since the QObjectPrivate::isSignalConnected() method only supports the first 64 signals. With the addition of this new signal, sig61() in the test becomes the 65th signal, and will always appear connected now. Task-number: QTBUG-13999 (related) Change-Id: Ie87893c71a231fafa7ccf2f16102238a7be8327a Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Support Qt::UniqueConnection in the new connection syntaxOlivier Goffart2011-11-291-5/+49
| | | | | | | | | | This commit also improves the related documentation a bit. The test is copied from the test with the old syntax, but all the connection statement are changed to use the new syntax Change-Id: Ia5630ca4335b9f8ca6d724ae3c8750d6f0804d8e Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Reduce code dupplication in QObject::connectOlivier Goffart2011-11-291-29/+22
| | | | | | | | | Move from each implementation of QObject::connect to QObjectPrivate::addConnection the code that adds the QObjectPrivate::Connection* to the sender's list. Change-Id: I665af016d5e6673eb0e9c06965e5deed50454b28 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>