]>
Commit | Line | Data |
---|---|---|
edb488de AM |
1 | From 6d76e943dab0971d376cebb15fe531efc60622ac Mon Sep 17 00:00:00 2001 |
2 | From: Friedemann Kleint <Friedemann.Kleint@digia.com> | |
3 | Date: Mon, 5 May 2014 10:59:56 +0200 | |
4 | Subject: [PATCH 25/37] Fix visual index lookup in | |
5 | QTreeViewPrivate::adjustViewOptionsForIndex(). | |
6 | ||
7 | Determine the visual index by looking up the column of the QModelIndex | |
8 | in the logicalIndices array instead of looping. | |
9 | ||
10 | Task-number: QTBUG-37813 | |
11 | Change-Id: I5c3c73c67537877b03cdc2c36a52041d99f7f49d | |
12 | Reviewed-by: David Faure <david.faure@kdab.com> | |
13 | (cherry picked from qtbase/85aef2dd4b059d2ba9cba4605d9fef87f3e2c4fc) | |
14 | --- | |
15 | src/gui/itemviews/qtreeview.cpp | 11 ++--------- | |
16 | tests/auto/qtreeview/tst_qtreeview.cpp | 27 +++++++++++++++++++++++++++ | |
17 | 2 files changed, 29 insertions(+), 9 deletions(-) | |
18 | ||
19 | diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp | |
20 | index f506f48..fdf020e 100644 | |
21 | --- a/src/gui/itemviews/qtreeview.cpp | |
22 | +++ b/src/gui/itemviews/qtreeview.cpp | |
23 | @@ -1367,15 +1367,8 @@ void QTreeViewPrivate::adjustViewOptionsForIndex(QStyleOptionViewItemV4 *option, | |
24 | const int right = (spanning ? header->visualIndex(0) : header->count() - 1 ); | |
25 | calcLogicalIndices(&logicalIndices, &viewItemPosList, left, right); | |
26 | ||
27 | - int columnIndex = 0; | |
28 | - for (int visualIndex = 0; visualIndex < current.column(); ++visualIndex) { | |
29 | - int logicalIndex = header->logicalIndex(visualIndex); | |
30 | - if (!header->isSectionHidden(logicalIndex)) { | |
31 | - ++columnIndex; | |
32 | - } | |
33 | - } | |
34 | - | |
35 | - option->viewItemPosition = viewItemPosList.at(columnIndex); | |
36 | + const int visualIndex = logicalIndices.indexOf(current.column()); | |
37 | + option->viewItemPosition = viewItemPosList.at(visualIndex); | |
38 | } | |
39 | ||
40 | ||
41 | -- | |
42 | 1.9.3 | |
43 |