From bdb2b66f3d7d027e3022aabd63fe73d305ed058f Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 18 Jan 2021 11:24:02 +0100 Subject: 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 Reviewed-by: Fabian Kosmale --- tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp | 1 + tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/auto/qml/qmltyperegistrar') 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 -- cgit v1.2.3