{
Q_Q(const QSortFilterProxyModel);
+ const int colCount = model->columnCount(source_parent);
+ if (colCount == 0) // don't call index(row, 0) if there's no such column
+ return false;
+
const QModelIndex index = model->index(source_row, 0, source_parent);
const int count = model->rowCount(index);
void shouldPropagateDropBetweenItemsAtModelBoundary();
void shouldPropagateDropAfterLastRow_data();
void shouldPropagateDropAfterLastRow();
+ void addModelWithFilterOnTop();
void qtbug91788();
void qtbug91878();
void createPersistentOnLayoutAboutToBeChanged();
}
+class RefuseRowsProxy : public QSortFilterProxyModel
+{
+public:
+ bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
+ {
+ Q_UNUSED(source_row)
+ Q_UNUSED(source_parent)
+ return false;
+ }
+};
+
+void tst_QConcatenateTablesProxyModel::addModelWithFilterOnTop() // QTBUG-134210
+{
+ // Given a QSFPM -> QConcatenateTablesProxyModel and a QStandardItemModel
+ QStandardItemModel sim;
+ sim.appendRow(new QStandardItem("ITEM"));
+
+ QConcatenateTablesProxyModel concat;
+ RefuseRowsProxy proxyFilter;
+ proxyFilter.setSourceModel(&concat);
+ proxyFilter.setRecursiveFilteringEnabled(true);
+
+ // When adding the QStandardItemModel as source model
+ concat.addSourceModel(&sim);
+
+ // Then the item should be filtered out
+ // (without hitting an assert in QConcat::index() nor an infinite recursion in QSFPM)
+ QCOMPARE(concat.rowCount(), 1);
+ QCOMPARE(concat.columnCount(), 1);
+ QCOMPARE(proxyFilter.rowCount(), 0);
+ QCOMPARE(proxyFilter.columnCount(), 1);
+}
+
void tst_QConcatenateTablesProxyModel::qtbug91788()
{
QConcatenateTablesProxyModel proxyConcat;