[Development] Q_INVOKABLE QAbstractListModel
rpzrpzrpz at gmail.com
Sat May 23 19:20:23 CEST 2015
I came across a use case where I wanted to return a QAbstractListModel from
a Q_INVOKABLE in a C++ QObject based class.
The explicit constructor for QAbstractListModel requires a construction of
these classes that forces the Q_INVOKABLE to return a pointer to the List
I imagine the explicit constructor suppresses a lot of careless bugs.
But this usage is not currently possible:
Q_INVOKABLE MyQAbstractListModel* getmodel(void)
return (&gmodel) ;
The QML engine is a bit confused by receiving a pointer to the model
instead of the entire model itself.
qrc:/main.qml:48: Error: Unknown method return type: MyQAbstractListModel*
Maybe someone on the dev list has an idea on how to return a pointer to a
model from Q_INVOKABLE or maybe someone doing current builds can add a
AbstractListModel pointer to the known set or method return types in the
framework for Qt 5.5.x
Anybody's comments appreciated...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Development