summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qmetatype.h
Commit message (Collapse)AuthorAgeFilesLines
* QMetaType: force properties to have a complete type againFabian Kosmale2020-07-241-2/+11
| | | | | | | | | | | | | | When the compile time metatype support for methods was introduced, we needed to allow incomplete types to avoid breaking a large amount of code. However, this mistakenly enabled using incomplete types for properties, too. In contrast to methods, properties lack the fallback code to retrieve the metatype at runtime. Thus, this commit restores the completeness requirement for properties again. This is done by always calling QMetaTypeForType for properties in qTryMetaTypeForType. Amends fa987d44417528856d5e80ed7b48ba99e19fa307 Change-Id: I5f66ff289631c056eecebe40926bf321d283eea7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QAssociativeIterableImpl::advanceImpl(): remove deprecation protectionEdward Welbourne2020-07-211-3/+0
| | | | | | | | The comment claims it is needed for "the deprecated QHash::iterator::operator--()", which has been removed already. Change-Id: I90f5abdcd14e6cac4ed7144e96eb26bf34477391 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Use QList instead of QVectorJarek Kobus2020-07-091-4/+3
| | | | | | Task-number: QTBUG-84469 Change-Id: Ia365c958e3b2d0c8210f5d693d907bb2012887c2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Automatically register comparison operators in QMetaTypeFabian Kosmale2020-07-081-86/+64
| | | | | | | | | | | | | | | | | This removes the fully manual registration of comparison operators in QMetaType and replaces it with an automatic registration through Q_DECLARE_METATYPE(). [ChangeLog][QMetaType] The QMetaType::registerComparator() and QMetaType::registerEqualsComparator() have been removed. Q_DECLARE_METATYPE() now automatically registers any operator==() and/or operator<() for a type visible where it is used on that type, as part of declaring its meta-type. Change-Id: I3df451b652b735c093533838bf32f3cc785439f8 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add ; to Q_UNUSEDLars Schmertmann2020-07-071-1/+1
| | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Remove unnecessary ; after function implementationsLars Schmertmann2020-07-061-1/+1
| | | | | | Task-number: QTBUG-82978 Change-Id: Iea3bcaec1ef9f4bd0f73e5dccca33354650f5bf4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Move implementation of QVector/List back to qlist.hLars Knoll2020-06-201-5/+5
| | | | | | | | | | | | | And name the main class QList. That's also the one we document. This gives less porting pain for our users, and a lot less churn in our API, as we use QList in Qt 5 in 95% of our API. In addition, it gives more consistent naming with QStringList and QByteArrayList and disambiguates QList vs QVector(2|3|4)D. Fixes: QTBUG-84468 Change-Id: I3cba9d1d3179969d8bf9320b31be2230d021d1a9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port Q_STATIC_ASSERT(_X) to static_assertGiuseppe D'Angelo2020-06-191-7/+7
| | | | | | | | | | | | | | | | | There is no reason for keep using our macro now that we have C++17. The macro itself is left in for the moment being, as well as its detection logic, because it's needed for C code (not everything supports C11 yet). A few more cleanups will arrive in the next few patches. Note that this is a mere search/replace; some places were using double braces to work around the presence of commas in a macro, no attempt has been done to fix those. tst_qglobal had just some minor changes to keep testing the macro. Change-Id: I1c1c397d9f3e63db3338842bf350c9069ea57639 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make the default constructor of QMetaType constexprLars Knoll2020-06-161-2/+2
| | | | | | | And inline the copy constructor forwarding to another one. Change-Id: I3c4f76f7b14edd84f512ef0687416b20940e333a Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Long live std::pair!Giuseppe D'Angelo2020-06-101-14/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make QPair an alias for std::pair, and qMakePair just a forwarder towards std::make_pair. Why? Fundamentally to ditch a bunch of NIH code; gain for free structured bindings, std::tuple and std::reference_wrapper compatibility, and so on. Breakages: * Some that code manually forward declares QPair. We don't care about it (<QContainerFwd> is the proper way). * Some code that overloads on std::pair and QPair. Luckily it's mostly centralized: debug, metatypes, testing macros. Just remove the QPair overload. * Usages of qMakePair forcing the template type parameters. There are a handful of these in qtbase, but only one was actually broken. * std::pair is NOT (and will never likely be) trivially copiable. This is agreed to be a mistake done by practically all implementations in C++11, can can't be fixed without breaking ABI. Some code using QPair assuming it's trivially copiable may break; exactly one occurrence was in qtbase. * QMetaType logic extracts the type names in two different ways, one by looking at the source code string (e.g. extracted by moc) and one via some ad-hoc reflection in C++. We need to make "QPair" (as spelled in the source code) be the same as "std::pair" (gathered via reflection, which will see through the alias) when compared. The way it's already done e.g. for QList is by actually replacing the moc-extracted name with the name of the actual type used in C++; do the same here. On libc++, std::pair is actually in an inline namespace -- i.e. std::__1::pair; the reflection will extract and store "std::__1::pair" so we need an ad-hoc fix to QMetaType. [ChangeLog][QtCore][QPair] QPair is now an alias to std::pair, and does not exist as a class in Qt any more. This may break code such as functions overloaded for both QPair and std::pair. Usually, the overload taking a QPair can be safely discarded, leaving only the one taking a std::pair. QPair API has not changed, and qMakePair is still available for compatibility (although new code is encouraged to use std::pair and std::make_pair directly instead). Change-Id: I7725c751bf23946cde577b1406e86a336c0a3dcf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* metatype: Do not try analyze T in Q*Pointer<T> if T is incompleteFabian Kosmale2020-06-091-1/+19
| | | | | Change-Id: I41737ce470f6d2b071ad5e85f8cad1da3869241c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Use static function instead of lambda to workaround a MSVC compiler bugFabian Kosmale2020-06-081-58/+70
| | | | | | | | | | | | The seemingly useless template parameters are needed to avoid a (distinct) bug in MSVC 2019 < 16.6, and should be removed once we have a newer version in the CI. Task-number: QTBUG-82945 Fixes: QTBUG-83600 Change-Id: I5b22a2259aa16ae90eca7d4f3bd2e4fa1116a73b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QMetaType: create metatype for voidFabian Kosmale2020-06-021-8/+22
| | | | | | | | | | | Create a QMetaTypeInterface for void. This allows us differentiate QMetaType::Unknown from QMetaType::Void. In addition, this will enable the usage of QMetaMethod::metaReturnType in QMetaMethod::returnType, and will facilitate using metaReturnType in declarative, which needs to distinguish between Unknown and Void. Change-Id: I83296b49587f3deb7ec73e25a33f0d8c98cf8da0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* MetaObject: Store the QMetaType of the methodsFabian Kosmale2020-06-021-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | This does the analog of 46f407126ef3e94d59254012cdc34d6a4ad2faf2 for the methods we care about (signals, slots, Q_INVOKABLEs). In addition to the actual QMetaType, we store an array with offsets so that we later can do a mapping from methodIndex to metatype. The newly added QMetaMethod::{return,parameter}MetaType methods can then be used to retrieve the metatypes. This does however require that all involved types are complete. This is unfortunately not a feasible requirement. Thus, we only populate the metatype array on a best effort basis. For any incomplete type, we store QMetaType::Unknown. Then, when accessing the metatype, we fall back to the old string based code base if it's Unknown. Squashes "moc: support incomplete types" and "Fix compile failures after QMetaMethod change" Fixes: QTBUG-82932 Change-Id: I6b7a587cc364b7cad0c158d6de54e8a204289ad4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QMetaType: Support char16_t and char32_tFabian Kosmale2020-05-151-1/+4
| | | | | Change-Id: Ieec6d4bc64967d875ea12b31638aab05bc682ea3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove QRegExp from QVariantLars Knoll2020-05-141-2/+1
| | | | | | | | | | | | | | | | Add an operator QVariant() to QRegExp to keep things at source compatible as possible. Add a hack to QVariant::load/save() to recognize the old typeid for QRegExp and stream them correctly as long as the streaming operators for QRegExp are registered. Also move the datastream test for QRegExp to tst_qregexp, and adjust it to the qvariant changes. Change-Id: I120b38a7541b43ec07a21b17f7f35c55f071eb75 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix assigning int QFlag-type propertiesFriedemann Kleint2020-04-221-2/+11
| | | | | | | | | | | Ensure they are handled as enumerations in QMetaType. This is required for handling QFlag-type properties in Qt Designer Fixes: QTBUG-83689 Change-Id: Ifbfb5c5b5cd34fce462e299505d063e22e725c2e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-081-0/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/opengl/doc/src/cube.qdoc src/corelib/global/qlibraryinfo.cpp src/corelib/text/qbytearray_p.h src/corelib/text/qlocale_data_p.h src/corelib/time/qhijricalendar_data_p.h src/corelib/time/qjalalicalendar_data_p.h src/corelib/time/qromancalendar_data_p.h src/network/ssl/qsslcertificate.h src/widgets/doc/src/graphicsview.qdoc src/widgets/widgets/qcombobox.cpp src/widgets/widgets/qcombobox.h tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro tests/manual/diaglib/debugproxystyle.cpp tests/manual/diaglib/qwidgetdump.cpp tests/manual/diaglib/qwindowdump.cpp tests/manual/diaglib/textdump.cpp util/locale_database/cldr2qlocalexml.py util/locale_database/qlocalexml.py util/locale_database/qlocalexml2cpp.py Resolution of util/locale_database/ are based on: https://codereview.qt-project.org/c/qt/qtbase/+/294250 and src/corelib/{text,time}/*_data_p.h were then regenerated by running those scripts. Updated CMakeLists.txt in each of tests/auto/corelib/serialization/qcborstreamreader/ tests/auto/corelib/serialization/qcborvalue/ tests/auto/gui/kernel/ and generated new ones in each of tests/auto/gui/kernel/qaddpostroutine/ tests/auto/gui/kernel/qhighdpiscaling/ tests/libfuzzer/corelib/text/qregularexpression/optimize/ tests/libfuzzer/gui/painting/qcolorspace/fromiccprofile/ tests/libfuzzer/gui/text/qtextdocument/sethtml/ tests/libfuzzer/gui/text/qtextdocument/setmarkdown/ tests/libfuzzer/gui/text/qtextlayout/beginlayout/ by running util/cmake/pro2cmake.py on their changed .pro files. Changed target name in tests/auto/gui/kernel/qaction/qaction.pro tests/auto/gui/kernel/qaction/qactiongroup.pro tests/auto/gui/kernel/qshortcut/qshortcut.pro to ensure unique target names for CMake Changed tst_QComboBox::currentIndex to not test the currentIndexChanged(QString), as that one does not exist in Qt 6 anymore. Change-Id: I9a85705484855ae1dc874a81f49d27a50b0dcff7
| * QSequentialIterable: Treat sets as appendableFabian Kosmale2020-03-181-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QSet and std::(unordered_)set were so far not treated as appendable, as they lack a push_back method. We do however need support for this in declarative to enable converting back from QJSValue arrays to sets. We achieve this by testing for and using the insert method. While vector has also such a method, it doesn't take a single value, but rather a position or iterator + value, so the template specialization is not ambiguous. Task-number: QTBUG-82743 Change-Id: I74fc7b1b856d9bcd38100b274ba2b69578ea8bbb Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Revert "QMetaType: support manual unregistration"Simon Hausmann2020-03-271-3/+0
| | | | | | | | | | | | | | | | | | This reverts commit cf000d080c61cde44bd84e53ee018f36e33b7257. Reason for revert: This API is not needed (anymore) by qtdeclarative. Change-Id: I8af604c2babe3afc11f183ddb3ce3a9038a456ad Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | QMetaType: Do copy constuctible check at compile timeFabian Kosmale2020-03-251-1/+1
| | | | | | | | | | Change-Id: I2f6a9bbaa0153fa33fc6a0b68bcedfbe3b9b1a7c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QMetaType::fromType: support classes with inaccessible dtorsFabian Kosmale2020-03-251-1/+4
| | | | | | | | | | Change-Id: I60a1b2496d48651a8166173b420da37f59d7a395 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Remove garbageLars Knoll2020-03-181-1/+1
| | | | | | | | | | Change-Id: Ie0b891b9e9c6d12d8684c85a7717d0828fcf1c0c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Fix compilation with -no-feature-regularexpressionEskil Abrahamsen Blomfeldt2020-03-171-1/+8
| | | | | | | | | | | | | | | | | | This -no-feature has probably not been tested for a while and seems to have rotted a bit, both some unprotected uses and some warnings on unused parameters. Change-Id: Ie20a06c78d3b4c36860dab49d6615eaa8ffc9077 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Fix typoSimon Hausmann2020-03-101-3/+3
| | | | | | | | | | Change-Id: I4923efb537c1d1b5778bf97955dbf247eaa6220a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Remove template leftoverFabian Kosmale2020-03-101-1/+0
| | | | | | | | | | | | | | | | | | | | | | Amends 33cd680ddbaccf6139e215d851a39e657ae36394, which removed the Qt5CompatiblityHook class. However, the template line above it was not removed, and now applied to isBuiltinType. As that function should not be a template, we remove it now. Change-Id: If8e276daebce5480b59d9c21b049818f9a46ec98 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | MSVC: Suppress warning C4910 for exported extern templatesMårten Nordheim2020-03-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Warnings like the following started showing up in dev after 3c0cd7566cf858d0fd23fecad5ef9faec798cf5f. Not a problem in CI but it is treated as an error in develop-builds, suppress them for now since it still manages to build. warning C4910: 'QtPrivate::QMetaTypeForType<bool>': '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation Amends 3c0cd7566cf858d0fd23fecad5ef9faec798cf5f Task-number: QTBUG-82403 Change-Id: I1ee6731afafd4636102a49555d4d892f39a21bc7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QMetaType: support manual unregistrationFabian Kosmale2020-03-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QtDeclarative registers types in plugins, and supports un- and reloading those plugins. Those types would leave pointers to unmapped memory in the type registry on macOs, which would later cause crashes. We therefore add private API to manually remove the types from the registry, which can then be used in declarative. Lastly, as a precaution for re-registering the types, we reset QMetaTypeInterface::typeId to 0, as the memory is most likely not reset to 0 when reloading the plugin. Change-Id: Ic3fc08759f3d4481dca44a91b33baf3ea9e7198e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Get rid of QMatrixJarek Kobus2020-02-281-2/+1
| | | | | | | | | | | | Task-number: QTBUG-81628 Change-Id: Iad66bfdf49b9ee65558a451108c086fc40dc3884 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | MetaObject: store the QMetaType of the propertiesOlivier Goffart2020-02-251-0/+5
| | | | | | | | | | Change-Id: I563e7232b70e94de4184f2c23a581319313dcf5c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Use the new QMetaType API in QVariantOlivier Goffart2020-02-251-1/+4
| | | | | | | | | | Change-Id: I5495ee1159864ebd64083fadbfac7e07177ed406 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix crashes with MSVC 2019Olivier Goffart2020-02-251-2/+2
| | | | | | | | | | | | | | | | | | Apparently the compiler bug causing MSVC to mix lambdas is not fixed in MSVC 2019 Fixes: QTBUG-82405 Change-Id: Ifafde3497ff264cda931ebfba79fcef1d5130510 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Export an extern template for QMetaTypeForType for builtin typesOlivier Goffart2020-02-201-0/+18
| | | | | | | | | | | | | | | | That way not every translation unit generates the QMetaTypeInterface for the builtin types Change-Id: Id703c14532646a58f4088e8f3914564ce35e398e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Normalize types at compile timeOlivier Goffart2020-02-201-15/+349
| | | | | | | | | | | | | | | | | | | | This also fix the normalization algorithm: - Some 'const' after pointers were not removed as they should. - No need to keep the space in '> >' and '< :' in C++11 anymore - Fix normalization of 'long unsigned int' and similar Change-Id: I2b72f0fede96c1063e7b155d9f25a85fccfc7bf9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | New QMetaType representationOlivier Goffart2020-02-201-257/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the QMetaType is represented as a pointer to a "vtable" in the form of a QtPrivate::QMetaTypeInterface* The recomanded use of QMetaType is to construct an object with QMetaType::fromType. This does not require any registration. There is still an id() function which will do some registration for compatibility with Qt5. Also the patch does not really touch the other extra things that can be registered (data stream operator, comparison operator, iteratable, ...) and this still uses the previous system. This is only the change in QMetaType, other changes to use it in QVariant and QMetaObject will follow Change-Id: Iffad20085cf33f33447f58a68236013a8b60fdbf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devLiang Qi2020-02-131-8/+80
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/widgets/graphicsview/boxes/scene.h src/corelib/Qt5CoreMacros.cmake src/corelib/Qt6CoreMacros.cmake src/network/ssl/qsslsocket.cpp src/network/ssl/qsslsocket.h src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp src/testlib/CMakeLists.txt src/testlib/.prev_CMakeLists.txt tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp Disabled building manual tests with CMake for now, because qmake doesn't do it, and it confuses people. Done-With: Alexandru Croitor <alexandru.croitor@qt.io> Done-With: Volker Hilsheimer <volker.hilsheimer@qt.io> Change-Id: I865ae347bd01f4e59f16d007b66d175a52f1f152
| * Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-01-291-8/+80
| |\ | | | | | | | | | Change-Id: I98b1a5a11ece3957a1115c1d9be8841759206ffe
| | * QSequentialIterableImpl: support appendFabian Kosmale2020-01-151-8/+80
| | | | | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-80916 Change-Id: I87e74da0ce454e56b5fe94d9db3693a587d35edf Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-01-281-3/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsettings.cpp src/corelib/kernel/qvariant.cpp src/corelib/serialization/qjsoncbor.cpp src/corelib/serialization/qjsonvalue.cpp src/corelib/tools/tools.pri src/gui/image/qimage.cpp src/gui/kernel/qguivariant.cpp src/widgets/kernel/qshortcut.cpp tests/auto/tools/moc/allmocs_baseline_in.json tests/auto/tools/moc/tst_moc.cpp src/opengl/qglframebufferobject.cpp Done-With: Edward Welbourne <edward.welbourne@qt.io> Done-With: Leander Beernaert <leander.beernaert@qt.io> Change-Id: Ie7f5fa646c607fe70c314bf7195f7578ded1d271
| * | Register QColorSpace as a QtGui metatypeAllan Sandfeld Jensen2020-01-251-3/+4
| | | | | | | | | | | | | | | | | | | | | Helps pass it through QVariant, and needed for QML support. Change-Id: Id161ff9b8f81ad55a7ee7a7c4c614bdf74bca4a1 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | | Remove a bunch of code maked for removalOlivier Goffart2019-12-141-9/+0
| | | | | | | | | | | | | | | Change-Id: I1bda415433b748a1b8408ef3b890a6de3e51b3ba Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-12-091-1/+13
|\| | | | | | | | | | | Change-Id: Ia24cc8b86def0d9d9c17d6775cc519e491b860b1
| * | QMetaType: add more static-less APIOlivier Goffart2019-12-071-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In prevision to Qt6 which is going to discourrage the use of the integer id, add some missing API to the staticless QMetaType API: - Add a way to construct a QMetaType from a type without calling qMetaTypeId: QMetaType::fromType<T>() - Add equality operators - Add a QMetaType::name() function - Add a default constructor (by adding a default parameter to the existing ctor) Change-Id: I95487c1c31bdf0d773717daa9d5452cbced30673 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-11-301-0/+3
|\| | | | | | | | | | | Change-Id: Icbb60f8c1891ec2779575276495199ace9d3d6c3
| * | Silence MSVC build of Qt for PythonFriedemann Kleint2019-11-291-0/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enclose QAssociativeIterableImpl::advanceImpl within QT_WARNING_DISABLE_DEPRECATED, fixing numerous warnings: MSVC\14.23.28105\include\xutility(727): warning C4996: 'QHash<QString,QVariant>::const_iterator::operator --': was declared deprecated include\QtCore\../../src/corelib/tools/qhash.h(432): note: see declaration of 'QHash<QString,QVariant>::const_iterator::operator --' include\QtCore\../../src/corelib/kernel/qmetatype.h(1217): note: see reference to function template instantiation 'void std::advance<QHash<QString,QVariant>::const_iterator,int>(_InIt &,_Diff)' being compiled with [ _InIt=QHash<QString,QVariant>::const_iterator, _Diff=int ] include\QtCore\../../src/corelib/kernel/qmetatype.h(1253): note: see reference to function template instantiation 'void QtMetaTypePrivate::QAssociativeIterableImpl::advanceImpl<T>(void **,int)' being compiled with [T=QVariantHash] include\QtCore\../../src/corelib/kernel/qvariant.h(793): note: see reference to function template instantiation 'QtMetaTypePrivate::QAssociativeIterableImpl::QAssociativeIterableImpl<QVariantHash>(const T *)' being compiled with[T=QVariantHash] Amends dbb54805f63f9ed68d84fe090d608872f16170d2. Change-Id: Ieb875eaa943100ce1941cb1473b35892330c3889 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Fix up parts of the QList related docsLars Knoll2019-10-301-0/+1
| | | | | | | | | | | | | | | | Remove the class docs for QList and make it point to QVector. Adjust containers documentation and replace QList with QVector in there. Change-Id: I37f712d91b21ad78e017faf9d71cac66f64440b0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix all tst_qmetatype breakages after QList to QVector aliasingJędrzej Nowacki2019-10-301-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt6 QList is just a typedef to QVector. To keep Qt5 behavior compatibility we need to register aliases, otherwise some type name based operations would not work. The patch adds automatic registration of QList metatype alias for every QVector. The patch doesn't cover usage of already typedef'ed and aliased QList and QVector, but that should be quite esoteric, especially after introduction of automatic QList and QVector type registration. Change-Id: I84672dda2b159d94e76cdc6034861e7d7ef52533 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Make QList an alias to QVectorLars Knoll2019-10-301-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This is almost 100% source compatible with Qt 5. Exceptions are * Stability of references for large or non movable types * taking a PMF for types that are now overloaded with r-value references in QVector * The missing prepend optimization in QVector (that is still planned to come for Qt 6) Change-Id: I96d44553304dd623def9c70d6fea8fa2fb0373b0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Move QListSpecialMethods over to QVectorLars Knoll2019-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend QVector with special methods for QByteArray and QString, just as QList had them in Qt 5. This also means that QStringList and QByteArrayList are now implemented through a QVector, not a QList anymore. QListIterator<QString> is now slightly source incompatible as QStringList is a QVector, but that will be fixed in a follow-up change when QList<QString> will start mapping to a QVector. Change-Id: I7cfb8a72d4d95b347bbd386892f244b7203b41c2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QShortcut: Properly port to the new configure systemFriedemann Kleint2019-10-251-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the feature to corelib so that the QMetaType enumeration values can be properly excluded and there is no need for a dummy class. Use QT_REQUIRE_CONFIG in the headers of classes to be disabled. Add headers/source files in the .pro file depending on the configure feature in libraries and tests. Add the necessary exclusions and use QT_CONFIG. Task-number: QTBUG-76493 Change-Id: I02499ebee1a3d6d9a1e5afd02517beed5f4536b7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>