Details
-
Task
-
Resolution: Unresolved
-
P2: Important
-
None
Description
It seems that enums which are exported from C++ can not be used as properties in QML.
Consider the following example:
C++:
class Bar : public QObject { Q_OBJECT QML_ELEMENT public: enum Weather { Raining, Sunny, Cloudy } Q_ENUM(Weather) };
QML:
Item { property Bar.Weather weather: Bar.Sunny }
This doesn't work because we don't allow enums to be used as types in QML.
It would be nice if exported enums just worked as properties. A workaround is to use "int" as the property type instead.
Attachments
Issue Links
- is duplicated by
-
QTBUG-83800 Enum properties are not supported
-
- Open
-
- is required for
-
QDS-13535 Binding Editor and Property View don't treat enum constants as constants
-
- Reported
-
- relates to
-
QTBUG-120506 [Reg 6.5 -> 6.6] Using `CameraLens.ProjectionType` as type hinting cause runtime error
-
- Closed
-
-
QTBUG-116513 QML: Provide easy access to enums' string names
-
- Reported
-