summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobjectdefs.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-07-011-1/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qglobal.h src/corelib/global/qsysinfo.h src/corelib/global/qsystemdetection.h src/corelib/kernel/qobjectdefs.h src/plugins/plugins.pro tests/auto/widgets/itemviews/qlistview/qlistview.pro Change-Id: Ib55aa79d707c4c1453fb9d697f6cf92211ed665c
| * Make QMetaObject::Connection check its state deeplyThiago Macieira2015-06-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Connection can be copied, one copy could be used for disconnecting, but the other's d_ptr wouldn't get updated and would continue to report as still connected. This patch fixes that by making it check the internal state. That is only done after d_ptr is already known to be non-null. Unfortunately, that is the common path: if (connect(sender, &Sender::signal, [] {})) will call an out-of-line function. I don't see a way out. Task-number: QTBUG-46213 Change-Id: I66a35ce5f88941f29aa6ffff13dfb45dca68a350 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QtCore: Use Q_NULLPTR instead of 0 in all public headersMarc Mutz2015-07-011-10/+10
| | | | | | | | | | | | | | | | | | This is in preparation of adding -Wzero-as-null-pointer-constant (or similar) to the headers check. Task-number: QTBUG-45291 Change-Id: I0cc388ef9faf45cbcf425ad0dc77db3060c104a8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Allow types with a comma in Q_PROPERTYOlivier Goffart2015-06-121-0/+4
|/ | | | | | | | | | | | This allows for example properties with QMap<Foo, Bar> [ChangeLog][QtCore] Types in the Q_PROPERTY macro can now contain commas (for example, QMap<Foo, Bar>) Change-Id: Ibf5c8c9cf20a7c8b3dfec9e891fb8a9ca1bdba7c Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaType: Do not automatically register types that derives from a Q_GADGETOlivier Goffart2015-05-231-0/+1
| | | | | | | Otherwise the type is registered with the wrong name Change-Id: I68ec3a05e2528816626e648b46ccc9d70b004866 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Use Q_NULLPTR for the null pointers used in macrosThiago Macieira2015-03-301-2/+2
| | | | | | | | | User code should build with -Werror=zero-as-null-pointer-constant Task-number: QTBUG-45291 Change-Id: Iee8cbc07c4434ce9b560ffff13d0031979b4c2fe Reviewed-by: Matthew Woehlke <mw_triad@users.sourceforge.net> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Introduce Q_ENUM and Q_FLAG macrosOlivier Goffart2015-01-131-0/+6
| | | | | | | | | | | | | | In replacement for Q_ENUMS and Q_FLAGS. Q_ENUM(Foo) has to be put after the declaration of Foo in an object. It will tell moc to include the enum in the meta object (just like Q_ENUMS) and will allow templated code to get the metaobject for that enum. Will be used by QDebug and QMetaType Change-Id: Iefaf8ae07dc0359828102bf384809346629b3e23 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* Fix Clang warning about inconsistent use of C++11 overrideThiago Macieira2014-12-201-1/+10
| | | | | | | | | | | | | | | | | | | We cannot use override in the Q_OBJECT macro, so tell Clang not to warn about our lack of use of the keyword in the three virtuals that Q_OBJECT overrides when the user uses Q_DECL_OVERRIDE in their own functions. We can't use Q_DECL_OVERRIDE for two reasons: 1) because that would trigger the warning in any and all virtual overrides the user may have in their own class (and most of Qt) 2) because when Q_OBJECT is used in QObject, it's not overriding anything -- it's the base declaration For #2, we could add a different macro exclusively for QObject that moc would expand, but it's unnecessary work. Change-Id: Ic9cb7896f93f06f4e86b6a42dc08f96d257f7550 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Let QMetaType know which types are Q_GADGETOlivier Goffart2014-11-161-0/+1
| | | | | | | | | This is required so we can take a QVariant and detect that it contains a Q_GADGET and then use method like QMetaType::metaObject and QMetaProperty::write with the QVariant::data Change-Id: I3603692e4e84426e10bf59949e3def3ea4947bec Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* moc: Have a staticMetaCall in the Q_GADGET metaobjectOlivier Goffart2014-10-281-1/+2
| | | | | | | This provides a way to invoke Q_INVOKABLE method Change-Id: I301cec2a21c2889fb9dde0b1eb6e92d0bd561bd7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Warn the user when compiling Objective-C files (.m) that includes QtTor Arne Vestbø2014-01-301-0/+4
| | | | | | | | | | | | | | Xcode project templates will by default create source files that ends with .m (obj-c). If you try to include Qt from such files, you will get a bunch of compile errors, since the compiler will not understand C++ concepts, such as namespaces. To ease mixing native iOS and OS X apps with Qt, we print a warning to the console, so that the error messages are easier to understand and fix, by renaming the offending file to .mm. Change-Id: I192f460f9ca53145b7193dec1cfe7c095ae149a1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* moc: move qt_meta_extradata data from .data.rel into .data.rel.roMarc Mutz2013-12-091-1/+1
| | | | | | | | | | It's still a relocation, but at least it can be marked read-only after the relocation run, if indeed the dynamic linker goes to such a length. Change-Id: Ibadddac3ab99d2e58cc32cfd57311bddd3bdb0ef Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use Q_STATIC_ASSERT to report error about missing Q_OBJECTOlivier Goffart2013-09-141-0/+10
| | | | | | | | | | 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>
* Change template parameter name of qt_check_for_QOBJECT_macroOlivier Goffart2013-09-071-1/+1
| | | | | | | | | | | | 'T' is a fairly common name for template parameter. So if we use it in Q_OBJECT, it means you cannot use it as a template parameter name of the object itself (otherwise it does not compile as it shadow a template parameter) Use a more explicit name instead Change-Id: Id317c5b11d87f370eed6d1dc0b0142c9eb4994db Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add internal functions to QObjectPrivate for signal & slot connections in QMLSimon Hausmann2013-06-071-0/+1
| | | | | | | | | | | | | | | | | | In QML it is common to connect signals to slots that are implemented as JavaScript functions. QML used to maintain separate data structures that mirrored the QObject connection list and kept references to the JavaScript objects necessary to perform the call on signal activation. The recent addition of functor based QObject::connect makes it possible to store this information in QSlotObjectBase sub-class instead, which eliminates any extra bookkeeping. This patch adds internal connect and disconnect overloads to QObjectPrivate that allow for connecting QObject *sender, int signalIndex to a given QSlotObjectBase and similar for disconnect. Change-Id: I90f43d13eb95bd884d752484cf4faacc446f4d6a Reviewed-by: Olivier Goffart <ogoffart@woboq.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>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use QT_STRINGIFY in qobjectdefs.hOlivier Goffart2012-11-221-3/+1
| | | | | | | | | | | Since it is declared in qglobal.h, we do not need to re-implement the hack here. QTOSTRING was only defined if QT_NO_META_MACROS was defined, so practically not safe to use in other places. Change-Id: Ie5b07d0fa7537ba79380b882a4c822583ee5635e Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* Add automatic metatype registration for invokable methods.Stephen Kelly2012-08-281-1/+2
| | | | | | | | | | | This works similarly to the automatic registration for Q_PROPERTY types, but in this case it mostly affects the need for users to call qRegisterMetaType<T>() before using queued connections with methods using non-built-in metatypes, or before using invokeMethod manually. Change-Id: Ib17d0606b77b0130624b6a88b57c36d26e97d12d Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Add automatic metatype registration for Q_PROPERTY types.Stephen Kelly2012-08-281-1/+2
| | | | | | | | | | | | | | | | In Qt 4, the user needs to call qRegisterMetaType if the property could otherwise be read before the type is registered with the metatype system. This patch makes that unnecessary and automatic by registering it when the first read indicates that it is not yet registered instead or when QMetaProperty::userType is called before it is registered. The types which are automatically registered exclude the built-in types, which do not need to be registered, and include metatypes which are automatically declared, such as pointers to QObject derived types and containers of existing metatypes. Change-Id: I0a06d8efdcb64121618e2378366d0142fa0771f5 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Create a way to inform moc about private signals.Stephen Kelly2012-07-131-1/+2
| | | | | | | | | | | | | | | | | | Moc checks for the use of the QPrivateSignal struct, which is part of the Q_OBJECT macro and is private to each class that uses it. Moc then generates a name of the signal which does not include the private struct, and generates code to invoke such signals with an instance of the private struct. This way we can mark private signals as such and prevent them from being emitted from subclasses or from outside of the class entirely. The drawback to this is that it only works if the private signal has no default arguments. However, at least in Qt, there are no such signals. Change-Id: Id16eadaa8d3c36a2c3b265077877f3e1d8304c84 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Revert "Allow moc to handle symbols that have been redefined."Matthew Vogt2012-07-041-6/+6
| | | | | | | | | | | | This reverts commit 5bb1408927b4eb5a03e8ab9f7cbc68f80d8a3962. The temporary measure used to support redefinition of QtDeclarative class names during the transition period is no longer required. Task-number: QTBUG-24517 Change-Id: Ib90f08fcdfb02e004e594ac72b698eaa0325d98d Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Doc: tmake -> qmake, it's about timeDaniel Molkentin2012-06-211-8/+8
| | | | | | | | | Pushing this before 5.0 since it will most certainly trigger a major recompile, which is probably why this has never been changed. Change-Id: I5fd90537d3b754d0a8a1b522d66183513693e0af Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Change internal QDeclarativeData hooks to use signal index rangeKent Hansen2012-06-121-1/+1
| | | | | | | | | | | This also changes the qtdeclarative-specific QMetaObject::activate() overload to not take a methodOffset argument, since it's no longer needed. Change-Id: I4f7ece9f43339f3327419598c032e48fb37b97f0 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Make QCoreApp::translate and related methods use UTF-8Lars Knoll2012-05-181-9/+1
| | | | | | | | | 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>
* QMetaObject::activate() overload that doesn't require a metaobjectAaron Kennedy2012-05-181-0/+1
| | | | | | | | | This allows QML to emit signals without having to built lazily created metaobjects. Change-Id: If8068fb3cb35d79dc8f3ef79253d9c2eb7c93205 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Bump moc revision after introducing QMetaType::SChar.Jędrzej Nowacki2012-05-091-1/+1
| | | | | | | | | Normally we do not have to change moc version if a new type is added, but for this particular case we need to do it. It is so because the old moc could generate wrong type id (QMetaType::Char) for signed char. Change-Id: I20be2a24adc59a305674595dafe23fb1774b475d Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* QArrayData: Suppress MSVC warnning.Debao Zhang2012-05-071-1/+1
| | | | | Change-Id: I3b8090d9d3f1294d76ff1cc3503c73e90cd91b40 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Replace QByteArrayData class by typedef.Jędrzej Nowacki2012-05-041-1/+2
| | | | | | | | | | | | | QByteArrayData was binary compatible with QArrayData, but we do not need a separate class, QArrayData should be sufficient. Preferably we would use QTypedArrayData<char> but it is not POD, therefore it can not be initialized with {} syntax. Change-Id: I1edd7b4f236b06d8f2dbfd8a37a3f5699b6a2c07 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Remove QMetaObjectExtraData and put everything into QMetaObjectOlivier Goffart2012-04-251-14/+5
| | | | | | | | | | | | | | | | 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>
* Split qobject_impl.h into qobjectdefs_impl.hKent Hansen2012-04-251-0/+2
| | | | | | | | | | | | | | | | | | | This is done to make QtPrivate::FunctionPointer available to the QMetaMethod declaration in qmetaobject.h (which already included qobjectdefs.h, since that's where QMetaObject is declared), so that the new template-based QMetaMethod::fromSignal() function may be implemented. The logic for statically generating the array of qMetaTypeId (used by the template-based QObject::connect()) remains in qobject_impl.h, since it's not needed for QMetaMethod::fromSignal(). Moreover, moving that code would introduce a circular dependency, since qmetatype.h as of commit 194674044693d6b101c3dc2f4784718540d343a4 now includes qobjectdefs.h. Change-Id: I36c35041e0c6661c3cf523684177a0b6c19e2d35 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Merge remote-tracking branch 'origin/master' into api_changesLars Knoll2012-04-161-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/master' into api_changesOswald Buddenhagen2012-04-101-1/+8
|\| | | | | | | | | | | | | | | | | | | Conflicts: configure src/widgets/styles/qwindowsxpstyle.cpp tests/auto/gui/kernel/qwindow/qwindow.pro tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I624b6d26abce9874c610c04954c1c45bc074bef3
| * Fix warning introduced in Intel CC 12.1Thiago Macieira2012-03-281-1/+8
| | | | | | | | | | | | Change-Id: Ie50b0bf0741637a3acfc39360804590f3c133332 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/api_changes' into containtersJoão Abecasis2012-03-081-8/+10
|\| | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qmetaobject.cpp src/corelib/kernel/qvariant.cpp src/tools/moc/moc.h Change-Id: I2cd3d95b41d2636738c6b98064864941e3b0b4e6
| * Merge remote-tracking branch 'origin/api_changes'Lars Knoll2012-03-041-6/+6
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: dist/changes-5.0.0 mkspecs/features/qt_module_config.prf qmake/project.cpp qmake/property.cpp Change-Id: I6e4af40743a9aeff8ed18533a48036e332acc296
| | * Merge master -> api_changesRohan McGovern2012-02-291-1/+1
| | |\ | | | | | | | | | | | | | | | | | | | | Includes fixes for tst_qfiledialog2, tst_qtextedit autotests on mac. Change-Id: I49cac26894d31291a8339ccc1eb80b6a940f0827
| | * | Allow moc to handle symbols that have been redefined.Matthew Vogt2012-02-271-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow moc to produce the desired identifiers when used with C++ symbol names that have been redefined, for example by -Dfoo=bar. Two changes are required: firstly, when encoding a type name, the components of the name must be checked for substitutions that have been defined for that token (note that this is not done here by correct pre-processing, but only by processing the resultant table of definitions). Secondly, the arguments to the SIGNAL, SLOT and METHOD macros must be allowed to be substituted during macro expansion rather than stringized directly. This is a temporary change to prevent breaking existing projects that depend on the declarative module. After clients have had an opportunity to update their code to the use the new interfaces, it can be removed. Task-number: QTBUG-23737 Change-Id: I39e6844cebf6ca7984af6028160b8a3797ac44a5 Reviewed-by: Martin Jones <martin.jones@nokia.com>
| * | | Add support for QT_NO_SIGNALS_SLOTS_KEYWORDSStephen Kelly2012-02-291-2/+4
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QT_NO_KEYWORDS can be used for example to ensure that foreach can not be used, but Q_FOREACH must be, that slots must not be used but Q_SLOTS must be, etc. Typically they are used to avoid symbol conflict with other libraries that may use the same keywords (I think boost uses signals). For 3rd party libraries, it makes sense to use Q_SLOTS and Q_SIGNALS instead of slots and signals, so that downstreams can still choose to use QT_NO_KEYWORDS in their code. The most convenient way to enforce that currently is to define QT_NO_KEYWORDS when building the 3rd party library. However, that has the inconvenient side effect of making foreach, forever and emit not usable within the library implementation. This patch makes it possible for the 3rd party library to use QT_NO_SIGNALS_SLOTS_KEYWORDS to exclude signals and slots without affecting whether the other keywords can be used in the library implementation. Change-Id: If1e16a4fa384bd3a2ddd737143499f8b587bc4f8 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Richard J. Moore <rich@kde.org>
| * | Bump the moc output revisionKent Hansen2012-02-231-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Commit aee1f6cc413f56bf4962324799ee3887c3dd037f changed the values of some built-in meta-type ids. Since the ids of built-in types are directly encoded -- not as the symbolic QMetaType::Type name, but as a raw integer -- in the flags for meta-properties, the moc output prior to that change is incompatible with the current output. Change-Id: I970484825137a4f19c80726cfe2024e741e3e879 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Long live Qt5 meta-object method/property descriptorsKent Hansen2012-02-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Change the representation of meta-object string dataKent Hansen2012-02-291-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Bump the moc output revisionKent Hansen2012-02-241-1/+1
|/ | | | | | | | | | | | | | | | Commit aee1f6cc413f56bf4962324799ee3887c3dd037f changed the values of some built-in meta-type ids. Since the ids of built-in types are directly encoded -- not as the symbolic QMetaType::Type name, but as a raw integer -- in the flags for meta-properties, the moc output prior to that change is incompatible with the current output. Change-Id: I970484825137a4f19c80726cfe2024e741e3e879 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> (cherry picked from commit ca028e1fe07f2fb268d1da73eeaccb0f7f264a04) Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Implement new plugin mechanismLars Knoll2012-02-151-0/+1
| | | | | | | | | | | | | | moc can now embed meta information about the plugin inside the plugin itself. This information can be queried by Qt without having to load the plugin. Source compatibility with the old plugin loading mechanism is still there, but will be removed before Qt 5.0. Change-Id: I03e4196ddfed07d0fe94acca40d5de8a6ce7f920 Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* Do not suppress tr() methods when QT_NO_META_MACROS is defined.Erik Verbruggen2012-01-281-1/+1
| | | | | | | | | | | | The tr() methods are unrelated to the "meta" part, so disabling them with that macro is not the proper way. They were originally included to make static checks for string translation simpler, but it just results in duplicating the definition every time QT_NO_META_MACROS is used. Change-Id: I29eb9b83a09e1fd6c66c85c9e4ff23d8dbe65f15 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>