summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-11-13 14:00:25 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-11-13 14:07:33 (GMT)
commitaefd76b0052cd36ed7f890dd4b91f38873bec251 (patch)
tree802d87f8d0f48c22c3997ab12deac5abadf8d93c /src
parentd324a151a45fa30ff3cb139ce009a1ba20122c7e (diff)
downloadQt-aefd76b0052cd36ed7f890dd4b91f38873bec251.zip
Qt-aefd76b0052cd36ed7f890dd4b91f38873bec251.tar.gz
Qt-aefd76b0052cd36ed7f890dd4b91f38873bec251.tar.bz2
QItemSelectionModel: fixed selection not kept when layout change and everything is selected
The arbitrary number in commit 8a7700ffb5e4959e78 was not big enough. People still complains Task-number: QTBUG-5671 Reviewed-by: Thierry
Diffstat (limited to 'src')
-rw-r--r--src/gui/itemviews/qitemselectionmodel.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp
index c6e02a6..2e4a602 100644
--- a/src/gui/itemviews/qitemselectionmodel.cpp
+++ b/src/gui/itemviews/qitemselectionmodel.cpp
@@ -730,13 +730,14 @@ void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged()
savedPersistentIndexes.clear();
savedPersistentCurrentIndexes.clear();
- // special case for when all indexes are selected
+ // optimisation for when all indexes are selected
+ // (only if there is lots of items (1000) because this is not entirely correct)
if (ranges.isEmpty() && currentSelection.count() == 1) {
QItemSelectionRange range = currentSelection.first();
QModelIndex parent = range.parent();
tableRowCount = model->rowCount(parent);
tableColCount = model->columnCount(parent);
- if (tableRowCount * tableColCount > 100
+ if (tableRowCount * tableColCount > 1000
&& range.top() == 0
&& range.left() == 0
&& range.bottom() == tableRowCount - 1