diff options
Diffstat (limited to 'src/controls/TreeView.qml')
-rw-r--r-- | src/controls/TreeView.qml | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/controls/TreeView.qml b/src/controls/TreeView.qml index 6a38acff..2bedb9e6 100644 --- a/src/controls/TreeView.qml +++ b/src/controls/TreeView.qml @@ -49,7 +49,7 @@ BasicTableView { property var model: null property alias rootIndex: modelAdaptor.rootIndex - readonly property var currentIndex: modelAdaptor.mapRowToModelIndex(__currentRow) + readonly property var currentIndex: modelAdaptor.updateCount, modelAdaptor.mapRowToModelIndex(__currentRow) property ItemSelectionModel selection: null signal activated(var index) @@ -96,6 +96,12 @@ BasicTableView { id: modelAdaptor model: root.model + // Hack to force re-evaluation of the currentIndex binding + property int updateCount: 0 + onModelReset: updateCount++ + onRowsInserted: updateCount++ + onRowsRemoved: updateCount++ + onExpanded: root.expanded(index) onCollapsed: root.collapsed(index) } |