summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qsortfilterproxymodel.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2010-02-22 17:23:23 +0100
committerOlivier Goffart <ogoffart@trolltech.com>2010-02-22 17:23:23 +0100
commit895b9bedc3746723f6c77754df3c428dbc0661d3 (patch)
treeac557328bee8d96c08eb7b19e4b02f593916dfbe /src/gui/itemviews/qsortfilterproxymodel.cpp
parentc42343ab8bedda2700b16b10ee7a7409130cb500 (diff)
QSortFilterProxyModel: Sorting occured unnecessarily when the dynamicSortFilter is turned off
We should not sort when inserting items if the dinamicSortFilter flag is set to false. Note that some of the test used to rely on the fact that it was sorted. Those test have been fixed. The patch has been contributed to us in the task. Task-number: QTBUG-7716 Reviewed-by: Thierry
Diffstat (limited to 'src/gui/itemviews/qsortfilterproxymodel.cpp')
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index e73013cc9f..c63a07bf42 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
+++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
@@ -563,7 +563,7 @@ QVector<QPair<int, QVector<int > > > QSortFilterProxyModelPrivate::proxy_interva
int proxy_item = 0;
int source_items_index = 0;
QVector<int> source_items_in_interval;
- bool compare = (orient == Qt::Vertical && source_sort_column >= 0);
+ bool compare = (orient == Qt::Vertical && source_sort_column >= 0 && dynamic_sortfilter);
while (source_items_index < source_items.size()) {
source_items_in_interval.clear();
int first_new_source_item = source_items.at(source_items_index);
@@ -1244,7 +1244,7 @@ void QSortFilterProxyModelPrivate::_q_sourceRowsInserted(
const QModelIndex &source_parent, int start, int end)
{
source_items_inserted(source_parent, start, end, Qt::Vertical);
- if (update_source_sort_column()) //previous call to update_source_sort_column may fail if the model has no column.
+ if (update_source_sort_column() && dynamic_sortfilter) //previous call to update_source_sort_column may fail if the model has no column.
sort(); // now it should succeed so we need to make sure to sort again
}
@@ -1281,8 +1281,8 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsInserted(
if (source_parent.isValid())
return; //we sort according to the root column only
if (source_sort_column == -1) {
- //we update the source_sort_column depending on the prox_sort_column
- if (update_source_sort_column())
+ //we update the source_sort_column depending on the proxy_sort_column
+ if (update_source_sort_column() && dynamic_sortfilter)
sort();
} else {
if (start <= source_sort_column)