aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/treeview/sidebyside/data/treeview.qml
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2022-02-07 11:10:06 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-02-10 13:49:08 +0000
commit9dd1968924f88996d78e3e0d8fa2c82d38ccf37e (patch)
tree6d0b8f58a53071ee0a7006852b47fb6492af357f /tests/manual/treeview/sidebyside/data/treeview.qml
parent4a32230409c21a5a2534cbe022c4a631eaeda30c (diff)
TreeViewDelegate: allow app to add custom pointer handlers
As it stood, it was not possible to add custom pointer handlers to a TreeViewDelegate, to e.g do an expandRecursive() if using the right mouse button, or holding down ctrl during a click. This patch will change this, so that we only perform the default collapse/expand operations when using a plain left (double) click, and ignore the event otherwise. Change-Id: Ifbdf0903158b65c50d0e36e98ab7e48efaa3e3ab Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 2014101583b89128960f645e57192d1d475767e6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/manual/treeview/sidebyside/data/treeview.qml')
-rw-r--r--tests/manual/treeview/sidebyside/data/treeview.qml15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/manual/treeview/sidebyside/data/treeview.qml b/tests/manual/treeview/sidebyside/data/treeview.qml
index 6587e11f6e..0e97e23a96 100644
--- a/tests/manual/treeview/sidebyside/data/treeview.qml
+++ b/tests/manual/treeview/sidebyside/data/treeview.qml
@@ -114,15 +114,18 @@ ApplicationWindow {
id: testModel
}
- Rectangle {
- anchors.fill: parent
- color: "white"
- z: -1
- }
-
Component {
id: treeViewDelegate
TreeViewDelegate {
+ TapHandler {
+ acceptedModifiers: Qt.ControlModifier
+ onTapped: {
+ if (treeView.isExpanded(row))
+ treeView.collapseRecursively(row)
+ else
+ treeView.expandRecursively(row)
+ }
+ }
}
}