summaryrefslogtreecommitdiffstats
path: root/framework/qml/TreeView.qml
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-07-27 10:45:36 -0600
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-07-27 11:01:21 -0600
commite760e18882a314e3b4b3fd61fe3e6e631955ff11 (patch)
tree08d3cde98651cc22f671ee0bb0bfe061c7ffe7f1 /framework/qml/TreeView.qml
parent735b0027f8ff1d5093b232d521aaa099383d2bf9 (diff)
downloadkube-e760e18882a314e3b4b3fd61fe3e6e631955ff11.tar.gz
kube-e760e18882a314e3b4b3fd61fe3e6e631955ff11.zip
Reselect activeIndex
Diffstat (limited to 'framework/qml/TreeView.qml')
-rw-r--r--framework/qml/TreeView.qml18
1 files changed, 9 insertions, 9 deletions
diff --git a/framework/qml/TreeView.qml b/framework/qml/TreeView.qml
index 5bfa7600..e1818a0b 100644
--- a/framework/qml/TreeView.qml
+++ b/framework/qml/TreeView.qml
@@ -87,18 +87,18 @@ FocusScope {
87 //TODO scroll view so the current index is always visible 87 //TODO scroll view so the current index is always visible
88 } 88 }
89 89
90 function selectFirst()
91 {
92 treeView.selection.setCurrentIndex(model.index(0, 0), ItemSelectionModel.ClearAndSelect)
93 }
94 90
95 onActiveFocusChanged: { 91 onActiveFocusChanged: {
96 //Set an initially focused item when the list view receives focus 92 //Set an initially focused item when the list view receives focus
97 if (activeFocus && !selection.hasSelection) { 93 if (activeFocus) {
98 selectFirst() 94 //If there is a selected index, reset to selected index.
99 } 95 if (root.activeIndex) {
100 if (!activeFocus) { 96 treeView.selection.setCurrentIndex(root.activeIndex, ItemSelectionModel.Current)
101 selection.clear() 97 } else {
98 treeView.selection.setCurrentIndex(model.index(0, 0), ItemSelectionModel.ClearAndSelect)
99 }
100 } else {
101 selection.clearCurrentIndex()
102 } 102 }
103 } 103 }
104 104