aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmltyperegistrar
Commit message (Collapse)AuthorAgeFilesLines
* qmltypes.prf: Take abi into account for *_metatypes.json file namesAlessandro Portale2020-11-261-1/+2
| | | | | | | | | | | | | The lib/metatypes/*_metatypes.json file names contain the ABI. When constructing the qmltyperegistrar command, the right file names with that ABI part need to be passed as "foreign-types". Fixes: QTBUG-85888 Fixes: QTBUG-87117 Change-Id: I20daac1b6b9a27c5ac48b3c2c685e2fed301e213 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit acc5e48a90d0daeccb28175b80ab6b52cac5d84a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmltyperegistrar: Use QString rather than string for stringsUlf Hermann2020-11-121-3/+5
| | | | | | | | All other type names are actual C++ type names. Also, correctly resolve qreal if its type is overridden at configure time. Change-Id: Ia2a1b4309f94e8c72461ee69005b1bdee6337370 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtQml: Integrate sequences with registration macrosUlf Hermann2020-11-114-14/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | You get to write QML_SEQUENTIAL_CONTAINER(value_type) now, and qmltyperegistrar will generate a sensible registration call from that. A registration might look like this: struct MyStringListForeign { Q_GADGET QML_ANONYMOUS QML_SEQUENTIAL_CONTAINER(QString) QML_FOREIGN(MyStringList) QML_ADDED_IN_VERSION(3, 1) }; It's unfortunate that we need to use a metaobject to transfer all of this information, but there is no other sensible way. Transform the containers defined in qv4sequenceobject.cpp to use the new style, and move them out of the builtins, into QtQml. Recognize that only one of them was ever tested, and add tests for the rest. Task-number: QTBUG-82443 Change-Id: I3a30f9e27266bb575eea26c5daf5dad1ec461cc5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltyperegistrar: Add past-major-version optionMaximilian Goldstein2020-11-102-0/+16
| | | | | | | | Adds the option to specify past major versions of modules to be registered. This is necessary for modules that don't export any types themselves to work when built statically. Change-Id: I4b4a379f92707ec64cbb32f91db9d010440b95a2 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
* qmltyperegistrar: Move JSON processing into separate classUlf Hermann2020-11-066-285/+433
| | | | | | | | qmltyperegistrar.cpp was getting unwieldy. Change-Id: I2172253d81c0fca724bb0fef4a96d50a93c47428 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Standardize QJsonArray iterationDavid Skoland2020-10-283-24/+25
| | | | | | | | | When using refs as loop variables, the clang compiler complains (with default settings). This prevents that. Note that QJsonValueRef is used "behind the scenes", which makes this iteration method correct. Change-Id: I5a5f58ca8ad3887bce2009231cbae5a57c107697 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* qml: Move more types into builtins.qmltypesMaximilian Goldstein2020-10-263-9/+3
| | | | | Change-Id: Id2795f16af99870f32266f81228890a9d12c86a7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-10-062-2/+2
| | | | | | | | Modify special case locations to use the new API as well. Task-number: QTBUG-86815 Change-Id: I3b964e3baf0cc7040830156dac30358ea1152801 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* QmlCompiler: Rename QmlStreamWriterUlf Hermann2020-10-054-6/+6
| | | | | | | The names should start with a common prefix. Change-Id: Ib2cc247d459d78de5f0a8ea0be73b89429154475 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Long live libQtQmlCompiler!Ulf Hermann2020-10-055-9/+11
| | | | | | | | Move all the code from tools/shared into src/qmlcompiler and build a static library from it so that we can re-use it in external tools. Change-Id: I7c8d8e59063dc7c711f4072f103a01095e6f5997 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Install public qmake .prf files into the prefix mkspecs dirAlexandru Croitor2020-09-211-0/+9
| | | | | | | | | These are needed for qmake projects. Fixes: QTBUG-86802 Task-number: QTBUG-86498 Change-Id: I09c05a358fa580a3a9eab002c6ada42ad70e999c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Adjust to qtbase changesFabian Kosmale2020-09-041-2/+3
| | | | | | | | | | | | | - isQProperty has been renamed to bindable - QNotifiedProperty is no more - Bindable properties have a function to obtain the QBindable; store that information in the qmltypes files. Task-number: QTBUG-86434 Task-number: QTBUG-86435 Change-Id: I2ba593af1e197d04d2c30cfb9e6904a3d2059e4b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* import Qt namespace in QtQmlFawzi Mohamed2020-08-271-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | Introduces and uses the QML_FOREIGN_NAMESPACE to declare the Qt namespace in QtQml, and exports all the enumerations in the Qt namespace, and makes them available also in QtQml/plugins.qmltypes Please note that this does *not* remove the special QV4::QtObject as it contains much more than the enumerations. Having two object registered as Qt (the complete QV4::QtObject added to the global properties in ExecutionEngine::initializeGlobal, and QtInQml registered by the qmltyperegistrar) gives problems, if the partial one overrides the complete one. For this reason the classinfo QML.ManualRegistration (no public macro until shown to be more generally useful) is introduced and used to ensure that QtInQml generates only documentation (plugins.qmltypes), and no registration that might conflict with QtObject. This makes the current builtins.qmltypes redundant. Fixes: QTBUG-84897 Change-Id: Iffc96cd3e1d9f9d7d047ee60221a4b0928f53005 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltyperegistrar: Fix compilation failureFabian Kosmale2020-07-271-2/+3
| | | | | Change-Id: Id388246d7a1bb12ae1f99a7072ef6ba66a09f8d1 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Restrict qmlRegisterTypesAndRevisions to major version givenUlf Hermann2020-07-161-12/+36
| | | | | | | | | | | We should not register any revisions larger than the given major version as that allows importing an incomplete module, as the version-less import. Typically the offending version is pulled in via some QML_FOREIGN and only the types derived from that foreign class are available in the higher major version. Change-Id: I186fb010d704bea514cefff9f66eb58186df5c91 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Regenerate projectsAlexandru Croitor2020-07-092-2/+4
| | | | | | | | | We need the qt_add_tool changes to successfully configure qemu builds. The rest of the changes are just to be in sync with the .pro files. Change-Id: I7bcc08ac58f57a5761aedef09761428c55235289 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* qmltyperegistrar: Always register version x.0 of the moduleUlf Hermann2020-06-181-2/+7
| | | | | | | | | | If version x.y exists for y > 0, we can assume that version x.0 also exists, even if no types have been specially registered for it. This helps with making empty modules importable. Change-Id: I3f5209db5836fd889b3ebec63fa348b76738a825 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove whitespace for file names generated from TARGETKai Koehne2020-06-021-3/+6
| | | | | | | Task-number: QTBUG-84492 Pick-to: 5.15 Change-Id: Ieeec677634fb6d2f43ba1aeb3432a60cd5502894 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Regenerate qtdeclarative/srcAlexandru Croitor2020-05-292-0/+2
| | | | | | | | | | Includes - renaming of internal plugin api call - generation of QT_QMLTYPES_FILENAME - addition of a few TARGET_DESCRIPTION Change-Id: I72b5647b8c16af9945795ead62a075322b6bb2f6 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* qmltyperegistrar: Preserve isQProperty flag from metatypesUlf Hermann2020-05-281-0/+2
| | | | | | | Task-number: QTBUG-76025 Change-Id: I952afdad6410c3f7ccb05b6c3de77020b30f78d3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* Remove --dependencies option from qmltyperegistrarUlf Hermann2020-05-264-35/+3
| | | | | | | | | | | We don't need to list the dependencies in the qmltypes files. The information given in the qmldir file should be enough. Ultimately, we should get rid of all hidden dependencies. Task-number: QTBUG-84286 Change-Id: Iaf67d476b449215715270043591d8c4858104ea6 Reviewed-by: Christian Kamm <mail@ckamm.de> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Preserve access semantics in qmltypesUlf Hermann2020-05-183-2/+12
| | | | | | | | gadget types are accessed with value semantics, object types are accessed with reference semantics, and namespaces are not accessed. Change-Id: I5eb8f132d729416f28bf94e651f877fc4a9a5c77 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devLiang Qi2020-05-151-7/+19
|\ | | | | | | | | | | | | Conflicts: tests/auto/quick/qquicktextedit/BLACKLIST Change-Id: If1868d27ea40fdc206971c2f7a24e91c5e62b1bf
| * Fix parallel installation of qmltypes in a debug and release buildv5.15.0-rc2Kai Koehne2020-05-071-7/+19
| | | | | | | | | | | | | | | | | | This duplicates the logic in qtbase/mkspecs/features/qml_module.prf to handle this situation (also for Android builds with multiple ABI's). Fixes: QTBUG-84019 Change-Id: I9ccbe4a3a79bb979bd6bb2758adb8c2e1ea7903e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | Register value types declarativelyUlf Hermann2020-04-283-4/+7
| | | | | | | | | | | | | | | | | | For now this has the effect of adding them to the .qmltypes files. In the future, the registration shall actually add additional value types you can declare as properties in QML. Change-Id: Ifee5a8ec054f35cc7bd07eb992a136730be68da7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-172-13/+47
|\| | | | | | | | | | | | | | | Conflicts: src/qmltyperegistrar/qmltypesclassdescription.cpp src/quick/items/qquickrendertarget.h Change-Id: I9e24d2252a35b8e74af89ad72af796df658167ca
| * qmltyperegistrar: Correctly handle foreign and super classesUlf Hermann2020-04-162-13/+41
| | | | | | | | | | | | | | | | | | | | | | Previously, if there were multiple super classes, revisions were only collected for the first one. Also, properties and enums declared in the type itself were ignored when QML.Foreign was specified. Finally, we would previously re-set resolvedClass and re-sort the revisions on each super and attached type. Change-Id: Iccb939cae66a5c4e2e5c312359e389463df80b4e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * qmltyperegistrar: Retain alias and isFlag information for enumsUlf Hermann2020-04-091-0/+6
| | | | | | | | | | | | Change-Id: Id484c7bb1a3ed3b2bf593f6197664e4ee2ad4006 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-095-24/+40
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4executablecompilationunit.cpp src/qml/jsruntime/qv4executablecompilationunit_p.h src/qml/qml/qqmlobjectcreator.cpp src/qml/qml/qqmlpropertycachecreator_p.h src/qml/qml/qqmltypecompiler.cpp src/qml/qml/qqmltypedata.cpp tests/auto/qml/qmlformat/tst_qmlformat.cpp tools/qmllint/scopetree.cpp src/qml/qml/qqmlapplicationengine_p.h Adjusted tools/qmllint/findunqualified.cpp to use newer API Change-Id: Ibfb4678ca39d626d47527265e3c96e43313873d4
| * qmltyperegistrar: Follow the private includes setting in qmltypesUlf Hermann2020-04-062-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | If the file names need to be prepended with "private/" in order to be usable, that also holds for other tools that want to use them. Therefore, also add the prefix to the qmltypes files. We won't have a chance to figure this out again at a later point. Furthermore, don't add file entries for types we cannot register anyway. Change-Id: If04297db419e364f472b8ec627c599c0cbb4ffd9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * qmltyperegistrar: Record header file names in qmltypes filesUlf Hermann2020-03-304-3/+14
| | | | | | | | | | | | | | We will need them to find the types in C++ code. Change-Id: Id00c6d855adbb767a0be8a9469fbe47447ccec8b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * qmltyperegistrar: Accept more file extensions as headersUlf Hermann2020-03-301-8/+11
| | | | | | | | | | | | | | | | Also, even if the file does not appear to be a header, still try to include it. People use strange file names. Change-Id: I2db7bd6aa14007a8b458c3860ba0553bb3b384b7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * qmltyperegistrar: Use target instead of template nameMaximilian Goldstein2020-03-261-1/+1
| | | | | | | | | | | | | | | | | | Due to the fact that multiple targets may be present in the same directory we have to ensure they all get a unique qmltypes. Fixes: QTBUG-82710 Change-Id: I4d7966035644b68f7d3330a4c974369503c48bf2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * qmltyperegistrar: Accept extra foreign types filesUlf Hermann2020-03-261-5/+5
| | | | | | | | | | | | | | | | | | | | | | If you add your own libraries with metatypes, qmake cannot determine where to look for their metatypes.json files. Add a qmake variable that allows the user to specify them. Fixes: QTBUG-82709 Change-Id: I3f5685146c134c89e541e4097ff3928de9af2aee Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Move qmllint's metatype support to tools/sharedUlf Hermann2020-04-013-2/+2
| | | | | | | | | | | | | | | | | | We want to read qmltypes files and analyze scopes also from other tools. Furthermore, restructure the shared directory, so that each tool only includes what it needs. Change-Id: I96a2dcc8b1c5fac613592fb1867bf51fa5ef3a6e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2020-03-125-64/+123
|\ \ | | | | | | | | | | | | | | | | | | | | | Conflicts: dependencies.yaml src/qml/qml/qqmlengine.cpp Change-Id: I6a73fd1064286f4a2232de85c2ce7f80452d4641
| * | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-094-33/+86
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmlirbuilder_p.h src/qml/qml/qqmlpropertycachecreator_p.h src/qmltyperegistrar/qmltypesclassdescription.cpp src/qmltyperegistrar/qmltypesclassdescription.h src/qmltyperegistrar/qmltypescreator.cpp src/quick/items/qquicktext_p.h src/quick/util/qquickvaluetypes_p.h Change-Id: Ic209741592e7b85820bf3845722023a190ebc1c5
| | * qmltyperegistrar: Mark non-QObject types as uncreatableUlf Hermann2020-03-022-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qmlplugindump does so, and in fact they are uncreatable. Also, make qmlTypeRegistrationMode() more robust. Each classDef should really either be an object, a gadget, or a namespace. Change-Id: If39bbbf6f9a4fdb269d095ca10d60ad5d87ca62d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| | * qmltyperegistrar: Correctly collect attached typesUlf Hermann2020-02-253-25/+41
| | | | | | | | | | | | | | | | | | | | | Their revisions were missing from the qmltypes. Change-Id: Iec7a5ad1c56135c761f6a1fe66904cf25d039850 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| | * Provide a way to statically register namespacesUlf Hermann2020-02-251-8/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, qmltyperegistrar would stumble over any QML_* macros in namespaces, as the namespaces could not be used as template arguments. However, namespaces are intended to be usable by QML as uncreatable "types". Now, qmltyperegistrar checks the namespace flag that moc records in the JSON output, and if that is given, registers an uncreatable metaobject instead of a type. Therefore you can use QML_ELEMENT and friends to register namespaces, just like you would register classes (except that they're implicitly uncreatable, of course). Task-number: QTBUG-68796 Change-Id: I186d7e9425471c32fb1a1f29c0c0b946afb2a9d2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * | Remove custom operator<(QTypeRevision, QTypeRevision)Ulf Hermann2020-02-131-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | We have global comparison operators now. Change-Id: I5e7461c8442591f139642379f8889445dfaa8431 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * | Process major versions as part of Q_REVISIONUlf Hermann2020-02-134-20/+24
| | | | | | | | | | | | | | | | | | | | | | | | Retrieve the major version from the meta object revisions and use them to register types and generate qmltypes files. Change-Id: I35da8963457660d1a49ba9063574e1a68057a7ba Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * | Use QTypeRevision for all versions and revisionsUlf Hermann2020-02-035-21/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In many places we carry major and minor versions or revisions that are loosely coupled to minor versions. As the Qt minor version resets now, we need to handle these things more systematically. In particular, we need to add a "major" part to revisions. QTypeRevision can express the current major/minor pairs more efficiently and can also be used to add a major version to revisions. This change does not change the semantics, yet, but only replaces the types. Change-Id: Ie58ba8114d7e4c6427f0f28716deee71995c0d24 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | Regenerate projects to handle private deps correctlyAlexandru Croitor2020-02-052-2/+2
| | | | | | | | | | | | | | | | | | Change-Id: Ifcbab0407e93dfc35d0459d7d29dee2cd3508a86 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | | Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2020-01-291-2/+1
|\| | | | | | | | | | | | | | | | | | | | Conflicts: dependencies.yaml Change-Id: Ie3e9dc62031a85e5e81cbdf04694b95159d49fca
| * | qmltyperegistrar: Sort revisions numerically in qmltypesUlf Hermann2020-01-171-2/+1
| |/ | | | | | | | | Change-Id: I6d4a1c81a7ebad6a97cc2960f6a2eee6a1b4f3c6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Regenerate plugins namesAlexandru Croitor2020-01-291-0/+39
| | | | | | | | | | | | Change-Id: I3e1974f383974787bbfc95e06311c173fb06efdc Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Update qmltypes to use the new metatypes dependency formatLeander Beernaert2020-01-291-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The foreign types list for qmltypesregistrar is now generated by recursively processing the ${targets}_metatypes_dep.txt file. At build time we now use a custom script (Qt6QmlResolveDependencies.cmake) to generate the final foreign types file. qmltypesregistrar has also been updated in order to support the resolution of response files supplied to the command line arguments. Change-Id: Ib61d82fa92bf5d5a24631f461248f81147aad947 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | QML Type Registrar changesLeander Beernaert2020-01-241-0/+1
| | | | | | | | | | Change-Id: I36254a688f575e6c7f717ee4019e4d49f73a60f7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Support for QML Types RegistrarLeander Beernaert2020-01-241-0/+39
|/ | | | | Change-Id: Iff5da66ae179601fbfd369b9bc31005554df5873 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>