Returning a QList<QGadget> from Q_INVOKABLE ?
Solved
General and Desktop
-
wrote on 4 Jun 2019, 09:30 last edited by Zicandar 6 Apr 2019, 09:30
Hello,
Is it possible to return a QList (or other list type) of QGadgets from a C++ function to the calling QML?
Normally I would expose a Q_PROPERTY holding the list, however in this case I need to return the list based on an input parameter. As far as I know this cannot be done with a Q_PROPERTY in any simply way?
The use case is for a Repeater in QML.
I am attempting to return a struct with some Q_PROPERTY's. The struct in question only needs to be read, and the list is there for the repeater.
I have tried looking around for an answer, however almost all cases point to QObjects, or Q_PROPERTY's.Help would be much appreciated!
-
wrote on 4 Jun 2019, 10:21 last edited by
QVariantList
can hold classes declared asQ_GADGET
and can also be exposed to QML -
wrote on 4 Jun 2019, 10:54 last edited by
Thanks, this works!
1/3