summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qmetatype.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-24/+24
| | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Fix some doc errors.Frederik Gladhorn2013-09-211-4/+4
| | | | | | | Change-Id: Ib874d7e9671d9cee75fe41f4dac5d0de7b09245e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Add a convenient way to get a type-erased smart pointer from a QVariant.Stephen Kelly2013-09-111-0/+16
| | | | | | | | | | | | Any known smart pointer in a QVariant can be handled in this way. The metatype system can be informed of new smart pointer types using an existing macro which is now documented. This is very similar to the existing infrastructure for containers. Change-Id: Iac4f9fabbc5a0626c04e1185d51d720b8b54603d Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Metatype: Remove the need for runtime-registration of 3rd party containers.Stephen Kelly2013-09-091-31/+34
| | | | | | | | | Replace that need with a macro so that registration of the container helper conversions is done at the time of registration of the container (usually when it is put into a QVariant). Change-Id: I823fb3fdbce306ebc9f146675ac43724cec678d5 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QVariant: Don't crash when doing user-defined conversion to QObject*Stephen Kelly2013-09-051-0/+2
| | | | | | | | | The destructor of the ConverterFunctor calls unregisterConverter. If the instance is static (as it is in qmetatype.h), then this method can be called after the QGlobalStatic has already been destroyed. Change-Id: I33b70734cbe09dfa888e887280c349e43ad1b855 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Make the qfatal for redeclaring a type with the same name a warning.Richard J. Moore2013-06-251-5/+5
| | | | | | Change-Id: I5a25b2043a6b5a598a004d30c9a8056564c136e3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-06-121-0/+1
|\ | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qcocoamenubar.mm Change-Id: I4a699fc8a7f30b2af9de8e496c3d5f027b7495bb
| * Mark the Q_DECLARE_OPAQUE_POINTER macro as introduced in 5.0Laszlo Papp2013-06-121-0/+1
| | | | | | | | | | Change-Id: Ida52c9f1f72b628d9a7faaf7998798e781b53df2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Core: QDebug and comparison operator support metatypes.Christoph Schleifenbaum2013-05-271-16/+124
| | | | | | | | | | | | | | | | This patch adds a way to enable operator<, operator== and operator<< into QDebug for QVariants with custom types. Change-Id: I3d12d891bd7252ad2b8f1de69bced354800a1f29 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* | Add container access functionality for associative containers in QVariant.Stephen Kelly2013-05-201-0/+15
| | | | | | | | | | Change-Id: I4763a4c157e52918a0a68cba63624c0649aca235 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | Change the ownership semantics of metatype converter functions.Stephen Kelly2013-05-201-9/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Destroying the instances is a problem because the instances might have been created in a plugin. In that case, the destructor of the instance will be implemented in the plugin. As the instance destruction code is run very late, the plugin might have already been unloaded by the time an attempt is made to destroy the instance. The workaround is to create static instances on the stack. Task-number: QTBUG-31142 Change-Id: Ic2632c3548a734b742da46d90249916c35705d46 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | Fix since version of new metatype conversion functions.Stephen Kelly2013-05-081-8/+8
| | | | | | | | | | Change-Id: Icedd0942eaef9bdcf034d747f0a03a00ca461a95 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | Add automatic container access registration for built-in containers.Stephen Kelly2013-05-081-0/+4
| | | | | | | | | | Change-Id: I4d590c23e072994930922ff73367600f848fbcf0 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* | Add QVariant container iteration API.Stephen Kelly2013-05-081-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new set of classes is introduced for iterating over the contents of a container within a QVariant without knowing the exact type of the container, but with the guarantee that the element type within the container is a metatype. The implementation of the iterable interface uses the stl-compatible container API so that we can also iterate over stl containers, or any other container which also conforms to stl norms. This enables the functionality in the bug report. Task-number: QTBUG-23566 Change-Id: I92a2f3458516de201b8f0e470982c4d030e8ac8b Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* | Core: Support for converting user defined QVariant types.Christoph Schleifenbaum2013-05-081-0/+122
|/ | | | | | | | | | | | | | | | | This patchs allows the user to convert defined QMetaType types like MyType to be converted by using e.g. QVariant::toString(), mapping to MyType::toString(). Also all the other QVariant::toXYZ() methods are supported so far. The patch adds static methods QMetaType::registerConverter supporting: - implicit convertion - conversion using member method of source type - conversion using unary functor Change-Id: I4f1db83d9c78bcc9df5c42f82f95cce0480cdcc3 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-221-1/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsavefile_p.h src/corelib/tools/qregularexpression.cpp src/gui/util/qvalidator.cpp src/gui/util/qvalidator.h Change-Id: I58fdf0358bd86e2fad5d9ad0556f3d3f1f535825
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-161-5/+31
|\| | | | | | | | | | | | | Conflicts: src/widgets/styles/qstyleanimation.cpp Change-Id: Iae570895be6544de80f9c1ec309d1a08c59daff8
| * Ignore WasDeclaredAsMetaType flag during binary check.Jędrzej Nowacki2013-01-101-5/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Nobody should break ODR, but we were living with apps breaking it for at least 8 years. Sure it is an undefined behavior but in many cases it works. I do not think that Qt should enforce usage of a proper C++, it is role of a tool chain. Qt can only indicate that something is going terribly wrong. Make message a bit more verbose. Sometimes the ODR violation is not that easy to fix, therefore a hint is a nice addition. Update documentation of qRegisterMetaType. Change-Id: I61dcccc840eec80a4ed5b8a212a912807d239d8c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge "Merge branch 'stable' into dev" into refs/staging/devJędrzej Nowacki2013-01-071-0/+1
|\|
| * Declare the QMetaType::WasDeclaredAsMetaType enum as privateThiago Macieira2013-01-031-0/+1
| | | | | | | | | | | | | | | | Omit its value in the documentation. Change-Id: I474faefde23b0e2e0a77a9e6391fd556a6523128 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* | Rename QRegularExpression-related feature defs to QT_NO_REGULAREXPRESSIONGiuseppe D'Angelo2013-01-071-4/+4
|/ | | | | | | | | | | | QRegExp and QRegularExpression are totally independent, therefore using two different defines is the right thing to do. Also, document the new define in qfeatures.{txt,h}. Change-Id: Ice4826ea543f4b22f1cc27bf31ed6e043d0c43b0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* QMetaType build fix with Q_NO_CURSOR and friends.Jędrzej Nowacki2012-09-271-5/+7
| | | | | | | | | | | | QMetaType has a way to "switch off" some types from the build. QtMetaTypePrivate::TypeDefinition<T>::IsAvailable is defined as false for all unaccessible types. Sadly that information was never used by gui and widget handlers. The patch implements it. Change-Id: Ie5835be4c88cfbbca8a4e9199e31ddfc20cae190 Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Jing Bai <jing.bai@digia.com> 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>
* Improve QMetaType docs.Jędrzej Nowacki2012-09-131-10/+214
| | | | | | | Change-Id: I4ad4188d1bb984b83ffe4bb4ff098158e888d183 Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@nokia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
* Change SChar to metatype id 40.Stephen Kelly2012-09-031-1/+1
| | | | | | | | | This fills the gap left by QWidgetStar, making the sequence between FirstCoreType and LastCoreType contiguous, which some benchmarks assume to be true anyway. Change-Id: I2d5d202b6246a9065fdf77f325a4a04279dbe4b7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Add \inmodule QtCore to all QtCore class doc bodiesThiago Macieira2012-08-231-0/+1
| | | | | Change-Id: I19100755c97cc155c76a859e19940e9f9222d34e Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Remove QWidgetStar.Stephen Kelly2012-08-181-4/+1
| | | | | | | | | | | | This allows us to remove the odd hacks to get the static metaobject for the QWidget* metatype. The QWidget* is still an automatic metatype thanks to the QObject partial template specialization. It is registered as a metatype at runtime automatically in qwidgetsvariant.cpp. Change-Id: Ie01b69eadf2cbe87af1a86c3284550f60dcf9e94 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Make the "\internal" qdoc command stand on its own lineLaszlo Papp2012-08-151-9/+18
| | | | | | | | | | The qdoc manual currently claims that the command must stand on its own line. The change follows the consistency with the rest and how the example looks like inside the qdoc manual for this command. Change-Id: I6b653dc95cf9d84e4adf32220dace5d313678419 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Remove Q_UNUSED for the metaObject.Stephen Kelly2012-07-191-2/+0
| | | | | | | | | The object is no longer unused. Change-Id: Ia82539220855321f2986c5791b70be5df399baca Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* fix "No such ..." doc error for QMetaType::typeName()Jeremy Katz2012-07-191-1/+1
| | | | | Change-Id: If00c728ec793a65f62d76d8301c7f6658e7af8a0 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Store the QMetaObject with the QMetaType.Stephen Kelly2012-07-011-1/+64
| | | | | | | | This will allow conversion between pointers to compatible QObject derived types. Change-Id: I19e08934571fb3f1b91e594892214041fe5f6a11 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Move QIcon metatype handlers back to QtGuiOlivier Goffart2012-05-181-2/+2
| | | | | | | | | | | QIcon has been moved back from QWidget to QtGui, so the QIcon QVariant and QMetaType handler can now be moved back to QtGui. Also we can give back QIcon its old number, allowing to get rid of some compatibility hack when unstreaming QVariant Change-Id: I439d5c2987c06ecd619f394407850f678164afb8 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Use bool for the template argument.Stephen Kelly2012-05-091-1/+1
| | | | | | | | It is only ever called with 'true' or 'false'. Change-Id: Ibaba1c964cebb3ac75a230471a7a6547c2245039 Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Introduce a new built-in type: signed char.Jędrzej Nowacki2012-05-081-0/+7
| | | | | | | | | | | | C++ distinguish between "char", "signed char" and "unsigned char", they are three independent types. Fix QVariant behavior on ARM. On ARM "char" may mean "unsigned char", but we depends on the sign during a numerical conversions. Change-Id: I610ce3fb88ed5964b67f3ae442d264fe16b2d261 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/api_changes'Lars Knoll2012-05-031-17/+16
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qlogging.cpp src/gui/kernel/qguiapplication.h src/gui/kernel/qwindow.cpp src/gui/kernel/qwindow.h tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp Change-Id: I62a8805577a7940d4d36bed985eb3e7019d22f2e
| * Remove redundant check in QMetaType::typeInfoJędrzej Nowacki2012-04-181-2/+1
| | | | | | | | | | | | | | The check was introduced when void was not a fully defined type. Change-Id: I4df8607999436f8db92be77fc8fd203fc66c2816 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
| * Hide QTypeModuleInfo in a private namespace.Jędrzej Nowacki2012-04-181-15/+15
| | | | | | | | | | | | | | The class is private and shouldn't pollute global namespace. Change-Id: Ib44473fd72e5a70096eeff1662e88b29263d19c6 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* | Fix regression in connectNotify(const char *) emissionKent Hansen2012-05-011-8/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reimplementations of connectNotify() and disconnectNotify() can assume that the signal argument is in normalized form, but after the introduction of the Qt5 meta-object format, it could happen that it's not. The problem is that the internal QArgumentType class, which attempts to resolve a typename to a type id, was calling QMetaType::type(). QMetaType::type() falls back to trying the normalized form of the typename if the original argument can't be resolved as a type (this behavior isn't documented, but that's how it works). This means that e.g. QMetaType::type("const QString &") returns QMetaType::QString. Since QMetaObjectPrivate::indexOfMethodRelative() (more specifically, the methodMatch() helper function) prefers to compare type ids over typenames (since the type ids are stored directly in the meta- object data for built-in types), the method lookup would *succeed* for signatures with non-normalized built-in typenames as parameters. QObject::connect() would then think that it did not have to normalize the signature (see "// check for normalized signatures"). The consequence was that the original, non-normalized form got passed to connectNotify(). This commit introduces an internal typename-to-type function that is the same as QMetaType::type(), except it doesn't try to normalize the name. This way, the only place where normalization can occur in the signature-to-meta-method processing is through the calls to QMetaObject::normalizedSignature() in QObject::connect() itself. The implication is that there are now cases where the method signature will be decoded and processed twice, where processing it once was sufficient before. On the other hand, it is consistent with the pre-Qt5-meta-object behavior, where we predict that the signature is already normalized, and only perform (comparatively costly) normalization if the initial lookup fails. Change-Id: Ie6b60f60b0f9a57ebd378d980329dac62d57bbd9 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* | Provide versions of qRegisterMetaType() that do not normalize typename.Martin Jones2012-04-201-8/+41
| | | | | | | | | | | | | | | | | | QML is quite capable of providing typenames in the correct format. qRegisterNormalizedMetaType() does not normalize the typename, so avoids the huge overhead. Change-Id: I96c9a42fe0b5d36ac05a9247f6507dbf9583fa67 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* | Doc: Prepare for building modular QtCore docs.Casper van Donderen2012-04-191-19/+11
|/ | | | | | | | | | | | 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>
* Remove duplicated template code.Jędrzej Nowacki2012-04-031-43/+2
| | | | | | | | | | | | Unify TypeDefinitions specializations. I'm not aware of any reason why QVariant should have a separate set of supported types during bootstrapping phase. It would cause only crashes. As a side effect the patch reduces size of core and gui libraries. Change-Id: I5140d9d3daee39a0171bc718bf46dab6b28085ec Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Get rid of compilation warning.Jędrzej Nowacki2012-03-231-0/+1
| | | | | | | metaObject pointer will be used in future. Change-Id: I1f335687ad1aa443def21efcb5d4a2eaf3583c44 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QtJson types to meta-type systemKent Hansen2012-03-201-0/+20
| | | | | | | | | | Make QJsonValue, QJsonObject, QJsonArray and QJsonDocument first-class meta-types. This is an enabler for a lightweight integration with QML. Change-Id: I4725efdd2746cf97fd26d3632a99e8eee849f834 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Add API and reserve space for storing the QMetaObject with the QMetaType.Stephen Kelly2012-03-201-3/+6
| | | | | | | | In Qt 5.1, http://codereview.qt-project.org/#change,19113 can be rebased on top of this change in a compatible way. Change-Id: If7ac0481a3b2a874528de4ef6ea7535501a4ac71 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Merge master into api_changesKent Hansen2012-03-161-244/+58
|\ | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qmetatype.cpp src/gui/kernel/qplatformsurface_qpa.cpp tests/auto/corelib/tools/qtimeline/qtimeline.pro Change-Id: Iff3fff34eeeb06f02369767ddfce44cfde505178
| * Reimplement QMetaType::create method.Jędrzej Nowacki2012-03-141-228/+55
| | | | | | | | | | | | | | | | | | The method was reimplemented using QMetaTypeSwitcher. That should reduce maintenance costs, because types list is populated automatically now. Change-Id: I6637f7b928218ce60b2ec7436079a44089f0e00f Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
| * Unify QMetaType::TypeFlags detection.Jędrzej Nowacki2012-03-141-6/+2
| | | | | | | | | | | | | | | | | | Duplicated code was removed. As an side effect: - one runtime flag check was replaced by a compile time check. - is enum flag can be used together with built-in types. Change-Id: I54173e7b07ce7e487d3cc21ba24dcccd28b5d049 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | QRegularExpression: QMetaType and QVariant supportGiuseppe D'Angelo2012-03-141-4/+27
| | | | | | | | | | | | | | | | | | Removed the Q_DECLARE_METATYPE in favour of first-class support inside QMetaType and QVariant. Change-Id: I904236822bfab967dc0fbd4d4cc2bcb68c741adc Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* | Merge remote-tracking branch 'origin/master' into api_changesLars Knoll2012-03-121-2/+3
|\| | | | | | | | | | | | | Conflicts: tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp Change-Id: I884afc3b6d65c6411733a897a1949e19393573a7