aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/data/enumproblems.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/data/enumproblems.h')
-rw-r--r--tests/auto/qml/qmlcppcodegen/data/enumproblems.h68
1 files changed, 67 insertions, 1 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/data/enumproblems.h b/tests/auto/qml/qmlcppcodegen/data/enumproblems.h
index 08a00acf7e..36f97bec5a 100644
--- a/tests/auto/qml/qmlcppcodegen/data/enumproblems.h
+++ b/tests/auto/qml/qmlcppcodegen/data/enumproblems.h
@@ -1,10 +1,11 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef ENUMPROBLEMS_H
#define ENUMPROBLEMS_H
#include <QObject>
+#include <QtCore/qflags.h>
#include <QtQml/qqml.h>
#include <QtQml/qqmlregistration.h>
@@ -45,9 +46,74 @@ 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); }
};
+class ControlFlags : public QObject {
+ Q_OBJECT
+ QML_ELEMENT
+ QML_UNCREATABLE("Flag Container Class")
+public:
+
+ enum Option {
+ ControlA = 0x1,
+ ControlB = 0x2,
+ Both = ControlA | ControlB
+ };
+
+ Q_DECLARE_FLAGS(Options, Option)
+ Q_FLAG(Option)
+};
+
+class ScopedEnum : public QObject {
+ Q_OBJECT
+ QML_NAMED_ELEMENT(Data)
+ Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
+
+public:
+ enum class DType {
+ A = 27, B
+ };
+ Q_ENUM(DType)
+
+ enum EType {
+ C = 7, D
+ };
+ Q_ENUM(EType)
+};
+
+class UnscopedEnum : public QObject {
+ Q_OBJECT
+ QML_NAMED_ELEMENT(Data2)
+ Q_CLASSINFO("RegisterEnumClassesUnscoped", "true")
+
+public:
+ enum class DType {
+ A = 26, B
+ };
+ Q_ENUM(DType)
+
+ enum EType {
+ C = 6, D
+ };
+ Q_ENUM(EType)
+};
+
#endif // ENUMPROBLEMS_H