Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.14.2
-
d29f3d7a62780d74f62330b0e3a0703a72155852 (qt/qtdeclarative/dev)
Description
As the title reads, QML does not allow such enum usages:
C++: enum class Test { value1, value2 }; // Let's skip namespace/class declaration and metatypes registration. QML: Item { property int v: TestItem.Test.value2 }
In this case QML will emit the following error:
Invalid property assignment: Enum value "value2" cannot start with a lowercase letter
I know about the issues like QTBUG-46758 or QTBUG-35494, but they are pretty old and many things changed in Qt since then. In fact such lower-cased enums do work in QML (at least in Qt 5.11 and 5.14). The mentioned direct binding is the only place where we faced the error, and that error message was introduced long ago in 2016, and now it looks a bit irrelevant.
So far it is possible to work-around the issue by using a code-block with return:
property int v: { return TestItem.Test.value2 }