From 22a2cc43387ec3b9f74a6c01f8665378a4541147 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 20 Apr 2017 15:59:31 +0200 Subject: Add support for enum declarations in QML Enums can be declared with the following syntax: enum MyEnum { Value1, Value2 } Grammar changes done by Simon Hausmann. [ChangeLog][QtQml] Enums can now be declared directly in QML. Task-number: QTBUG-14861 Change-Id: Ic6b6e032651d01ee2ecf9d5ce5734976cb3ad7ab Reviewed-by: Simon Hausmann --- tests/auto/qml/qqmllanguage/data/TypeWithEnum.qml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/auto/qml/qqmllanguage/data/TypeWithEnum.qml (limited to 'tests/auto/qml/qqmllanguage/data/TypeWithEnum.qml') diff --git a/tests/auto/qml/qqmllanguage/data/TypeWithEnum.qml b/tests/auto/qml/qqmllanguage/data/TypeWithEnum.qml new file mode 100644 index 0000000000..c89a228bef --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/TypeWithEnum.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +QtObject { + enum MyEnum { + EnumValue1, + EnumValue2, + EnumValue3 + } + + property int enumValue: TypeWithEnum.EnumValue2 + property int enumValue2 + property int scopedEnumValue: TypeWithEnum.MyEnum.EnumValue2 + Component.onCompleted: enumValue2 = TypeWithEnum.EnumValue3 +} -- cgit v1.2.3