summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobjectdefs.h
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* 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>
* Conditionally define Qt C++ "extension" macros.Erik Verbruggen2012-01-171-0/+9
| | | | | | | | | | | This patch makes it possible to disable the definition of meta-object related macros like SIGNAL, Q_SIGNALS, etc. This changes makes it possible for tools to define the macros in a way that can be used with them. Change-Id: Ie8efb1983536f57755cbc59a8f71f1d04bf080be Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Remove the Q_NO_DATA_RELOCATION hackOlivier Goffart2012-01-131-12/+1
| | | | | | | | | | | | | | This hack was there because symbian used to have a problem with relocations in the data section, between libraries. Hence, this was needed so the metaobject could have a pointer to the base metaobject, despite being in another library. Anyway, I was told that symbian was fixed eventually. but the hack had to stay there because of compatibility. But now that we don't even support symbian, we can get rid of this hack totally. Change-Id: I7249971ece35d952efa92bf8b04bf3aa3667624c 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>
* Remove QMetaObject guards and deprecate QPointer.Bradley T. Hughes2011-12-101-5/+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>
* Merge QObject::tr*() and QCoreApplication::translate() overloadsBradley T. Hughes2011-11-301-16/+5
| | | | | | | | These were marked as TODO items for Qt 5. Do them now. (The TODO item was added when plural support was added back in the early Qt 4 days.) Change-Id: I3be50bc657582db730401103d691234695784340 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* 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>