On 01/13/2013 10:09 PM, Johan Thelin wrote:

Sorry for top-posting. I'm writing from my phone.

I've had a class like this for a project of mine. It exposed signals for adding, removing and changing rows as well as the count, data and setData methods.

This helped me peek and poke at a QAbstractLisaModel from JavaScript.


I bet she loved it.

Cheers,

Johan

On Jan 13, 2013 12:40 PM, "Alberto Mardegan" <[email protected] <mailto:[email protected]>> wrote:

    On 01/12/2013 11:59 PM, Nils Jeisecke wrote:
    > Hi,
    >
    > what about adding a new Quick item for "enhanced
    QAbstractItemModel access".
    >
    > ListModelAdapter {
    >    id: myModelAdapter
    >    sourceModel: myModel
    > }
    >
    > ListView {
    >    model: myModelAdapter.sourceModel
    >    delegate: Text {
    >      MouseArea {
    >        onClicked: console.log(myModelAdapter.data(model.index,
    "myRole")
    >      }
    >    }
    > }

    That would also work just for QAbstractListModel, unless we find a way
    to present QModelIndex to QML.
    If the proposal of adding the "count" property and the "get" method to
    QAbstractListModel doesn't get accepted, IMHO the best thing to do
    is to
    provide either code snippets or a *C++* helper class to help implement
    those things, rather then workaround the limitations from the QML
    side.
    We are talking about C++ models in any case, so I see more fit a
    solution on the C++ side.

    Ciao,
       Alberto
    _______________________________________________
    Development mailing list
    [email protected] <mailto:[email protected]>
    http://lists.qt-project.org/mailman/listinfo/development



_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to