[Development] Q_INVOKABLE QAbstractListModel
mark diener
rpzrpzrpz at gmail.com
Sat May 23 19:20:23 CEST 2015
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150523/92298251/attachment.html>
More information about the Development
mailing list