summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorJiewen Wang <jiewen.wang@logicpd.com>2012-05-25 09:41:03 -0400
committerQt by Nokia <qt-info@nokia.com>2012-05-28 16:49:56 +0200
commit3be6ca3ee8c2c72f85b26a57538fd329ed811261 (patch)
tree502d250b94f98cae6f01bbae11e62ae14489c487 /src/widgets
parent177070cb7b64dc90ef637f5e68440ba733931fa8 (diff)
Eliminate QTreeWidget drag crash
In QTreeViewPrivate::adjustViewOptionsForIndex() wrong index had been used when referencing to array of viewItems. Variable row is set to the index of the QModelIndex, however it is not as same as the index in viewItems[] when there was hidden item in treeWidget. Index of viewItems[] should be used here. Unit test is added as well. Change-Id: Idc7eda979e7d09c5a07bd6dffd92b7abbac10e67 Task-Id: QTBUG-25333 Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/itemviews/qtreeview.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index f2a2ef2ca2..62d94d0004 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -1357,7 +1357,7 @@ QItemViewPaintPairs QTreeViewPrivate::draggablePaintPairs(const QModelIndexList
void QTreeViewPrivate::adjustViewOptionsForIndex(QStyleOptionViewItemV4 *option, const QModelIndex &current) const
{
- const int row = current.row();
+ const int row = viewIndex(current); // get the index in viewItems[]
option->state = option->state | (viewItems.at(row).expanded ? QStyle::State_Open : QStyle::State_None)
| (viewItems.at(row).hasChildren ? QStyle::State_Children : QStyle::State_None)
| (viewItems.at(row).hasMoreSiblings ? QStyle::State_Sibling : QStyle::State_None);