Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Returning a QList<QGadget> from Q_INVOKABLE ?
Zicandar last edited by Zicandar
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!
VRonin last edited by
QVariantListcan hold classes declared as
Q_GADGETand can also be exposed to QML
Zicandar last edited by
Thanks, this works!