summaryrefslogtreecommitdiff
path: root/src/controls/TreeView.qml
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-01-19 10:03:47 +0100
committerLiang Qi <liang.qi@qt.io>2018-01-19 10:03:47 +0100
commit698a8268f786d74726eb07255df2d26ac2269079 (patch)
tree7f63974c3a13b507166e84459be7b5fc2787d2e1 /src/controls/TreeView.qml
parent314d1bdf7d56462102639e12d34596cbfd4fce95 (diff)
parenteb048e486daa3644476fdec5b0bd016b1729fc01 (diff)
downloadqtquickcontrols-698a8268f786d74726eb07255df2d26ac2269079.tar.gz
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: src/dialogs/qquickabstractfiledialog_p.h tests/auto/controls/data/tst_combobox.qml Change-Id: I62e54d0a2e89d987e05e8dfad6ae6aac1a32cc72
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)
}