summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoni Poikelin <joni.poikelin@qt.io>2021-03-15 12:54:45 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-04-11 03:24:04 +0000
commit25964161a369996fbee8ce1909a3d6995be44f41 (patch)
tree77065eaf2fa80ba078f62b089f0485e492fc064c /tests
parent97ee332ee6b95937c78b7cd4dbb5a03120e56f26 (diff)
Fix removing columns when QSortFilterProxyModel has not been sorted yet
Fixes: QTBUG-91788 Change-Id: Iddcafd3171f0f3703b94893a32b4ccaaeea9e713 Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit e287582cba74ddcfc67f83647e72c0b23bd99c36) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp b/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp
index 43a34f4e9c..e1ea7a4552 100644
--- a/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp
@@ -116,6 +116,7 @@ private Q_SLOTS:
void shouldPropagateDropBetweenItemsAtModelBoundary();
void shouldPropagateDropAfterLastRow_data();
void shouldPropagateDropAfterLastRow();
+ void qtbug91788();
private:
QStandardItemModel mod;
@@ -829,6 +830,19 @@ void tst_QConcatenateTablesProxyModel::shouldPropagateDropAfterLastRow()
}
+void tst_QConcatenateTablesProxyModel::qtbug91788()
+{
+ QConcatenateTablesProxyModel proxyConcat;
+ QStringList strList{QString("one"),QString("two")};
+ QStringListModel strListModelA(strList);
+ QSortFilterProxyModel proxyFilter;
+ proxyFilter.setSourceModel(&proxyConcat);
+
+ proxyConcat.addSourceModel(&strListModelA);
+ proxyConcat.removeSourceModel(&strListModelA); // This should not assert
+ QCOMPARE(proxyConcat.columnCount(), 0);
+}
+
QTEST_GUILESS_MAIN(tst_QConcatenateTablesProxyModel)
#include "tst_qconcatenatetablesproxymodel.moc"