97378e4
From 1ec9dd029abaa0f00798535fdb1722154b1c63f6 Mon Sep 17 00:00:00 2001
97378e4
From: =?utf-8?q?Rafael=20Fern=C3=A1ndez=20L=C3=B3pez?= <ereslibre@kde.org>
97378e4
Date: Sun, 26 Oct 2008 10:40:51 +0100
97378e4
Subject: [PATCH 08/18] In a treeview with columns like this:
97378e4
97378e4
Column 1 | Column 2 | ... | Column k | ... | Column n
97378e4
97378e4
When selecting with rubberband (by clicking on the blank part of the viewport) while Column k is
97378e4
hidden, you get double items on the selection model, when asking for selection(). This is becase
97378e4
ranges are incorrectly calculated when there are hidden columns. A way to reproduce:
97378e4
97378e4
Column 1 | Column 2 | Column 4 (Column 3 is hidden)
97378e4
 item
97378e4
 item
97378e4
 item
97378e4
  x <- press button here and move it up to select items (on this same column)
97378e4
97378e4
If you do like this:
97378e4
97378e4
Column 1 | Column 2 | Column 4 (Column 3 is hidden)
97378e4
 item
97378e4
 item
97378e4
 item
97378e4
                         x <- press button here and move it up
97378e4
97378e4
you won't be able to reproduce, since you need the hidden column to be between the one you click and
97378e4
the last one. The reason is that columnRanges returns two ranges when there is supposed to return 1
97378e4
range (even when there are hidden columns).
97378e4
97378e4
qt-bugs@ issue : N232819
97378e4
Trolltech task ID : 232831
97378e4
bugs.kde.org number : 171436
97378e4
---
97378e4
 src/gui/itemviews/qtreeview.cpp |    2 +-
97378e4
 1 files changed, 1 insertions(+), 1 deletions(-)
97378e4
97378e4
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
97378e4
index ed6ad03..dc147f2 100644
97378e4
--- a/src/gui/itemviews/qtreeview.cpp
97378e4
+++ b/src/gui/itemviews/qtreeview.cpp
97378e4
@@ -3575,7 +3575,7 @@ QList<QPair<int, int> > QTreeViewPrivate::columnRanges(const QModelIndex &topInd
97378e4
     current.first = -2; // -1 is not enough because -1+1 = 0
97378e4
     current.second = -2;
97378e4
     foreach (int logicalColumn, logicalIndexes) {
97378e4
-        if (current.second + 1 != logicalColumn) {
97378e4
+        if (current.second + 1 != logicalColumn && !header->isSectionHidden(current.second + 1)) {
97378e4
             if (current.first != -2) {
97378e4
                 //let's save the current one
97378e4
                 ret += current;
97378e4
-- 
97378e4
1.6.2.5
97378e4