Guest User

Untitled

a guest
Dec 16th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. ListView {
  2. id: root
  3. property var selection: QtObject {}
  4. ...
  5. delegate: MyView {
  6. focused: ListView.isCurrentItem
  7. selected: root.selection[index] === true
  8.  
  9. Rectangle {
  10. id: selectionOverlay
  11. anchors.fill: parent
  12. color: "red"
  13. opacity: 0.3
  14. visible: selected
  15. }
  16.  
  17. }
  18.  
  19. Keys.onPressed: if (event.key === Qt.Key_Space)
  20. root.selection[root.currentIndex] = !root.selection[root.currentIndex]
  21. }
Add Comment
Please, Sign In to add comment