qt/0025-Fix-visual-index-lookup-in-QTreeViewPrivate-adjustVi.patch
Rex Dieter 0aff623ddf backport selected upstream commits...
- Fix visual index lookup (QTBUG-37813)
- RGB30 fix (QTBUG-25998,#1018566)
- QDBus comparison
2014-06-03 17:28:09 -05:00

44 lines
1.7 KiB
Diff

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