GridView: Getting the visual index position of all delegates

  • Hi,

    I have a DelegateModel of several objects arranged in a GridView. The object has been generated in c++ from a QList<QObject*> via


    The items can be rearranged on the screen via drag and drop. If a rearranging occurs, I need to send a list of the positions of the respective items to the c++ side. How can I get the position in the grid view from the model in qml? So I have

             GridView {
                 id: gridView
                 model: myModel
                delegate: myButton {}

    and I don't know, how I can access the single delegate items via model, also I don't know how to access the gridview-position inside myButton.

  • Ok, for a DelegateModel this seems to be the way:

                    var myob =gridView.model.items.get(i).model

Log in to reply

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