diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-05-05 10:59:56 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-06 16:35:56 +0200 |
commit | 85aef2dd4b059d2ba9cba4605d9fef87f3e2c4fc (patch) | |
tree | e26f04c56a4973d8a29f6c39544c99f2fb6357b8 /src/widgets/itemviews | |
parent | 344562aff7b86376cd6e09033e44400782ca327e (diff) |
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>
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r-- | src/widgets/itemviews/qtreeview.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 781dd345bd..3f952ff768 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtWidgets module of the Qt Toolkit. @@ -1421,15 +1421,8 @@ void QTreeViewPrivate::adjustViewOptionsForIndex(QStyleOptionViewItem *option, c 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); } |