Hello:
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
Model instance.
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.
QML Output:
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...
mark
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development