Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
5.12, 5.13, 5.14, 5.15, 6.0.0 Beta2, 6.0, 6.1
-
121b8a6ae42d9423250ab1121c15c49ab064307a
Description
An enum defined in class A and used as a property works fine inside a binding and a javascript function
Using the same enum from class A in a new class B also works fine inside a binding and a javascript function.
Deriving class C from class B and using the Q_OBJECT macro, Makes the enum work inside the binding, but using the same enum inside a javascript function doesn't.
Attached an example which instantiates all 3 classes and using a binding to set the enum.
3 Buttons are defined which use a Javascript function to update the enum properties. Using the "Change Object C" button, results in no change of the property but shows the following warning:
qrc:/main.qml:45: Error: Cannot assign [undefined] to int
None of this should actually work. We need to output a warning when we detect it and deprecate this behavior.
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-83703 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
298325,6 | qqmltypecompiler: Be more careful when resolving enums | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
304927,1 | qqmltypecompiler: Be more careful when resolving enums | 5.15 | qt/qtdeclarative | Status: ABANDONED | 0 | 0 |
353400,5 | Allow registration of enums from related types to be switched off | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |