aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h
Commit message (Collapse)AuthorAgeFilesLines
* Qml: Allow major version of module to be zeroAlexandru Croitor2022-06-201-0/+1
| | | | | | | | | | | | | | If there is no QML.AddedInVersion then the component should be available from version X.0, with X being the current version of the module. Amends 464abaec05e0aa0ab699243412c50a5d5ac30742 Fixes: QTBUG-104373 Change-Id: If30b66df384fe815c41d2a0b5ca7b034b9955956 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 9225723a317b8c7e805416592b78aca0ed320049) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QML: Unify treatment of invalid revisions on registrationUlf Hermann2022-03-091-0/+25
| | | | | | | | | | | | | Revisions before QML_ADDED_IN_VERSION and revisions after QML_REMOVED_IN_VERSION should both result in anonymous types. This way, you can then derive from the type in question and expose the derived type in a different set of versions. Change-Id: Ia59258047fc242c809c27525bb75fd2797fe5aab Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 464abaec05e0aa0ab699243412c50a5d5ac30742) Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* qmltyperegistrar: Register foreign base classes anonymouslyMaximilian Goldstein2021-10-291-0/+19
| | | | | | | | | | This is necessary in order to expose all revisioned properties of foreign base classes regardless of module version. In some instances we will want to follow Qt versioning instead though and only expose those classes that are actually exposed at that version level. This will be handled by a follow up change. Fixes: QTBUG-91706 Change-Id: I9049d5cada812560a4b9e07874954045ee5d5562 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Propagate ImmediatePropertyNames through type registrar and QQmlJSScopeUlf Hermann2021-10-281-0/+15
| | | | | | | Change-Id: Ibaa2b86e823349ecf76e8199f2e68b8ad18d159a Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltyperegistrar: Strip '*' from method return typesUlf Hermann2021-09-201-0/+10
| | | | | | | | | | Method return types should look the same as other types. Also, recognize that method return types could be lists and add a TODO to this effect. Pick-to: 6.2 Fixes: QTBUG-96587 Change-Id: I94bbc347fc47eba8f09dc40a9163cfe78aec4b94 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* qmltyperegistrar: Properly resolve includes for foreign typesUlf Hermann2021-09-021-0/+8
| | | | | | | | | When we add them to the qmltypes files, they need the same preprocessing as the own types. Pick-to: 6.2 Change-Id: I3c8e946609b8a0a8f739812508b75e4f085feddc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* typeregistrar: Fix deferred names classinfo checkMaximilian Goldstein2021-08-311-2/+2
| | | | | Change-Id: I0132d3922bf8c315119772910882b969e56eaa0e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmltyperegistrar: Record deferred names in qmltypesMaximilian Goldstein2021-08-271-0/+15
| | | | | | | | We will need this in order to provide better static analysis of deferred properties. Fixes: QTBUG-96020 Change-Id: I43d8e68f1fd8e5df11195b63c3de948c50888ab4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Allow extending namespaces with other namespacesUlf Hermann2021-06-211-0/+29
| | | | | | | Previously you could only extend types. Change-Id: I5d0bcea58403a87b9ff878c255ff590f162f8b24 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltyperegistrar: Do not generate namespace metatypes for non-namespacesUlf Hermann2021-06-081-0/+78
| | | | | | | | | | If the target type of a QML_FOREIGN_NAMESPACE is not a namespace, we must not generate another metatype for it because otherwise we get two metatypes with the same name and ID. Change-Id: I0111e995a227c4a5d4c99e47662b7f86767e0da1 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Pass property index from MOC to QQmlJSMetaPropertyAndrei Golubev2021-06-031-0/+1
| | | | | | | | This index corresponds to what QMetaObject::indexOfProperty returns for the same property at run time Change-Id: I3868aa8651f75d774026cb27438cea16bca698d7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Propagate NOTIFY from moc output to qmltypesAndrei Golubev2021-05-271-0/+1
| | | | | | | | This is useful for the object creation compiler when generated aliases should really have a notify which is bound to the origin's notify Change-Id: I805d0d461490da7122e37345914dec4140f342ff Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add a ParentProperty classinfo and use that to find parentsUlf Hermann2021-05-191-0/+16
| | | | | | | | | | This is more robust than just going by the "parent" name. Task-number: QTBUG-93662 Change-Id: If099733de6ad0f3bb7cb75b8915789f66b554f85 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Pass "final" attribute of properties through qmltypesUlf Hermann2021-05-121-1/+10
| | | | | | | | We want to know about that in QQmlJSScope. Task-number: QTBUG-93662 Change-Id: Ie4b15fa06cb921d48074ae39d1057ead439ebc45 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Initialize the metatypes of extensionsUlf Hermann2021-04-281-0/+10
| | | | | | | | If we don't do that we can't look up the extension metatypes by name or by ID, which is very inconvenient. Change-Id: Ie93df186908c38de80a2f0b7c06c4df93cb4c5af Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltyperegistrar: Do not generate read, write, bindable for privatesUlf Hermann2021-03-231-0/+15
| | | | | | | | | If the methods are defined on the private class we can in fact not access them. We'd need a way to retrieve the private class from the public one. Change-Id: I654e320a0eb6208a418591e74a7bdd56529daf9d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlcompiler: Add support for required propertiesMaximilian Goldstein2021-03-031-0/+14
| | | | | | Change-Id: I2687de04120ab224c5ccc409930526c29d8915bb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* qmltyperegistrar: Fix handling of default propertiesUlf Hermann2021-02-021-0/+51
| | | | | | | | | 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>
* QmlCompiler: Allow for multiple extensions per objectUlf Hermann2021-02-011-0/+46
| | | | | | | | | | | | | | | | | | | 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/+1
| | | | | | | | | | | 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-0/+12
| | | | | | | | | | 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>
* Add support for extended types to qmltyperegistrarUlf Hermann2021-01-181-2/+3
| | | | | | | | | | | | | | | 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>
* Support namespaced QML_ELEMENTMaximilian Goldstein2020-12-101-1/+9
| | | | | | | Fixes: QTBUG-87266 Change-Id: Iad8c7765b339c5498f541702bbf7df64164f5358 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmltyperegistrar: Expose interface informationMaximilian Goldstein2020-11-231-0/+24
| | | | | Change-Id: Ica3f5c6696542921bc8d399cd46d901ba06f6d83 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmltyperegistrar: Add past-major-version optionMaximilian Goldstein2020-11-101-0/+1
| | | | | | | | 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>
* Adjust to qtbase changesFabian Kosmale2020-09-041-2/+4
| | | | | | | | | | | | | - 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>
* Restrict qmlRegisterTypesAndRevisions to major version givenUlf Hermann2020-07-161-0/+27
| | | | | | | | | | | 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>
* qmltyperegistrar: Preserve isQProperty flag from metatypesUlf Hermann2020-05-281-0/+5
| | | | | | | Task-number: QTBUG-76025 Change-Id: I952afdad6410c3f7ccb05b6c3de77020b30f78d3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* Preserve access semantics in qmltypesUlf Hermann2020-05-181-0/+1
| | | | | | | | 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>
* qmltyperegistrar: Correctly handle foreign and super classesUlf Hermann2020-04-161-0/+30
| | | | | | | | | | | 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/+10
| | | | | | Change-Id: Id484c7bb1a3ed3b2bf593f6197664e4ee2ad4006 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* qmltyperegistrar: Record header file names in qmltypes filesUlf Hermann2020-03-301-0/+1
| | | | | | | 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-0/+5
| | | | | | | | 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: Accept extra foreign types filesUlf Hermann2020-03-261-0/+50
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>