Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. GridView: Getting the visual index position of all delegates
Forum Updated to NodeBB v4.3 + New Features

GridView: Getting the visual index position of all delegates

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 338 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    maxwell31
    wrote on last edited by
    #1

    Hi,

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

     QVariant::fromValue(_programList)
    

    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.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      maxwell31
      wrote on last edited by
      #2

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

                      var myob =gridView.model.items.get(i).model
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved