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. Changing model root in a Package of a DelegateModel
Forum Updated to NodeBB v4.3 + New Features

Changing model root in a Package of a DelegateModel

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 267 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.
  • R Offline
    R Offline
    Royal Bissell
    wrote on last edited by
    #1

    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
    0

    • Login

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