aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/data/enumProperty.h
diff options
context:
space:
mode:
authorSemih Yavuz <semih.yavuz@qt.io>2022-12-02 22:07:12 +0100
committerSemih Yavuz <semih.yavuz@qt.io>2022-12-05 17:39:24 +0100
commit9793c663ccd1fbcbbe56f9dcab1515909113d704 (patch)
tree517db468d1520f078268eeda35abc76817595c68 /tests/auto/qml/qmlcppcodegen/data/enumProperty.h
parent4f92f018ea0639b8127ad25f4430e5a5ee4e61a1 (diff)
Fix comparison AOT-lookup and intended type in value types
We currently force the lookup metatype to be exactly the same data type with the caller's. As a result, the conversion from enum to integral data type is not recognized. Relax this comparison by using isTypeCompatible helper. Pick-to: 6.4 Fixes: QTBUG-109007 Change-Id: I188dc3e6c1fd7100e9ed5c4ba5d0c90d85d79be4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/data/enumProperty.h')
-rw-r--r--tests/auto/qml/qmlcppcodegen/data/enumProperty.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/data/enumProperty.h b/tests/auto/qml/qmlcppcodegen/data/enumProperty.h
new file mode 100644
index 0000000000..8c13e860a3
--- /dev/null
+++ b/tests/auto/qml/qmlcppcodegen/data/enumProperty.h
@@ -0,0 +1,34 @@
+#ifndef ENUMPROPERTY_H
+#define ENUMPROPERTY_H
+
+#include <QObject>
+#include <QtQml>
+
+class MyEnumType
+{
+ Q_GADGET
+ QML_ANONYMOUS
+public:
+ enum MyEnum {
+ Sin = 0x01,
+ Saw = 0x02,
+ Tri = 0x04,
+ };
+ Q_ENUM(MyEnum)
+ Q_PROPERTY(MyEnum type READ type)
+ MyEnum type() const { return MyEnum::Tri; }
+};
+
+class MyType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(MyEnumType myEnumType READ myEnumType)
+ QML_ELEMENT
+public:
+ MyEnumType myEnumType() const { return m_type; }
+
+private:
+ MyEnumType m_type;
+};
+
+#endif // ENUMPROPERTY_H