Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //main.qml
- TreeView {
- id: treeView
- anchors.fill: parent
- model: treeviewmodel
- selection: ItemSelectionModel {
- model: treeviewmodel
- }
- TableViewColumn {
- role: "name_role"
- title: "Section Name"
- }
- onCollapsed: {
- treeView.selection.clearSelection() // deselects the item, but still passes the previous values
- }
- onExpanded: {
- treeView.selection.clearSelection()
- }
- onClicked: {
- console.log("Current Row: " + treeView.currentIndex.row + "Parent Row: " + treeView.currentIndex.parent.row)
- //I need something here that will set treeView.currentIndex.row and treeView.currentIndex.parent.row to -1
- //so that when I collapse or expand, -1 gets passed instead of the previous values
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement