Details
-
Suggestion
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.5.0 Beta
-
None
Description
Assume the following setup:
class A { Q_GADGET }; class B : public A { Q_GADGET }; class Foo: public QObject { Q_PROPERTY(A propA READ propA WRITE setPropA) };
and in QML we try to execute the following snippet:
Foo {
propA: b // whereby b is an instance of gadget B
}
This fails to work as QQmlProperty cannot convert an instance of B to and instance of A. More precise QVariant::convert() relies on Q_OBJECT to work but it never got this treatment for Q_GADGET.
QVariant::canConvert and QVariant::convert should implement the conversion between two Q_GADGET if one is derived by the other.