diff options
author | Jiewen Wang <jiewen.wang@logicpd.com> | 2012-05-31 12:20:49 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-31 21:45:30 (GMT) |
commit | ebaaff84fc0355d2e026da7f5ca015280b2c7d82 (patch) | |
tree | 11a1ac00570afe696bccb2bcb8ba24270b4992ed /src/gui | |
parent | 4ec0baf312ec2b26b1dfbee34a22b2ef7dfeccf1 (diff) | |
download | Qt-ebaaff84fc0355d2e026da7f5ca015280b2c7d82.zip Qt-ebaaff84fc0355d2e026da7f5ca015280b2c7d82.tar.gz Qt-ebaaff84fc0355d2e026da7f5ca015280b2c7d82.tar.bz2 |
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: Ie129cb63445bf1239ef7c5b2bc61b04dd9e81982
Task-Id: QTBUG-25333
Backport of <3be6ca3ee8c2c72f85b26a57538fd329ed811261> from Qt5
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/itemviews/qtreeview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 1a8a686..ffd1ad0 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -1357,7 +1357,7 @@ QItemViewPaintPairs QTreeViewPrivate::draggablePaintPairs(const QModelIndexList void QTreeViewPrivate::adjustViewOptionsForIndex(QStyleOptionViewItemV4 *option, const QModelIndex ¤t) 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); |