diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-01-18 11:24:02 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-01-18 13:42:48 +0100 |
commit | bdb2b66f3d7d027e3022aabd63fe73d305ed058f (patch) | |
tree | a1e3dd0ca8748b846ba136b4997fd0176f628a6d /tests | |
parent | 65b88e61a5a67a0377b375b444fa4fb2a4c9f2b5 (diff) |
Add support for extended types to qmltyperegistrar
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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp | 1 | ||||
-rw-r--r-- | tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp index ae160e0d33..7b82be20f7 100644 --- a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp +++ b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp @@ -82,6 +82,7 @@ void tst_qmltyperegistrar::superAndForeignTypes() QVERIFY(qmltypesData.contains("Property { name: \"height\"; type: \"int\" }")); QVERIFY(qmltypesData.contains("Property { name: \"width\"; type: \"int\" }")); QVERIFY(qmltypesData.contains("Method { name: \"sizeToString\"; type: \"QString\" }")); + QVERIFY(qmltypesData.contains("extension: \"SizeValueType\"")); } void tst_qmltyperegistrar::accessSemantics() diff --git a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h index 211119a654..509816f62c 100644 --- a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h +++ b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h @@ -86,7 +86,7 @@ private: class SizeEnums { Q_GADGET - QML_NAMED_ELEMENT(SizeEnums) + QML_NAMED_ELEMENT(sizeEnums) QML_UNCREATABLE("Element is not creatable.") public: @@ -99,8 +99,9 @@ class SizeValueType : public SizeEnums QSize v; Q_GADGET Q_PROPERTY(int width READ width WRITE setWidth FINAL) - QML_NAMED_ELEMENT(MySize) + QML_NAMED_ELEMENT(mySize) QML_FOREIGN(SizeGadget) + QML_EXTENDED(SizeValueType) public: Q_INVOKABLE QString sizeToString() const |