aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/testtypes.h
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-09-14 21:23:32 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-09-21 19:59:27 +0000
commitb7738beda651c2927e1a9d58c592148b1dc99576 (patch)
tree55d62516410088f22885ff551d57fff5ae50a5bc /tests/auto/qml/qqmllanguage/testtypes.h
parentba7edffda3f360955825c3ef886ec232c0b2022b (diff)
Make QML composite types inherit enums
Problem: in Qt Quick Controls 2, enums declared in the abstract C++ base types were not accessible with the concrete QML type name, but had to be referenced using the base type name: Slider { snapMode: AbstractSlider.SnapOnRelease } Solution: this change resolves the C++ base type and creates the missing link between the composite type and its base type's meta- object. This allows referencing enums using the concrete/composite QML type name: Slider { snapMode: Slider.SnapOnRelease } Change-Id: Icefdec91b012b12728367fd54b4d16796233ee12 Task-number: QTBUG-43582 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/testtypes.h')
-rw-r--r--tests/auto/qml/qqmllanguage/testtypes.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/testtypes.h b/tests/auto/qml/qqmllanguage/testtypes.h
index b8792a892f..985acc2539 100644
--- a/tests/auto/qml/qqmllanguage/testtypes.h
+++ b/tests/auto/qml/qqmllanguage/testtypes.h
@@ -1079,9 +1079,19 @@ class MyEnumDerivedClass : public MyEnum2Class
Q_OBJECT
};
+class MyCompositeBaseType : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(CompositeEnum)
+
+public:
+ enum CompositeEnum { EnumValue0, EnumValue42 = 42 };
+};
+
Q_DECLARE_METATYPE(MyEnum2Class::EnumB)
Q_DECLARE_METATYPE(MyEnum1Class::EnumA)
Q_DECLARE_METATYPE(Qt::TextFormat)
+Q_DECLARE_METATYPE(MyCompositeBaseType::CompositeEnum)
QML_DECLARE_TYPE(MyRevisionedBaseClassRegistered)
QML_DECLARE_TYPE(MyRevisionedBaseClassUnregistered)
@@ -1089,6 +1099,7 @@ QML_DECLARE_TYPE(MyRevisionedClass)
QML_DECLARE_TYPE(MyRevisionedSubclass)
QML_DECLARE_TYPE(MySubclass)
QML_DECLARE_TYPE(MyReceiversTestObject)
+QML_DECLARE_TYPE(MyCompositeBaseType)
class CustomBinding : public QObject, public QQmlParserStatus
{