Searching for something like QQmlListProperty<QQmlComponent>
-
Currently I use a
QQmlListProperty<QObject>asDefaultPropertyin my C++ classFooand my QML looks like this:Foo { Bar {} Bar {} Bar {} }So nothing really exciting. However, I only need a few of these elements instantiated at the same time (and I already know which ones on the C++ side). My first idea was to use a
QmlListProperty<QQQmlComponent>. That would be easy, but unfortunately it does not work.I can't change the QML code. But I want to control the instantiation of the elements on the C++ side. As if
Barwould be implicitly assigned to aQQmlComponentin the above QML code. Hence the idea with theQQmlListProperty<QQmlComponent>, which unfortunately does not work.Does anyone have any ideas on how I could achieve this? Is there any (private) API that could help?
Thank you in advance
Stefan -
@DuBu
i think there is no workaround yet other than wrapping all child items:Foo { Component { Bar {} } Component { Bar {} } Component { Bar {} } }But maybe this is indeed worth a feature request via the bugtracker.