summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qvariant.h
Commit message (Collapse)AuthorAgeFilesLines
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Move the QVariant declaration up in the file.Rolland Dudemaine2015-12-301-1/+1
| | | | | | | | | | | This is especially necessary for the GHS toolchain which otherwise chokes on the lack of some local definitions made by the Q_DECLARE_SHARED macro. Change-Id: Ie4e355226e4a66e1589e1d422d3a622b11bd9aef Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* QVariant: retain duplicate keys when convertingThiago Macieira2015-12-081-2/+2
| | | | | | | Task-number: QTBUG-49520 Change-Id: I3e15a26e0e424169ac2bffff1417e3f4398c2277 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* Avoid recreating QVariantLists when extracted from a QVariantJocelyn Turcotte2015-08-241-3/+3
| | | | | | | | | | | | | | | Wrapping a QVariantList in a QVariant to pass it to QML would trigger a deep copy each time QML would try to access elements in the list (specifically in QQmlListAccessor::at). This reverts a part of 8c4deff51c8064f5a15cae0342bfa66b6663662b by specifying the associative array conversions explicitly without including the current type in the list of types to convert through an iteration. Task-number: QTBUG-41403 Change-Id: If9fddfe6d36f789ac4aa61a7c32677cd1dd077d8 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* qvariant: Pass a couple of large types by const-ref in Qt6Sérgio Martins2015-07-221-0/+8
| | | | | | | sizeof is approx 100 bytes Change-Id: Ibd5fb50674effee832ce4529d737c060c570ffa3 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QtCore: Use Q_NULLPTR instead of 0 in all public headersMarc Mutz2015-07-011-8/+8
| | | | | | | | | 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>
* QVariant: Fix wrong return type in toPersistentModelIndex()Gabriel de Dietrich2015-03-121-1/+1
| | | | | | Change-Id: I53afa712d38ec6a41fce77474acccf9c587ea6a8 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Make QPersistentModelIndex an internal meta-typeGabriel de Dietrich2015-03-061-0/+3
| | | | | | | | | | | It was already a user meta-type, so it only gets promoted to internal. [ChangeLog][QtCore] QPersistentModel index becomes an built-in meta-type, including QVariant support. Change-Id: I63d733d1eb66aa61691e7afce27fe7372a83ac00 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.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>
* QAssociativeIterable: add find()Marc Mutz2015-01-211-6/+2
| | | | | | | | | | This is like value(), but returns an iterator instead of the value(). [ChangeLog][QtCore][QAssociativeIterable] Added find(). Change-Id: I029fc8f91cef78f718d419587a2a50ffd2bf7632 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* QtCore: add some more Q_DECL_NOTHROWMarc Mutz2015-01-211-3/+1
| | | | | | | | | | | QtCore now builds with no -Wnoexcept warnings (that doesn't mean there aren't tons of functions that should be marked noexcept, just that all conditionally noexcept functions aren't noexcept(false) just because of a forgotten noexcept elsewhere). Change-Id: I10dacb6b9c9d41d3595fe2f306356d62d3d91c76 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2015-01-211-0/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/global.pri src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.h src/corelib/tools/qdatetime.cpp src/plugins/platforms/xcb/qxcbscreen.h src/plugins/platforms/xcb/qxcbwindow.h src/widgets/dialogs/qcolordialog.cpp src/widgets/dialogs/qcolordialog_p.h tools/configure/configureapp.cpp Change-Id: Ie9d6e9df13e570da0a90a67745a0d05f46c532af
| * Fix a memleak in QAssociativeIterable::value()Marc Mutz2015-01-041-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QtMetaTypePrivate::QAssociativeIterableImpl::{find,begin,end}() allocate a new _iterator, so when they're used outside of the ref-counted world of QAssociativeIterable::const_iterator, their lifetime needs to be manually managed. Instead of going to that length, which failed in previous iterations of this patch, implement value() in terms of (new) find() and let find() operate on const_iterator. Because of forwards compatibility between patch releases, use (unexported) friend functions for now with the intention to make them proper member functions come Qt 5.5. Task-number: QTBUG-41469 Change-Id: I43b21eae0c2fc4c182369e669a8b3b457be68885 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QtCore: mark some operations nothrowMarc Mutz2015-01-101-6/+6
|/ | | | | | | | | | | | This shotgun-surgery approach is motivated by trying to get a clean(er) build for -Wnoexcept on GCC, so it is expected that for any class touched here, there will be more operations that can be marked nothrow. But they don't show up in conditional noexcept clauses, yet, so they are deferred to some later commit. Change-Id: I0eb10d75a26c361fb22cf785399e83b434bdf233 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Lower QVariant::userType call countJędrzej Nowacki2014-10-311-10/+16
| | | | | | | | We know that type id can't be changed, let pass this information to the compiler. Change-Id: I105b460417288b84250a954571c247608976f8f7 Reviewed-by: Stephen Kelly <steveire@gmail.com>
* Fix QVariant associative container conversion from built-in types.Jędrzej Nowacki2014-10-241-3/+3
| | | | | | Task-number: QTBUG-41403 Change-Id: I9dab0f9450cac11678eb6d20abd2dd08e86e0900 Reviewed-by: Stephen Kelly <steveire@gmail.com>
* MSVC: Restore 'public' accessibility of QVariant member functions.Friedemann Kleint2014-10-071-1/+2
| | | | | | | | | | The were made 'protected' 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. Task-number: QTBUG-41810 Change-Id: I5ce4c7010673c06d5b75219c89c7ebd337bac6c0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* Mark QByteArrayList as metatype built-in type.Jędrzej Nowacki2014-08-281-1/+9
| | | | | | | 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>
* MetaType: de-inline the container iterables.Stephen Kelly2013-09-201-148/+60
| | | | | | | | This means the *Iterables and corresponding const_iterators need to be exported. Change-Id: Ic93283616bda96e0d7752b0e881bf0230a5c2146 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* MetaType: Add assignment operator to the container iterators.Stephen Kelly2013-09-191-0/+20
| | | | | Change-Id: Ib4f2197a0ab6bd41c91de667cd3087fb40e44097 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* MetaType: Fix memory leak of QAtomicInt.Stephen Kelly2013-09-171-0/+2
| | | | | Change-Id: I04c87c4caeb96c820c4d332a803cb2824fea5891 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* MetaType: Fix operator{++,--}(int) with the type-erased const_iterators.Stephen Kelly2013-09-171-4/+4
| | | | | | | | | | Similar to commit 8b062418 (MetaType: Fix operator{+,-}(int) with the type-erased const_iterators., 2013-09-11), explicitly create a copy of the iterator and intialise it. Change-Id: I8b9edef40ca00c826f72768cba4a0992e55371f8 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* MetaType: Fix operator{+,-}(int) with the type-erased const_iterators.Stephen Kelly2013-09-131-4/+4
| | | | | | | | 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>
* QVariant: Make it possible to extract a QObject* from a wrapper without ↵Stephen Kelly2013-09-051-1/+3
| | | | | | | conversion. Change-Id: I3a054d87d12e08d72dd4c77b6d467dc63f9a2231 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Core: QDebug and comparison operator support metatypes.Christoph Schleifenbaum2013-05-271-0/+9
| | | | | | | | 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/+26
| | | | | Change-Id: I9dc73748073d0d1e43bdadbce73339dfcc1bc647 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Add container access functionality for associative containers in QVariant.Stephen Kelly2013-05-201-0/+142
| | | | | Change-Id: I4763a4c157e52918a0a68cba63624c0649aca235 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Add QVariantList extraction from a QVariant with a sequential container.Stephen Kelly2013-05-081-0/+16
| | | | | Change-Id: Id9fac7bf47ed3fbb385222b25941215ac24b8b88 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Add QVariant container iteration API.Stephen Kelly2013-05-081-2/+92
| | | | | | | | | | | | | | | | | | 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-5/+3
| | | | | | | | | | | | | | | | | 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>
* qMetaTypeId(): deprecate the dummy parameter.Olivier Goffart2013-02-081-3/+3
| | | | | | | | | | | | | | It was there because of MSVC6 compatibility. It is not removed, because some code used to do qMetaTypeId(&myVariable); This was not a documented feature anyway, so it should not be user visible. Change-Id: I55327d7e73e67a6bb741817741d530d5a650291a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.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>
* 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 branch 'stable' into devSergio Ahumada2013-01-091-2/+2
|\| | | | | | | Change-Id: I7f0dab6bdb1f3cc1d3e6c30166ff6db9dfae37e9
| * Replace macro qdoc with Q_QDOCDebao Zhang2013-01-081-2/+2
| | | | | | | | | | | | | | | | Both qdoc and Q_QDOC are used in source code, which looks not good. Change-Id: I4f3a71670278b0758d92bfa5db086a07e1b1acfd Reviewed-by: hjk <qthjk@ovi.com> Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* | Rename QRegularExpression-related feature defs to QT_NO_REGULAREXPRESSIONGiuseppe D'Angelo2013-01-071-9/+11
|/ | | | | | | | | | | | 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>
* Delete the QVariant ctors taking global Qt enum values.Stephen Kelly2012-10-101-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They have unexpected results in Qt 5 (the Qt::GlobalColor one works as expected in Qt 4, but was removed in Qt 5): QVariant v = QVariant(Qt::red); qDebug() << v; // QVariant(int, 7) v = Qt::red; qDebug() << v; // QVariant(int, 7) The correct way is to use: QVariant v = QVariant::fromValue(QColor(Qt::red)); The deleted constructors are the ones for which there is a class with an implicit constructor taking the enum, and that class is a built-in metatype. QLocale::Language and QKeySequence::StandardKey would also fit the description, but I can't include the header for QKeySequence as it is in QtGui, and I don't want to include the qlocale header in qvariant.h. Putting a QLocale::Language is probably very uncommon anyway. The QTextFormat test is doing the wrong thing, but the result isn't being tested. Added new tests which fail before the patch. Change-Id: Ia38a0784990f4d40ff7457a86daf58aabd4964eb Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.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>
* QVariant: prevent QVariant(QMetaType::Type) from compilingMarc Mutz2012-09-071-0/+7
| | | | | | | | Reported-by: Stephen Chu <stephen@ju-ju.com> Change-Id: I298973174ff10f4462f04f3358c974c04dfd3383 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Stephen Chu <stephen@ju-ju.com>
* De-inline QVariant(float)Harald Fernengel2012-08-231-1/+1
| | | | | | | | | All QVariant constructors are not inline, so change QVariant(float) as well. This allows for refactoring of QVariant during lifetime of Qt 5 without breaking QVariant(float) case. Change-Id: Icd1fc331a1ef8a2872be811aa7d1160406038f06 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Speed up construction of basic QVariantsHarald Fernengel2012-08-151-1/+8
| | | | | | | | | | | | | | | | | Instead of first creating an initialized Private struct, then overwrite the member variables, we added an internal constructor that initializes the private struct sanely. In the new (inlined, internal) constructor, both the MSB bits in the bitfield are 0, and since the value of internal meta-type ID is so low that the two MSB bits should never be set, the compiler can (hopefully) optimize away the bit-fiddling initialization of the bit-field. Callgrind shows about 33% speed-up in e.g. QVariant::QVariant(int) Change-Id: I706773a71c0d8dcbe119ad15411578b81892deb5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Implement implicit constructors for built-in classes.Stephen Kelly2012-07-271-0/+12
| | | | | | Change-Id: I6b0b104bc1da3252d014615c50b81830de42e722 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Q_DECLARE_SHARED: mark the type movableMarc Mutz2012-07-101-1/+0
| | | | | | | | | | All implicitly shared classes are by definition movable, so this patch adds Q_DECLARE_TYPEINFO(Type, Q_MOVABLE_TYPE) to Q_DECLARE_SHARED. Change-Id: Idf8989ae1a7ed6d1ac13fccb7eaef7395a875350 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Replace `const QLatin1String &` with `QLatin1String` where appropriateKonstantin Ritt2012-05-251-1/+1
| | | | | | | Task-Id: QTBUG-24502 Change-Id: I360dee4dc68c165de0631ce4cf34e76fd873080e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move QIcon metatype handlers back to QtGuiOlivier Goffart2012-05-181-1/+1
| | | | | | | | | | | 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>
* Implement the move constructor for containers.Olivier Goffart2012-05-111-0/+2
| | | | | | | | | | | | | | | This changes all the containers that uses QtPrivate::RefCount (QMap already had one), and QVariant In Qt 4.8, it was pointless to have the move constructor because we did not have quick way to re-initialize a null container. (shared_null still needed to be refcounted) But now that we have RefCount, and that the shared_null do not have reference count, we can implement a fast move constructor that do not generate code to increment the reference count. Change-Id: I2bc3c6ae96983f08aa7b1c7cb98d44a89255160b Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Introduce a new built-in type: signed char.Jędrzej Nowacki2012-05-081-0/+1
| | | | | | | | | | | | 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>
* Remove QVariant constructor taking Qt::GlobalColor.Jędrzej Nowacki2012-04-191-1/+0
| | | | | | | | The constructor is wrong, it creates instance of QVariant encapsulating a QColor instance. QVariant should not implicitly convert data, never. Change-Id: Idc794ecdecb42d8b53fee3f993bf51ddd43f595d Reviewed-by: Lars Knoll <lars.knoll@nokia.com>