aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmltyperegistrar
Commit message (Collapse)AuthorAgeFilesLines
* qmltyperegistrar: Fix handling of default propertiesUlf Hermann2021-02-021-26/+35
| | | | | | | | | Default properties are always local. There is no way to declare a default property for a foreign type as the default property is queried directly from the classinfo at runtime. Change-Id: I30efb6fba190957ac2a4ad86da437f209cd1f3ad Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltyperegistrar: Do not add extensions to local anonymous typesUlf Hermann2021-02-021-9/+2
| | | | | | | | | If we generate a local anonymous type, then that's the local part of a QML_FOREIGN local/foreign couple. Any QML.Extended in there belong to the foreign type. Change-Id: Ic1706045eff03dd7b1b553240596ffc21818c8bd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Allow for multiple extensions per objectUlf Hermann2021-02-012-13/+18
| | | | | | | | | | | | | | | | | | | Previously, the assumption was that each object could only have a single extension object. As proven by the new qqmllanguage test this is not the case. Each registered object in the type hierarchy can have its own extension. Therefore, adjust the algorithms that generate qmltypes and iterate the extension objects when analyzing them. This leads us to the realization that anonymous types can in fact meaningfully carry extensions and implement interfaces. Adapt qmltyperegistrar accordingly. For the test to compile, however, we need to realize that the class declaring interfaces needs to befriend all potential subclass's QmlInterface structs. Fix that, too. The rabbit hole went deep. Change-Id: Ia451897e927e03b95c3062e829edf1dfcd216613 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Expose getter and setter names of C++ classes in qmltypes filesFabian Kosmale2021-01-291-0/+6
| | | | | | | | | | | This simply exports the name which are already available in the json files generated by moc. We do not consider whether the methods are non-private for now. MEMBER is not supported either, but might be added if the need actually arises. Fixes: QTBUG-90711 Change-Id: If3ee18c8ce60499676a7ee22df569cba0912e22f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmltyperegistrar: Make sure we have metatypes for all QML typesUlf Hermann2021-01-251-13/+41
| | | | | | | | | | We need to be able to resolve any QML type from its C++ name using QMetaType::fromName(). qmltyperegistrar can generate the missing metatypes, either by creating synthetic ones (for namespaces), or by making sure the existing ones are registered (for others). Change-Id: If775af56d891f2c2a5bb94589b3cb05a199c7c35 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltyperegistrar: Remove QML.ManualRegistrationUlf Hermann2021-01-183-18/+1
| | | | | | | | | | This was needed because we couldn't automatically generate the types for the Qt object/namespace. Now we can. We should not offer this possibility to users as we need to see all the types at compile time. Such an escape hatch will only give us problems in the future. Change-Id: Ib86fddd0352cf1877a4123cad273c99c4252d8ac Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add support for extended types to qmltyperegistrarUlf Hermann2021-01-187-129/+216
| | | | | | | | | | | | | | | We generate the extensions as separate types. This also covers the case of value types being extended by "themselves". We can properly express this now, so we don't need the hackery of generating the local members of a type with QML_FOREIGN into the foreign type anymore. This also fixes interfaces from local types being written for foreign types. Fixes: QTBUG-89501 Change-Id: Ic76acd7eef09a92c1e36bd7a649c7a2deb24597b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltyperegistrar: Silence further static analysis warningsUlf Hermann2021-01-182-2/+2
| | | | | Change-Id: I37a8b76bada2bfe19d0377725eceecbf8322a10e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltyperegistrar: Always use the local type name for "auto" elementsUlf Hermann2021-01-181-1/+2
| | | | | | | | | The local type name is assumed to be under the user's control. Previously the choice would depend on the order of classinfo objects in the metatype. Change-Id: I3199b757aaa9f04821723df1c6331ab447771ee0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltyperegistrar: Silence further static analysis warningsUlf Hermann2021-01-152-12/+12
| | | | | Change-Id: Ib6e45a06ca5cf606281171fd1dc890f67026b79a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltyperegistrar: Silence some static analysis warningsUlf Hermann2021-01-151-12/+12
| | | | | Change-Id: I1a4bdbb49e6700f2e218ebd349b823350bb09148 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove the qmake project filesFabian Kosmale2021-01-151-40/+0
| | | | | | | | | Remove all qmake project files, except for examples which are used to test that qmake continues to work. Change-Id: Ic4abb72dc2dcd75df7a797c56056b6b3c5fe62ac Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* 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". Pick-to: 6.0 5.15 Fixes: QTBUG-85888 Fixes: QTBUG-87117 Change-Id: I20daac1b6b9a27c5ac48b3c2c685e2fed301e213 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Fix compiler warningVolker Hilsheimer2020-11-251-2/+2
| | | | | | | | | QJsonArray doesn't return references to QJsonValue, and clang warns about it. Change-Id: I0fe447adbc01c0da4c2aaf1cec3c496b2d41aa62 Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltyperegistrar: Expose interface informationMaximilian Goldstein2020-11-233-0/+18
| | | | | Change-Id: Ica3f5c6696542921bc8d399cd46d901ba06f6d83 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* 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