summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qmetatype.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-12-291-1/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.cpp src/gui/kernel/qplatformsystemtrayicon.cpp src/gui/kernel/qplatformsystemtrayicon.h src/plugins/platforms/xcb/xcb-plugin.pro Change-Id: I00355d3908b678af8a61c38f9e814a63df808c79
| * MSVC: Restore 'public' accessibility of QMetaType member functionsAndy Shaw2014-12-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | They were made 'private' as a side effect of a change enabling support of template friends for MSVC. However, accessibility is part of the MSVC's name mangling and thus BC was broken. [ChangeLog][Important Behavior Changes] Restored binary compatibility with Qt 5.3.2 on Windows when using MSVC 2012 or MSVC 2013. This means that Qt 5.4.1 is no longer binary compatible with Qt 5.4.0 when using either of those compilers. Change-Id: I18679aa15821a7365606dc80fdc8411641573820 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Implement proper C++ type numeric promotion for QVariant comparisonsThiago Macieira2014-12-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, QVariant would try to convert one operand to the other's type, which would produce unexpected results: the results would depend in the order of the operands and whether there was data loss in the conversion. In addition, ordering comparisons were only done with signed values, yielding other unexpected results, like QVariant(LLONG_MAX / 2) < QVariant(Q_UINT64_C(0)). Instead, try to obey the C++ standard rules for type promotion in expressions. Our code is a little simpler than the standard would seem to require since we know some more details from the ABI. [ChangeLog][Important Behavior Changes][QVariant] QVariant now obeys the C++ type promotion rules when comparing numeric types (integrals, float and double), including the fact that unsigned comparisons are preferred for types of the same rank (that is, now QVariant(-1) > QVariant(0U)). Task-number: QTBUG-42722 Change-Id: Ie7b19073dcb45485354710975e561bcdb1a753f1 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | Remove unused private apiJędrzej Nowacki2014-11-191-14/+0
| | | | | | | | | | Change-Id: Iffe5a33b8a1f134d722371a9e92ba9c9d13c51f8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Reduce code bloat, by cleaning up QMetaTypeFunctionHelperJędrzej Nowacki2014-11-171-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create and Delete wrappers are not necessary, because they can be easily simulated with Construct and Destruct. This change removes redundant function wrappers and a bit of over-optimized code. Gain is quite big: Before: text data bss dec hex filename 5366008 47460 14904 5428372 52d494 libQt5Core.so.5.5.0 505578 7060 2124 514762 7daca libQt5DBus.so.5.5.0 5591079 134656 6728 5732463 57786f libQt5Gui.so.5.5.0 1398785 31676 2576 1433037 15ddcd libQt5Network.so.5.5.0 6642431 220952 2536 6865919 68c3ff libQt5Widgets.so.5.5.0 After: text data bss dec hex filename 5342559 47460 14904 5404923 5278fb libQt5Core.so.5.5.0 496025 7068 2124 505217 7b581 libQt5DBus.so.5.5.0 5579291 134272 6728 5720291 5748e3 libQt5Gui.so.5.5.0 1389461 31676 2576 1423713 15b961 libQt5Network.so.5.5.0 6637139 220952 2536 6860627 68af53 libQt5Widgets.so.5.5.0 Cost of the change, is moved to CPU while calling QMetaType create() and destroy(), these two functions became a bit slower. The cost should not be visible, because they call operator new anyway. Change-Id: I34fd410343377d9c29925675d7da8172bfda9ce6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Let QMetaType know which types are Q_GADGETOlivier Goffart2014-11-161-3/+19
| | | | | | | | | | | | | | | | | | 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>
* | Add QMetaType::type(QByteArray) functionKent Hansen2014-10-311-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QMetaType::type(const char *) requires that the string argument is 0-terminated. This new overload makes it possible to query the type of a string with an explicit length. In particular, QByteArrays constructed by QByteArray::fromRawData(), for example from a substring of a normalized method signature (the "int" part of "mySlot(int"), can now be queried without making a copy of the string. Also, Qt5 meta-objects represent type names as QByteArray literals, which can be fed directly to this new QMetaType::type() overload (no need to call strlen). Change-Id: I60d35aa6bdc0f77e0997f98b0e30e12fd3d5e100 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-10-271-0/+15
|\| | | | | | | | | | | | | Conflicts: src/gui/text/qfontdatabase.cpp Change-Id: I6ac1f55faa22b8e7b591386fb67f0333d0ea443d
| * Fix QVariant associative container conversion from built-in types.Jędrzej Nowacki2014-10-241-0/+15
| | | | | | | | | | | | Task-number: QTBUG-41403 Change-Id: I9dab0f9450cac11678eb6d20abd2dd08e86e0900 Reviewed-by: Stephen Kelly <steveire@gmail.com>
* | Merge remote-tracking branch 'origin/5.4' into devOswald Buddenhagen2014-09-291-19/+11
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.cpp src/gui/image/qimage.cpp src/gui/image/qppmhandler.cpp src/gui/kernel/qguiapplication.cpp src/gui/painting/qpaintengine_raster.cpp Change-Id: I7c1a8e7ebdfd7f7ae767fdb932823498a7660765
| * 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>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-09-011-2/+5
|\| | | | | | | Change-Id: I2811ff0b9d4097f0be60ff16e9664a5060cff23e
| * Mark QByteArrayList as metatype built-in type.Jędrzej Nowacki2014-08-281-2/+5
| | | | | | | | | | | | | | As a side effects it also adds core templates types to the tests Change-Id: I0e3338e0bffdf21982aa83d404c83288e54411f4 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | QMetaType: disallow automatic registration of reference typeOlivier Goffart2014-08-131-0/+3
|/ | | | | | | | | | | | | | The automatic registration code that would be added will break with a reference type. QObject's template code calls QMetaTypeId2 on the arguments of the signal. Including on references. Reference type cannot be register as metatype. They are not supported in QVariant, or in QueuedConnection. Change-Id: I83f2e50f9f886909dc24f3809c990e5763012cc2 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Make VectorBoolElements static properties const.Jędrzej Nowacki2014-06-251-2/+2
| | | | | | | The elements should not be changeable. Change-Id: I108cb42b1237cd61c4d8f2fbe13305fbbf4ef311 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Metatype: Specialize IteratorOwner for vector<bool>Stephen Kelly2014-06-161-3/+30
| | | | | Change-Id: I542af3a77b0a139e137a5a736b74042a8c25eb95 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-05-131-0/+1
|\ | | | | | | | | | | | | Manually changed enum to LibGL in src/plugins/platforms/xcb/qglxintegration.cpp Change-Id: If34ee6cce3d1d51fb4bb1fdfa59c30389ea0d207
| * Add a comment about not obvious code in VariantData.Jędrzej Nowacki2014-05-021-0/+1
| | | | | | | | | | Change-Id: I943af28c47b396aa35173da2a1294b86c8a522fa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Build fix for auto-registration of Container<void*>Jędrzej Nowacki2014-04-231-2/+9
| | | | | | | | | | | | | | | | IteratorOwner pointer specialization was failing for void* because of an invalid function overload. Change-Id: I80355ddd2b871c1fa2fa5bf5a4ed8bc7768fc3c9 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* | QMetaType: Specialize IsPointerToTypeDerivedFromQObject for const void*Stephen Kelly2014-04-221-0/+5
| | | | | | | | | | | | | | | | | | 'const void' is not derived from QObject, and is not a type we can use sizeof to determine that. Change-Id: I008f444bbed9fc8f9147da0f7f336757f660e224 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/stable' into devIikka Eklund2014-04-011-35/+7
|\| | | | | | | Change-Id: I2a6eb9dd7724931bc89f28bcc156e77c4e26d069
| * Reduce clang compilation time of tst_qmetatype by ~2%Jędrzej Nowacki2014-03-281-35/+7
| | | | | | | | | | Change-Id: I64fe12dd0bf9c35ae06fc5a68addc36848cdda3b Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-03-241-1/+6
|\| | | | | | | | | | | | | Conflicts: src/gui/image/qjpeghandler.cpp Change-Id: I9db3acea7d5c82f5da679c8eaeb29431136665f0
| * Fix Q_DECLARE_METATYPE macroJędrzej Nowacki2014-03-171-1/+2
| | | | | | | | | | | | | | | | | | The macro should stringify value of the given token not the token itself. Task-number: QTBUG-37547 Change-Id: I90f4fa613bd13d5a581828ab13f620b40dfd3593 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
| * Remove level 4 compiler warnings from MSVC.David Schulz2014-03-151-0/+4
| | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-7233 Change-Id: I52067e3a22e98a62fd87415906e54a54ff2d6b49 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com> Reviewed-by: Oliver Wolff <oliver.wolff@digia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Dave McClelland
* | QtCore: Fix MSVC 64bit warnings about conversion from size_t to int.Friedemann Kleint2014-02-251-2/+2
|/ | | | | | | warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data Change-Id: I9be380cbb7bed4cd95515074c7cad7e41a511dc9 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Fix ‘looses precision’ warning in public APIKurt Pattyn2013-12-271-3/+3
| | | | | Change-Id: I935e6f278e539f8e6aaca0bc381371ec85aa5c67 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QMetaType: Fix equality comparison of type-erased iterators.Stephen Kelly2013-12-131-2/+12
| | | | | | | Task-number: QTBUG-33997 Change-Id: I0d4da562540df0e3732769881ba124cb980f6b82 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* QMetaType: Fix copy of type erased iteratorStephen Kelly2013-12-131-2/+10
| | | | | | | | | | | Behavior differs depending on whether the iterator is a value_type*, or a different class entirely. Ensure that the correct behavior is used when copying. Task-number: QTBUG-33997 Change-Id: Ib6db2a3c4a5aa861b851833a7f0ecb855a3e828f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* QMetaType: Rename template type of type-erased iterator operations.Stephen Kelly2013-12-121-6/+6
| | | | | | | | This struct is a specialization for the case that the const_iterator is a pointer to the value type. Reflect that in the type name. Change-Id: I0a4ac03840658056285080860baec8313746c71c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Correct compiler warnings for sign conversionKurt Pattyn2013-12-061-3/+3
| | | | | | | | | | | | | qstrlen() returns a uint. When assigned to an int, the compiler warns about sign conversions. Because these calls are used within templates, the code appears in user generated code, and hence the warnings cannot be suppressed by the -isystem directive. Using the -Werror flag, makes the user code fail. [ChangeLog][QtCore] Fixed sign conversion warnings in code using QMetaTypeId. Change-Id: Ib7603679d6526467f8cbb9d7bcf5f56c6af47ceb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* MetaType: Fix operator{+,-}(int) with the type-erased const_iterators.Stephen Kelly2013-09-131-0/+28
| | | | | | | | Make sure we don't modify the lhs. Instead copy it and advance the copy. Change-Id: I3440e8e175bfc299f8f83b816faca54fa3f79e43 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Remove some unneeded constructors.Stephen Kelly2013-09-131-11/+3
| | | | | Change-Id: I34f86960dc0cfaada509957bca5466b2765e8239 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Fix new warnings under Clang 3.3Thiago Macieira2013-09-131-34/+36
| | | | | | | | | | | | | | | Probably added by a1898f4466518bf3e1b6e9154eec05ecf9d909e3. qmetatype.h:70:29: error: inline function 'qMetaTypeId<QtMetaTypePrivate::QSequentialIterableImpl>' is not defined [-Werror,-Wundefined-inline] qmetatype.h:1363:30: note: used here const int toId = qMetaTypeId<QtMetaTypePrivate::QSequentialIterableImpl>(); qmetatype.h:70:29: error: inline function 'qMetaTypeId<QtMetaTypePrivate::QAssociativeIterableImpl>' is not defined [-Werror,-Wundefined-inline] qmetatype.h:1386:30: note: used here const int toId = qMetaTypeId<QtMetaTypePrivate::QAssociativeIterableImpl>(); Change-Id: I9afe1a3d50ab23eb701797e28b259966dc95a147 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Add a convenient way to get a type-erased smart pointer from a QVariant.Stephen Kelly2013-09-111-0/+45
| | | | | | | | | | | | 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-69/+33
| | | | | | | | | 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>
* Move the preprocessor iterator for Qt smart pointers with the others.Stephen Kelly2013-09-061-8/+10
| | | | | | | Use it to forward declare the types. Change-Id: I48d9e32dcf02471d197a82502d96d60807d11d57 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Make the automatic 1arg and 2arg metatype macros work with namespaced Qt.Stephen Kelly2013-09-061-4/+13
| | | | | Change-Id: I64aa3cacd0cf57235ad43f089716765b384ef412 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Fix the automatic declaration of smart pointer types.Stephen Kelly2013-09-061-6/+34
| | | | | | | | | | | | Before this patch, qRegisterMetaType<QSharedPointer<double> >("QSharedPointer<double>") without a metatype declaration fails to compile, whereas it works with Qt 5.1 (ie, before commit e9a69c3ba928bd88974563b386b000ad6583f969) Change-Id: I9408f711c9df810ff29b879b7696dab81c1160f1 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Simplify the smart pointer metatype templateStephen Kelly2013-09-051-17/+6
| | | | | | | | | | Don't use ## concatenation to create an identifier. That won't work for types in namespaces: Q_DECLARE_SMART_POINTER_METATYPE(QtPrivate::FutureSmartPointer) Change-Id: I876ea93d817724005efc28413f09c01623c2a7a1 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Fix Clang 3.3 warning on using an undefined inline functionThiago Macieira2013-09-051-12/+16
| | | | | | | | | | | | | | | | Clang doesn't like forward-declared inline functions. qmetatype.h:70:29: error: inline function 'qMetaTypeId<QtMetaTypePrivate::QPairVariantInterfaceImpl>' is not defined [-Werror,-Wundefined-inline] inline Q_DECL_CONSTEXPR int qMetaTypeId(); ^ qmetatype.h:1463:30: note: used here const int toId = qMetaTypeId<QtMetaTypePrivate::QPairVariantInterfaceImpl>(); ^ Change-Id: I1454af5cce56512f0b3d63cfaf51a536207fc511 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Merge branch 'stable' into devSergio Ahumada2013-07-111-5/+5
|\ | | | | | | | | | | | | | | | | | | Conflicts: qmake/generators/mac/pbuilder_pbx.cpp src/corelib/json/qjsonwriter.cpp src/corelib/kernel/qeventdispatcher_blackberry.cpp src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm Change-Id: I24df576c4cbd18fa51b03122f71e32bb83b9028f
| * QtCore: Fix remaining MSVC-64 warnings about integer truncation.Friedemann Kleint2013-07-021-5/+5
| | | | | | | | | | | | | | | | | | warning C4267: 'argument' : conversion from 'size_t' to ' int', possible loss of data. Change-Id: I8d1ca27d4d66a9ce0deb70766446e780308bba33 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-06-201-1/+1
|\| | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp tools/configure/configureapp.cpp Change-Id: I3092bd3276af14304b7ab3ae1e1cc05d11cdede0
| * Remove use of 'register' from Qt.Stephen Kelly2013-06-171-1/+1
| | | | | | | | | | | | | | | | | | | | It is deprecated and clang is starting to warn about it. Patch mostly generated by clang itself, with some careful grep and sed for the platform-specific parts. Change-Id: I8058e6db0f1b41b33a9e8f17a712739159982450 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-06-121-2/+2
|\| | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qcocoamenubar.mm Change-Id: I4a699fc8a7f30b2af9de8e496c3d5f027b7495bb
| * QtCore: Fix MSVC-64 warnings about integer truncation.Friedemann Kleint2013-06-081-2/+2
| | | | | | | | | | | | | | | | warning C4267: 'argument' : conversion from 'size_t' to ' int', possible loss of data. Change-Id: I79af7497420d468b5bc7c48c9ae21b86117519a9 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* | Core: QDebug and comparison operator support metatypes.Christoph Schleifenbaum2013-05-271-0/+112
| | | | | | | | | | | | | | | | 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>
* | Make it possible to access QPair and std::pair elements from a QVariant.Stephen Kelly2013-05-201-0/+117
| | | | | | | | | | Change-Id: I9dc73748073d0d1e43bdadbce73339dfcc1bc647 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* | Add container access functionality for associative containers in QVariant.Stephen Kelly2013-05-201-3/+265
| | | | | | | | | | Change-Id: I4763a4c157e52918a0a68cba63624c0649aca235 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>