I have this in my QML code:
TreeView {
    ...
    onExpanded: {
        console.log("onExpanded called", index)
    }
}
And this is the output when it's called:
QModelIndex(1,0,0x5d9f5a0,TreeModel(0x5deae90))
how do I access the first value (1) inside QML code?
If you've got an Object in QML and you don't know how to access it's properties, you can always use: Object.keys(obejectInQuestion).
At least for the QModelIndex you get for the ListModel the getter row() is used for the property row. So to access it, use: myQModelIndexThingy.row instead of myQModelIndexThingy.row()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With