Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ListView {
- id: root
- property var selection: QtObject {}
- ...
- delegate: MyView {
- focused: ListView.isCurrentItem
- selected: root.selection[index] === true
- Rectangle {
- id: selectionOverlay
- anchors.fill: parent
- color: "red"
- opacity: 0.3
- visible: selected
- }
- }
- Keys.onPressed: if (event.key === Qt.Key_Space)
- root.selection[root.currentIndex] = !root.selection[root.currentIndex]
- }
Add Comment
Please, Sign In to add comment