summaryrefslogtreecommitdiff
path: root/src/controls/Private/TreeViewItemDelegateLoader.qml
diff options
context:
space:
mode:
authorJoni Poikelin <joni.poikelin@theqtcompany.com>2016-04-06 13:50:08 +0300
committerJoni Poikelin <joni.poikelin@qt.io>2016-08-26 07:59:40 +0000
commit69b3136bae16897492d27558c5909cd61a5e598e (patch)
tree94be91dcdff8a14bc42a203022157924f447c739 /src/controls/Private/TreeViewItemDelegateLoader.qml
parentf44ef9daf9f0f9db6775fdb6d3fc8703b6ce77e4 (diff)
downloadqtquickcontrols-69b3136bae16897492d27558c5909cd61a5e598e.tar.gz
Fix moving of TreeView items
Property binding for row property in styleData causes an update which tries to read new value for the index property, but index is changed afterwards which causes old value to be read. This may lead to crashes and other unwanted behavior. Depth changes are now delivered to update item depths in visible items and model index changes though role instead of looking for a row change. Task-number: QTBUG-47523 Change-Id: I540cd06a25281f18e4628f4b030cf969dc8e0a7f Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/controls/Private/TreeViewItemDelegateLoader.qml')
-rw-r--r--src/controls/Private/TreeViewItemDelegateLoader.qml2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/controls/Private/TreeViewItemDelegateLoader.qml b/src/controls/Private/TreeViewItemDelegateLoader.qml
index 8b8801fc..01492eda 100644
--- a/src/controls/Private/TreeViewItemDelegateLoader.qml
+++ b/src/controls/Private/TreeViewItemDelegateLoader.qml
@@ -78,7 +78,7 @@ TableViewItemDelegateLoader {
readonly property color textColor: __rowItem ? __rowItem.itemTextColor : "black"
readonly property string role: __column ? __column.role : ""
readonly property var value: model && model.hasOwnProperty(role) ? model[role] : ""
- readonly property var index: __treeModel.mapRowToModelIndex(row)
+ readonly property var index: model ? model["_q_TreeView_ModelIndex"] : __treeModel.index(-1,-1,null)
readonly property int depth: model && column === 0 ? model["_q_TreeView_ItemDepth"] : 0
readonly property bool hasChildren: model ? model["_q_TreeView_HasChildren"] : false
readonly property bool hasSibling: model ? model["_q_TreeView_HasSibling"] : false