Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. //main.qml
  2.  
  3. TreeView {
  4. id: treeView
  5. anchors.fill: parent
  6. model: treeviewmodel
  7. selection: ItemSelectionModel {
  8. model: treeviewmodel
  9. }
  10. TableViewColumn {
  11. role: "name_role"
  12. title: "Section Name"
  13. }
  14. onCollapsed: {
  15. treeView.selection.clearSelection() // deselects the item, but still passes the previous values
  16. }
  17. onExpanded: {
  18. treeView.selection.clearSelection()
  19. }
  20. onClicked: {
  21. console.log("Current Row: " + treeView.currentIndex.row + "Parent Row: " + treeView.currentIndex.parent.row)
  22. //I need something here that will set treeView.currentIndex.row and treeView.currentIndex.parent.row to -1
  23. //so that when I collapse or expand, -1 gets passed instead of the previous values
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement