summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qmetaobjectbuilder.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QMetaObjectBuilder: Fix detecting enum properties from QMetaTypeFriedemann Kleint2025-10-201-1/+1
| | | | | | | | | Fix condition wrongly inverted by dd95d5126ce9e022dfd25f0f44ee0f2a9e50f45e. Fixes: PYSIDE-3217 Pick-to: 6.10 Change-Id: I3c30541617a90ac32020aaddfca79024ba1ba351 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QMetaObjectBuilder: add assert to setParameterNames()Ahmad Samir2025-09-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amends 58b4be482cb481addebc966d713bc0521cca3218; we have: QList<QByteArray> paramNames = method.parameterNames; The above commit changed the code from: while (paramNames.size() < paramCount) paramNames.append(QByteArray()); for (int i = 0; i < paramCount; ++i) To: if (paramNames.size() < paramCount) // (paraphrased for brevity) paramNames.resize(paramCount); for (auto &foo : paramNames) Calling something like this: methodBuilder = builder.addSlot("foo(int)"); methodBuilder.setParameterNames({"", "i"}); Worked with the code before that commit, where it just used the first element in `paramNames` and didn't look at the second one at all. The new for-loop, `for (auto &foo : paramNames)`, iterated paraNames.size() times, which led to the `dataIndex` being off by one. Which would eventually hit an assert in buildMetaObject(): Q_ASSERT(!buf || dataIndex == pmeta->propertyData); Friedemann Kleint debugged the issue in the bug report, so this patch applies his suggestion of adding an assert in setParameterNames(), right where the bug actually happens, because the assert in buildMetaObject() makes it hard to connect the dots and fix the actual bug in user code. Fixes: QTBUG-139845 Pick-to: 6.10 Done-with: Friedemann Kleint <Friedemann.Kleint@qt.io> Change-Id: Icd355241834396c1c8659df621d0f785ef0cceee Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaObject: un-export isBuiltinType() and make it file-staticAhmad Samir2025-07-311-6/+3
| | | | | | | | | | | | As pointed out in code review, nothing uses it except qmetaobjectbuilder.cpp. The method in the MOC's generator.cpp has been changed, so the comment isn't correct anymore. Pick-to: 6.10 Change-Id: Ibe1633eef905053488b443bd0c9f62d11f24abc1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaStringTable: optimize inserting elements into the hash tableAhmad Samir2025-07-311-9/+8
| | | | | | | | | | | | | Prevent double lookup in the hash table. When inserting QBAVs returned from QMetaMethodBuilderPrivate::parameterTypes() into the table use QByteArray::fromRawData(), those views will outlive the `strings` table local variable. Pick-to: 6.10 Change-Id: I3a4dc4d7608e49da09fcc39056a608726fdd8e80 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaMethod: change parameterTypes() to return a list of QBAVAhmad Samir2025-07-301-21/+29
| | | | | | | | | These are views on the `signature` QByteArray data member, so should be safe to use. Pick-to: 6.10 Change-Id: I92f490585944f367cb776881094ce98c64e1a20d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaObjectPrivate: de-duplicate method signature parsing codeAhmad Samir2025-07-301-1/+7
| | | | | | Pick-to: 6.10 Change-Id: I3a6b98c3f6d3f56e54ef9184945c27ccf0f23bed Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaObjectBuilder: Fix isRequiredFabian Kosmale2025-07-091-1/+1
| | | | | | | | | | | | | | There was a copy&paste error, which wasn't caught because the test wasn't precise enough, and the actual use case in qtdeclarative doesn't need to query the builder. Fix that, and adjust the test to verify that setting and querying all flags does report everything as set. Amends 2b41b6fedeca030e0038277f78d9023d13582797 Change-Id: Iab5186d4f8aff91afc406587cc4eb11c969c4c84 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaObjectBuilder: Support setting the required flagFabian Kosmale2025-07-041-0/+20
| | | | | | | | | | | | This is needed to properly represent QML defined properties in the QMetaObject. As a drive-by, do the sanity check in tst_metaobjectbuilder not only for required, but also for the bindable flag. Task-number: QTBUG-98846 Change-Id: I8ea894a589ec91a67fcbdb90ae35a4a0faedc662 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Copy const attribute of method in QMetaObjectBuilder::addMethod()Dheerendra Purohit2024-12-171-1/+2
| | | | | | | | | | | | const attribute of prototype object method in QMetaObjectBuilder::addMethod() is not copied. auto test failed due to this missing functionality. Copy const attribute of method in QMetaObjectBuilder::addMethod() from prototype object. Task-number: QTBUG-126849 Change-Id: Iaa4042c2ac50c57eacb6b9821163488d82f7a0be Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaMethodBuilder: limit the bits of attribute()/setAttribute()Thiago Macieira2024-10-291-3/+5
| | | | | | | Pick-to: 6.8 Change-Id: I2d680563e65be28666f5fffd6aac927fd40c6b5d Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QMetaObjectBuilder: Fix construction logic for enumsFabian Kosmale2024-10-081-6/+13
| | | | | | | | | | | | | We need to put metatypes in the correct place; this is especially vital starting with Qt 6.9, given that we need it to query it to figure out whether we have a 64bit value or not. As a drive-by, replace some ugly casting when constructing the meta-type array with a call to QMetaType::iface. Pick-to: 6.8 Change-Id: I4b1f42f974e9f7a21f6aa4c87c3f8919f6965d6e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QMetaObjectBuilder: fix \include snippet nameMarc Mutz2024-10-081-1/+1
| | | | | | | | | | | | | | | | There's only qmetaenum-32bit-signextend-64bit, no qmetaenum-32bit-zeroextend-64bit. Fixes qdoc warning: Cannot find 'qmetaenum-32bit-zeroextend-64bit' in 'qmetaobject.cpp' Amends f85a17abeb1e9464492eb57cbb772683d6c8093d. Task-number: QTBUG-111926 Change-Id: I5083d867e102fccbcd641fae5df3b47ba566a742 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaObjectBuilder: add support for 64-bit flags and enumsThiago Macieira2024-10-041-29/+119
| | | | | | Task-number: QTBUG-111926 Change-Id: I8a96935cf6c742259c9dfffd17e9519aa2540313 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QMetaMethod: make some QByteArray-returning methods slightly fasterThiago Macieira2024-10-031-1/+1
| | | | | | | | | | | | | | | | | | | QByteArray::fromRawData() allocates no memory. Since we know that the data range is valid, there's no precondition violation either. But we can only use it for static-lifetime meta objects: those constructed by QMetaObjectBuilder or QtDBus may get deallocated, causing the strings obtained from them to crash on use if they do outlive (unlikely, but not impossible). To differentiate, this commit introduces a new flag to the QMetaObject header and makes use of it in those two places. Come Qt 7, we should change these functions to return QByteArrayView, making the retention of the data in a QByteArray the responsibility of the user. Making the change right now with #if or QTx_ONLY() is ugly, so this commit just leaves a comment. Change-Id: I5aaddbc7ce3fc7a70e15fffd29e276c79d5ef6e4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* moc & QMetaObject: move the QMetaMethod revision informationThiago Macieira2024-09-211-38/+30
| | | | | | | | | | | | | | | | | | | | | Instead of storing them as an array for every single method (some of which may not have revisions) at a different location in the uint array, store the revision after the parameter type and name lists, in the usual place. This is not implemented for the old integer table in moc, because it's going away. [ChangeLog][Important Behavior Changes] With Qt 6.9, the layout of the meta object data table changed incompatibly for classes containing meta methods (signals, slots) marked with Q_REVISION. This is marked by the presence of revision 13 or later. Code that reads or writes the meta object's raw data directly instead of using QMetaMethod must detect the new layout. Change-Id: I8a96935cf6c742259c9dfffd17e97a2530b52b3e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* moc & QMetaObject: move the constants to a public-ish headerThiago Macieira2024-08-141-2/+2
| | | | | | | | This is like qtmochelpers.h, but contains no code so can be used in moc itself. Added because I will need to use the constants in moc. Change-Id: I8a96935cf6c742259c9dfffd17ea660cad72a36d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QMetaObjectBuilder: Avoid arithmetic on null pointerFabian Kosmale2024-01-191-2/+2
| | | | | | | | | | | | In Prepare mode, "buf" is a null pointer. We never dereference it, but we still compute an offset from it to obtain a pointer to a (then unused) QMetaObjectPrivater. clang's UBSan complains about this, so initialize the pointer to nullptr instead when in Prepare mode. Pick-to: 6.7 6.6 6.5 Change-Id: Id9d78058f72bb1b44440d07f565374f3eb3c20fd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* moc: Record types of enumerationsUlf Hermann2023-03-311-1/+28
| | | | | | | | | | | This will be helpful in a number of places, in particular in order to support enums of different sizes in QML. We record the type as string in the JSON output and as QMetaTypeInterface in the generated C++. Task-number: QTBUG-112180 Change-Id: I943fac67f8b25b013d3860301416cdd293c0c69e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix for a duplicate macro definitionAmir Masoud Abdol2023-02-211-0/+3
| | | | | | | | | | | ALIGN was conflicting with a system macro, /SDKs/MacOSX13.1.sdk/usr/include/arm/param.h. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ia460ee781f8bd1a1cdcff0371efab784c9eebb57 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QtCore: Disambiguate static variablesFriedemann Kleint2023-02-021-3/+3
| | | | | | | | | They cause clashes in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I5f1fbee07872a742a78adc9864fe00c710ca24d0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaObject: add revision 11 for Qt 6.5Thiago Macieira2022-08-251-1/+1
| | | | | | | | | | | | | | | We changed qTryMetaTypeInterfaceForType() so it does record void and void* (see commit 2d0c31e7d92a3e9df4ce2b9c1d41b94fb12735fc and commit 3695b35dfc427f274e55f8e2a6a9876deb52f1b4). By incrementing the revision number, we make it possible to determine at runtime whether the new information ought to be present. We may add even more types (namely, non-const references) before 6.5.0 is out. For pointers, the restriction remains that the metatype is recorded only if the pointer is a pointer to a complete type. Change-Id: Ic6547f8247454b47baa8fffd170dad79b1a90f6b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QMetaObjectBuilder: Always set Data::metatypesFabian Kosmale2022-03-021-27/+25
| | | | | | | | | | | The array of metatypes should always contain at least one entry (for the metatype of the current metaobject itself). This prevents crashes in the case of a metaobject without meta-methods and properties (as observed in Qt for Python). Pick-to: 6.2 6.3 Change-Id: I7a6fb316eea48c4852b6f1c26e0a930aeba4c799 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QMetaObjectBuilder: fix addProperty() recording of the property typeThiago Macieira2022-02-161-1/+1
| | | | | | | | | | | | Issue introduced by commit 465701bb98f3c3454d15c22b8e38ab4ad8821dfc. [ChangeLog][QtCore][QMetaObjectBuilder] Fixed a bug that would cause addProperty() to use the incorrect type for the property if the property's name matched a valid type registered with QMetaType. Pick-to: 6.2 6.3 Change-Id: Ic15405335d804bdea761fffd16d402f2c9611f30 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Deduplicate offset calculation in QMetaObjectBuilderIvan Tkachenko2021-07-271-1/+1
| | | | | | | | | | | | Not even an optimization (unless your compiler sucks). Just improves readability, since offset is already calculated few lines above. Offset formula used to be somewhat more complicated, but since commit e58b44d557b859b7b55869f1e137aa1bc8968307 it became reusable here. Change-Id: I4128b2643daf2cb112c9b861342fd0e27c9a1a95 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QMetaObjectBuilder: replace an int with QFlagsGiuseppe D'Angelo2021-05-131-3/+3
| | | | | | | | | The int was used as a flag the entire time, except in one stance. So just use the right QFlags type instead, and replace that one usage with a call to toInt(). Change-Id: I3670e6afdc244df69189dd15b8c2c34573476e2f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaMethod: Store method constness in metaobject systemFabian Kosmale2021-05-071-0/+22
| | | | | | | | | [ChangeLog][QtCore][QMetaMethod] It is now possible to query the constness of a method with QMetaMethod::isConst. Change-Id: I8a94480b8074ef5b30555aeccd64937c4c6d97d4 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Silence MSVC warning about int/size_t mismatchVolker Hilsheimer2021-05-061-2/+2
| | | | | | | | | | | | | | | Warning was qmetaobjectbuilder.cpp(1439): warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data Instead of adding another cast in that line, fix the warning by making the size variable a qsizetype, and remove the now unnecessary static_cast to int. Pick-to: 6.1 Change-Id: Ieff9330501f5a07c4bbe1e851a3ef211f8bf2d24 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Introduce QMetaObject::metaTypeFabian Kosmale2021-03-251-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This function returns the metatype corresponding to the metaobject, or an invalid metatype for namespaces. This works as follows: First we increment the metaobject revision for new metaobjects. Metaobjects with older revisions are handled by doing a lookup by name. That fallback is also used for dynamic metaobjects (from QtDBUS and those created by QMetaObjectBuilder). For new metaobjects, we store the metatype in its metatype array, behind the property metatypes. This avoids any changes to the property and method metatype extraction logic: For properties, the metatype access does not change, as the new metatype is after their metatypes. For method metatypes, we already have an indirection layer (using offsets), so by adjusting those offsets by one, the same logic keeps working. To distinguish between namespaces and dynamic metaobjects, namespaces store the metatypeinterface pointer for void in the metatype array, whereas dynamic metaobjects store a nullptr. One nice additional benefit is that this simplifies the generator logic in moc, as the metatype array is now never empty. Task-number: QTBUG-92077 Change-Id: Id3f920f28553f12032a71a1a87dad29e5374dbe7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* QMetaObjectBuilder: remove unused serialization codeFabian Kosmale2021-03-201-268/+0
| | | | | Change-Id: I73a13265a69079581d2974400b3311d3fdfda2d0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaObjectBuilder: use constexpr ifFabian Kosmale2020-12-091-37/+43
| | | | | Change-Id: I23319c263447714b280e9ba9da72162e19fe4e1b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPEAndreas Buhr2020-11-301-3/+3
| | | | | | | | | | | | | | Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with move semantics, its name is misleading. Q_RELOCATABLE_TYPE was introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE in QtBase. As the two are synonymous, this patch should have no impact on users. Pick-to: 6.0 Change-Id: Ie653984363198c1aeb1f70f8e0fa189aae38eb5c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* QMetaProperty::typeName: use name from metatypeFabian Kosmale2020-11-301-7/+8
| | | | | | | | | | | | | | | Except for types marked as unresolved, we're doing it anyway - the only difference is that now we skip looking up the metatype by typeid. [ChangeLog][QMetaProperty][Important Behavior Change] QMetaProperty::typeName returns now always the same name as name() of the corresponding metatype. This can cause a change for enum properties which were not fully-qualified. Change-Id: I1f57743948b7262ac06095d3bbc838d620f6e481 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QMetaObjectBuilder: remove relocatable data supportFabian Kosmale2020-11-301-80/+9
| | | | | Change-Id: I6f1dc9e81723e9a8af8988a8cb45c63c05214296 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QMetaPropertyBuilder: carry metatypeFabian Kosmale2020-11-301-3/+13
| | | | | | | | | | Properties of non-dynamic classes always have the metatype stored, so we can make use of it. Moreover, when the builder is converted into a metaobject, we need to resolve the metatype anyway. As a driveby, add a dedicated metatype test to tst_qmetaobjectbuilder. Change-Id: I7eea0cd8fc2da5d92c7fc803f05cd81e3a9d4cf4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Whitespace cleanup in corelib/kernelAllan Sandfeld Jensen2020-10-241-50/+47
| | | | | Change-Id: If061ef0af5ced4384e20a82afcea3712fa7e45d7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use qmetaobject_p.h's MetaObjectFlag in QMetaObjectBuilderEdward Welbourne2020-10-201-2/+2
| | | | | | | | This saves duplicating them with its own flags. Task-number: QTBUG-85700 Change-Id: I9e938322fd787282cfd9f941f83af8c0d76aaa9d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Replace Q_DECL_UNUSED with [[maybe_unused]]Allan Sandfeld Jensen2020-10-031-1/+1
| | | | | | | Use C++17 attribute directly Change-Id: Id853e7a5117065e4adb549f81303c1820fe198ce Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaPropertyBuilder: support bindable flagFabian Kosmale2020-09-231-0/+21
| | | | | Change-Id: I0d6ad00e49fd5df4c3b9c0692839404d53d8f6ed Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Use C++17 [[maybe_unused]]Allan Sandfeld Jensen2020-09-061-1/+1
| | | | | | | In some places needs to be ordered before const/constexpr though. Change-Id: I57a521ac0ad22b5a018761c4d52befbef69d64c0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Deprecate the static int based API in QMetaTypeLars Knoll2020-08-241-7/+7
| | | | | | | | | | | | | And remove one of the type id to name mapping that still existed in QMetaType. QMetaTypeInterface can provide that, so there's no need to have a second copy of the data. qMetaTypeTypeInternal() can still map all the names of all builtin types to ids. That functionality is for now still required by moc and can't be removed yet. Change-Id: Ib4f8e9c71e1e7d99d52da9e44477c9a1f1805e57 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Another round of 0->nullptr cleanupAllan Sandfeld Jensen2020-07-311-1/+1
| | | | | Change-Id: Ic8db7dc252f8fea46eb5a4f334726d6c7f4645a6 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Fix some MSVC int conversion warningsFriedemann Kleint2020-07-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | kernel\qmetaobjectbuilder.cpp(1279): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data kernel\qmetaobjectbuilder.cpp(1432): warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data sax\qxml.cpp(1275): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data text\qfontsubset.cpp(920): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data text\qfontsubset.cpp(920): warning C4267: 'initializing': conversion from 'size_t' to 'const int', possible loss of data text\qtextengine.cpp(2664): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data text\qtextengine.cpp(2665): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data text\qtextengine.cpp(2706): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data text\qtextengine.cpp(2707): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data itemviews\qbsptree.cpp(60): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) kernel\qprintengine_win.cpp(1558): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data qsql_odbc.cpp(804): warning C4267: 'argument': conversion from 'size_t' to 'SQLINTEGER', possible loss of data qsql_odbc.cpp(822): warning C4267: 'argument': conversion from 'size_t' to 'SQLINTEGER', possible loss of data qsql_odbc.cpp(1585): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data qsql_odbc.cpp(1602): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data qwindowsmime.cpp(770): warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data windows\qwindowsmime.cpp(770): warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data Change-Id: I04fbe17b9782f4c2704933fc005449b1e992475e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use qsizetype in QListLars Knoll2020-07-061-2/+2
| | | | | | | | | | | | | | | | | | | | The change creates a slight source incompatibility. The main things to take care of are * code using printf statements on list.size(). Using qsizetype in printf statements will always require a cast to work on both 32 and 64 bit. * A few places where overloads now get ambiguous. One example is QRandomGenerator::bounded() that has overloads for int, uint and double, but not int64. * Streaming list.size() to a QDataStream will change the format depending on the architecture. [ChangeLog][QtCore][QList] QList now uses qsizetype to index into elements. Change-Id: Iaff562a4d072b97f458417b670f95971bd47cbc6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use QList instead of QVector in corelib implementationJarek Kobus2020-06-291-1/+1
| | | | | | | | Omitting state machine and docs for now. Task-number: QTBUG-84469 Change-Id: Ibfa5e7035515773461f6cdbff35299315ef65737 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Port Q_STATIC_ASSERT(_X) to static_assertGiuseppe D'Angelo2020-06-191-1/+1
| | | | | | | | | | | | | | | | | 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>
* Add some support to flag alias propertiesLars Knoll2020-06-111-0/+23
| | | | | | | | | | | This is required if we want to be able to get rid of the property cache. Also reserve a flag for var properties, in case it turns out that we need to keep the distinction between var and QVariant properties in QML. Change-Id: I55c2191adcc2d94bd8f148216e26423defaa900f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Get rid of the obsolete isEditable flag for propertiesLars Knoll2020-06-111-27/+0
| | | | | | Change-Id: I54411bd8e223671523c9c8fad5c80bfa6b5b7097 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Cleanups in QMetaPropertyFabian Kosmale2020-06-111-67/+12
| | | | | | | | | This changes the layout of the meta object data, so also bump the meta object revision. Original-patch-by: Lars Knoll <lars.knoll@qt.io> Change-Id: I176fb16c207e8ebe59e358e69554be813406232f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Clean up QMetaEnum codeLars Knoll2020-06-111-3/+3
| | | | | | Change-Id: I9c1fcfd72890fb3d69d2d9caed7f3cff931c3ff6 Reviewed-by: Simon Hausmann <hausmann@gmail.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>