Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Changing model root in a Package of a DelegateModel

    QML and Qt Quick
    1
    1
    148
    Loading More Posts
    • 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.
    • R
      Royal Bissell last edited by

      I am working with hierarchical data in Qabstractitemmodel in QML within a Delegate model and Package component in order to allow me to display a list and then details on an item.

          DelegateModel {
              id: delegateModel
              model: myModel
              delegate: Package {
                  GridDelegate {
                      onClicked: {
                          details.root = gridview.model.modelIndex(index)
                      }
                      Package.name: 'grid'
                  }
                  DetailsDelegate {
                      Package.name: 'details'
                  }
              }
          }
      

      The issue is that now that the delegate is in a Package component gridview.model is now a QqmlPartsModel and I get Property 'modelIndex' of object QQmlPartsModel(0xd75fa0) is not a function

      Qt example: http://doc.qt.io/qt-5/qml-qtqml-models-delegatemodel.html#rootIndex-prop

      Is there another way I should be going about this.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post