diff options
author | Joni Poikelin <joni.poikelin@qt.io> | 2021-03-15 12:54:45 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-03-30 15:13:04 +0000 |
commit | 0497f16fa7fcbb6abc4e5aa6fed0f609fd3a7776 (patch) | |
tree | 799f2945b1466fc3323c974bca89a10b89d383ee /tests/auto/corelib/itemmodels | |
parent | 9053ea563f08fe223b150106fb5b128e28a002bc (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/auto/corelib/itemmodels')
-rw-r--r-- | tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp | 14 |
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" |