⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

Changing model root in a Package of a DelegateModel

  • 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.

Log in to reply