summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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