summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobjectdefs.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove obsolete QMetaObject::activate() overloads.Bradley T. Hughes2011-11-291-3/+1
| | | | | | | | | | | | | | | The overloads taking a range were previously used for cloned signals (ones that had default arguments). Commit 919b723088b8617b202b92d80b8d0983e4fd9500 changed how cloned signals are handled, making the from,to overloads obsolete. The 3 argument activate() overload that does not take a QMetaObject argument was marked obsolete by the same commit, but considering that it is used by our autotests, I've decided to keep it and not mark it as obsolete anymore. Change-Id: I631ce84dce156dec68cf26e10787cb35e3f50e18 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* New QObject connection syntaxOlivier Goffart2011-11-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In addition to the old connection syntax, you can now connect using function pointers. connect(sender, &Sender::valueChanged, receiver, &Receiver::updateValue ); You can connect also to functor or C++11 lambdas The connections are now type safe (no more problems with namespaces or typedefs). Implicit type conversion is also supported. The new syntax forces us to change the meaning of signal form protected to public, in order to be able to access the signal's address everywhere The way it works is by introducing new overload of QObject::connect that take function pointer as parametter. Those new overload are template function, that are implemented inline. The actual implementation is in QObject::connectImpl which take a QObject::QSlotObject* as parametter for the slot. That slot object contains a virtual function which call the slot which has to be implemented in the header as it depends on the template parametter. So the internals of QObjectPrivate::Connection will store this QObjectSlot* in order to be able to make the call. You can read a full description here: http://developer.qt.nokia.com/wiki/New_Signal_Slot_Syntax History of commits before it was imported on gerrit: https://qt.gitorious.org/~ogoffart/qt/ogoffarts-qtbase/commits/qobject_connect_ptr Thread on the mailing list: http://lists.qt.nokia.com/pipermail/qt5-feedback/2011-August/000796.html http://lists.qt.nokia.com/pipermail/qt5-feedback/2011-September/001248.html (The discussions on the mailing list were about trying to find a solution that do not need making signals public, but no user friendly solution was found) Note: support for QueuedConnection, and the symetric QObject::disconnect is added in another commit. Qt::UniqueConnection is not supported yet in the new overload. Change-Id: I67d08436b0720e7f2992be9f7e34770960fa58fa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change the return value of QObject::connectOlivier Goffart2011-11-251-1/+26
| | | | | | | | | | | | | | | | | | | | | | | | From a bool to a handle to to connection. Also added a new overload of disconnect that disconnect a handle This is required because with the new syntax taking lambda or functors, it is the only way to disconnect a connection (as it is impossible to compare functors) The new return value is QMetaObject::Connection, it is a wrapper around the internal QObjectPrivate::Connection. QObjectPrivate::Connection is now reference counted. tst_qglobal.cpp: This test set up an internal callback, and the callback do not set any proper connection handle (and tbh, it would be hard for it to do so). So the returned QMetaObject::Connection is invalid, and ok is false (Internal callbacks are only used for jambi and should probably be removed) Change-Id: I111626fb4f47efc4db5e2ea5bff9da15f08fea7b Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add spaces for string concatenation to work around C++11 source incompatibility.hjk2011-11-211-1/+1
| | | | | | Change-Id: I6acb7dca20d3bfcb24ea798c7ecd1a12464af5a6 Reviewed-by: QTBUG-22847 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* moc: support mapping pointers to member functions to indexesOlivier Goffart2011-11-141-1/+2
| | | | | | | | | | | | | This change adds QMetaObject::IndexOfMethod as a parameter to the qt_static_metacall function. It lets the moc generated code return the index of a signal or slot given its pointer to member function This is required to support the new connection syntax Change-Id: I39198c6699b5aa3599d3d282f7ac79b1e3684d33 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix warning when building objects with a Q_OBJECT macroTobias Hunger2011-09-151-1/+1
| | | | | | | | | | | | Do not trigger a self-assign warning when running into code containing a Q_OBJECT macro. Currently this happens a lot e.g. when using clang to build code using Qt. Change-Id: I68995624b18406f337318599e463f36f87486e66 Reviewed-on: http://codereview.qt-project.org/4960 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: hjk <qthjk@ovi.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Remove the remaining QT3_SUPPORT code in corelibLars Knoll2011-06-291-21/+0
| | | | | | | Change-Id: I6641c62d75d2034a46ea7cc869ae65285ae8b8f4 Reviewed-on: http://codereview.qt.nokia.com/866 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Liang Qi <liang.qi@nokia.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+506
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12