Details
-
Suggestion
-
Resolution: Won't Do
-
Not Evaluated
-
None
-
5.7.1
Description
Currently in a class derived from QQuickItem I can declare a delegate property like that:
Q_PROPERTY(QQmlComponent delegate READ delegate ...) Q_CLASSINFO("DefaultProperty", "delegate")
and apply a Text component in QML like that:
MyClass { Text { } }
Now I want to add another Text component to my item class like so:
MyClass { Text { } Text { } }
therefore I change my class to:
Q_PROPERTY(QQmlListProperty<QQmlComponent> delegates READ delegates ...) Q_CLASSINFO("DefaultProperty", "delegates")
But now I get an runtime error saying that it's not possible to apply an object to my property. (Sorry I don't have the correct error message at hand.)
I don't need the instantiated objects in my list, I need the components to instantiate the actual objects in code.
Would it be possible to support multiple delegates that way?