diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2023-03-27 18:01:07 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-04-26 10:57:27 +0200 |
| commit | f10630aa035ae1ef4ad75be1107ab77fea0c7e29 (patch) | |
| tree | 35080e7a0991f8819e5952fcc347d64503607848 /tests/auto/qml/qmlcppcodegen/data | |
| parent | 9088125f148d298837d830023f5da0172e1736b6 (diff) | |
QmlCompiler: Use actual type of enums, rather than int
Now that the type is available from qmltypes we can just use it.
Task-number: QTBUG-112180
Change-Id: I315372da0925f19c209f676226f450863b0d3ea5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/data')
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/data/enumProblems.qml | 5 | ||||
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/data/enumproblems.h | 15 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/data/enumProblems.qml b/tests/auto/qml/qmlcppcodegen/data/enumProblems.qml index f9a4eb144b..6a57b0e64a 100644 --- a/tests/auto/qml/qmlcppcodegen/data/enumProblems.qml +++ b/tests/auto/qml/qmlcppcodegen/data/enumProblems.qml @@ -11,4 +11,9 @@ QtObject { readonly property FooThing fighter: root.f.get(Foo.Fighter) readonly property FooThing bar: root.f.get(Foo.Component) } + + property int a: FooFactory.B + property int b: f.t8 + property int c: FooFactory.D + property int d: f.t16 } diff --git a/tests/auto/qml/qmlcppcodegen/data/enumproblems.h b/tests/auto/qml/qmlcppcodegen/data/enumproblems.h index 08a00acf7e..2d7f6b46bb 100644 --- a/tests/auto/qml/qmlcppcodegen/data/enumproblems.h +++ b/tests/auto/qml/qmlcppcodegen/data/enumproblems.h @@ -45,8 +45,23 @@ class FooThingWrapper { class FooFactory : public QObject { Q_OBJECT QML_ELEMENT + Q_PROPERTY(T8 t8 READ t8 CONSTANT FINAL) + Q_PROPERTY(T16 t16 READ t16 CONSTANT FINAL) public: + enum T8: qint8 { + A, B, C + }; + Q_ENUM(T8) + + enum T16: qint16 { + D = 500, E, F + }; + Q_ENUM(T16) + + T8 t8() const { return C; } + T16 t16() const { return E; } + Q_INVOKABLE Foo* get(Foo::Type type) const { return new Foo(type); } }; |
