Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
-
None
Description
QML Repeater is very useful for creating items, and Instantiator for creating objects. It would be nice if these could be used to create elements that are passed to a DefaultProperty declared list of items or objects.
ItemWithDefaultListProperty { Instantiator { model: 3 CustomElement { } } }
Given this C++ header:
class ItemWithDefaultListProperty : public QQuickItem { Q_PROPERTY(QQmlListProperty<CustomElement> elements READ elements) Q_CLASSINFO("DefaultProperty", "elements") Q_OBJECT public: ...
The issue is that when using an instantiator in this way, the instantiator itselfs is assigned to the default property, instead of the elements it creates. So the resulting QML syntax error is one of wrong type assignment...