diff --git a/autotests/krecursivefilterproxymodeltest.cpp b/autotests/krecursivefilterproxymodeltest.cpp index 85dbdfa..69edac5 100644 --- a/autotests/krecursivefilterproxymodeltest.cpp +++ b/autotests/krecursivefilterproxymodeltest.cpp @@ -551,9 +551,11 @@ private Q_SLOTS: const QStringList remove1_1_1 = (QStringList() << QStringLiteral("rowsAboutToBeRemoved(1.1.1)") << QStringLiteral("rowsRemoved(1.1.1)")); - QTest::newRow("toplevel") << "[1*]" << "[1*]" << "1" << "" + QTest::newRow("toplevel") << "[1* 2* 3*]" << "[1* 2* 3*]" << "1" << "[2* 3*]" << (QStringList() << QStringLiteral("rowsAboutToBeRemoved(1)") << QStringLiteral("rowsRemoved(1)")); + QTest::newRow("remove_hidden") << "[1 2* 3*]" << "[2* 3*]" << "1" << "[2* 3*]" << QStringList(); + QTest::newRow("parent_hidden") << "[1[1.1[1.1.1]]]" << "" << "1.1.1" << "" << QStringList(); QTest::newRow("child_hidden") << "[1[1.1*[1.1.1]]]" << "[1[1.1*]]" << "1.1.1" << "[1[1.1*]]" << QStringList(); diff --git a/src/krecursivefilterproxymodel.cpp b/src/krecursivefilterproxymodel.cpp index 10632ec..f6ae609 100644 --- a/src/krecursivefilterproxymodel.cpp +++ b/src/krecursivefilterproxymodel.cpp @@ -230,21 +230,6 @@ void KRecursiveFilterProxyModelPrivate::sourceRowsInserted(const QModelIndex &so void KRecursiveFilterProxyModelPrivate::sourceRowsAboutToBeRemoved(const QModelIndex &source_parent, int start, int end) { - Q_Q(KRecursiveFilterProxyModel); - - bool accepted = false; - for (int row = start; row <= end; ++row) { - if (q->filterAcceptsRow(row, source_parent)) { - accepted = true; - break; - } - } - if (!accepted) { - // All removed rows are already filtered out. We don't care about the signal. - ignoreRemove = true; - return; - } - invokeRowsAboutToBeRemoved(source_parent, start, end); } @@ -252,11 +237,6 @@ void KRecursiveFilterProxyModelPrivate::sourceRowsRemoved(const QModelIndex &sou { Q_Q(KRecursiveFilterProxyModel); - if (ignoreRemove) { - ignoreRemove = false; - return; - } - invokeRowsRemoved(source_parent, start, end); // Find out if removing this visible row means that some ascendant