summaryrefslogtreecommitdiff
path: root/src/controls/TreeView.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/controls/TreeView.qml')
-rw-r--r--src/controls/TreeView.qml22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/controls/TreeView.qml b/src/controls/TreeView.qml
index aa21acc1..6a38acff 100644
--- a/src/controls/TreeView.qml
+++ b/src/controls/TreeView.qml
@@ -118,8 +118,8 @@ BasicTableView {
z: -1
propagateComposedEvents: true
focus: true
- // Note: with boolean preventStealing we are keeping
- // the flickable from eating our mouse press events
+ // If there is not a touchscreen, keep the flickable from eating our mouse drags.
+ // If there is a touchscreen, flicking is possible, but selection can be done only by tapping, not by dragging.
preventStealing: !Settings.hasTouchScreen
property var clickedIndex: undefined
@@ -323,8 +323,22 @@ BasicTableView {
modelAdaptor.collapse(modelIndex)
else
modelAdaptor.expand(modelIndex)
- } else if (root.__activateItemOnSingleClick) {
- root.activated(modelIndex)
+ } else {
+ if (Settings.hasTouchScreen) {
+ // compensate for the fact that onPressed didn't select on press: do it here instead
+ pressedIndex = modelAdaptor.mapRowToModelIndex(clickIndex)
+ pressedColumn = __listView.columnAt(mouseX)
+ selectOnRelease = false
+ __listView.forceActiveFocus()
+ __listView.currentIndex = clickIndex
+ if (!clickedIndex)
+ clickedIndex = pressedIndex
+ mouseSelect(pressedIndex, mouse.modifiers, false)
+ if (!mouse.modifiers)
+ clickedIndex = pressedIndex
+ }
+ if (root.__activateItemOnSingleClick && !mouse.modifiers)
+ root.activated(modelIndex)
}
root.clicked(modelIndex)
}