summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-01-11 09:44:55 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-01-11 09:44:55 (GMT)
commit8b42e57fe2946f2cd17f538d0dec2ba6edc06a11 (patch)
tree4a09610e86e7e581de3b30cbe8d06cea79e810aa /src/gui
parent8d76de98d93421395306941e59d136f1e7395d15 (diff)
downloadQt-8b42e57fe2946f2cd17f538d0dec2ba6edc06a11.zip
Qt-8b42e57fe2946f2cd17f538d0dec2ba6edc06a11.tar.gz
Qt-8b42e57fe2946f2cd17f538d0dec2ba6edc06a11.tar.bz2
QTreeView::selectAll() wouldn't work when first column hidden
QTreeView::selectAll() called QTreeView::select() on the first column, first and last rows, and rows selection flags. As the first row was hidden, this range spanned to void. We now pass the upper-left and lower-right indices to select(). Auto-test included. Reviewed-by: Olivier Task-number: QTBUG-6450
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/itemviews/qtreeview.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index bf88a75..f25d648 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -2644,10 +2644,13 @@ void QTreeView::selectAll()
return;
SelectionMode mode = d->selectionMode;
d->executePostedLayout(); //make sure we lay out the items
- if (mode != SingleSelection && !d->viewItems.isEmpty())
- d->select(d->viewItems.first().index, d->viewItems.last().index,
+ if (mode != SingleSelection && !d->viewItems.isEmpty()) {
+ const QModelIndex &idx = d->viewItems.last().index;
+ QModelIndex lastItemIndex = idx.sibling(idx.row(), d->model->columnCount(idx.parent()) - 1);
+ d->select(d->viewItems.first().index, lastItemIndex,
QItemSelectionModel::ClearAndSelect
|QItemSelectionModel::Rows);
+ }
}
/*!