[Qt-qml] how to expose nested ListModel from C++ to QML?

Chris dchris at gmail.com
Thu Dec 9 12:11:51 CET 2010


Hi,

Well, I'm not involved in QML development (just a user), so somebody else
can probably answer this.

My guess is that this data type is not supported by QML yet:
see http://doc.qt.nokia.com/4.7-snapshot/qtbinding.html#supported-data-types

Kr,
Chris.

On Thu, Dec 9, 2010 at 12:21 PM, Wei, Xiaohai <wistoch at gmail.com> wrote:

> yeah, it works.
>
> Thanks a lot.
>
> why it doesn't work if I return QAbstractListModel* ?
>
> Thanks
>
> James
>
> On Thu, Dec 9, 2010 at 6:16 PM, Chris <dchris at gmail.com> wrote:
>
>>
>>> I used an INVOKABLE method in class A which will return a
>>> QAbstractListModel, and use it as the model of the inner ListView, but it
>>> doesn't work.
>>>
>>> Actually, this works for me.
>> I believe you need to cast the returned model to a QObject* to make it
>> work. For example:
>>
>> Q_INVOKABLE QObject* commentsForActivity(const QString &id) const;
>>
>> Kr,
>> Chris.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20101209/a4ac26d3/attachment.html 


More information about the Qt-qml mailing list