summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsortfilterproxymodel
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-05-25 18:32:46 +0200
committerOlivier Goffart <ogoffart@trolltech.com>2009-05-26 10:37:07 +0200
commit2a390bb481a2433a239a9198e463c9337a26db59 (patch)
tree8c8661482ab497a97fb557fad63fc748c10d4d5d /tests/auto/qsortfilterproxymodel
parent5839b16a73c36ff7636c13f841d26e6a5e0c5435 (diff)
Fixed: QSortFilterProxyModel setDynamicSortFilter doesn't works when setting the model initially
This was caused by two different bug: - In the QSortFilterProxyModel, we need to re-sort when setting the source model change the sorting column (happen when setting a model initially) - In the treeview, we need to activate the sorting even if there is no column yet (because the initial model is empty Task-number: 254234 Reviewed-by: Thierry BT:
Diffstat (limited to 'tests/auto/qsortfilterproxymodel')
-rw-r--r--tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index bd66fdf008..80d90a6790 100644
--- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -2585,6 +2585,16 @@ void tst_QSortFilterProxyModel::task248868_dynamicSorting()
QModelIndex index = proxy1.index(row, 0, QModelIndex());
QCOMPARE(proxy1.data(index, Qt::DisplayRole).toString(), expected.at(row));
}
+
+ //set up the sorting before seting the model up
+ QSortFilterProxyModel proxy2;
+ proxy2.setDynamicSortFilter(true);
+ proxy2.sort(0);
+ proxy2.setSourceModel(&model2);
+ for (int row = 0; row < proxy2.rowCount(QModelIndex()); ++row) {
+ QModelIndex index = proxy2.index(row, 0, QModelIndex());
+ QCOMPARE(proxy2.data(index, Qt::DisplayRole).toString(), expected.at(row));
+ }
}
class QtTestModel: public QAbstractItemModel