QML: how to access to model.modelData N element

  • Hi all,
    I am writing an application in which a c++ plugin exposes a QObjectList as in this example:

    ListView {
    width: 100; height: 100
    anchors.fill: parent

     model: myModel
     delegate: Rectangle {
         height: 25
         width: 100
         color: model.modelData.color
         Text { text: name }


    I tried to access to an element of the list with the get method:


    as explained in many tutorials, but I received an error

    I tried also with model.get(0).modelData.color, but it is the same.

    How can I access that element?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.