Skip to content

Commit 627c1dd

Browse files
committed
fix: use autoAcceptChildRows to make docs appear when a parent folder is matching the filter
1 parent 07064de commit 627c1dd

1 file changed

Lines changed: 2 additions & 20 deletions

File tree

src/document/UBSortFilterProxyModel.cpp

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ UBSortFilterProxyModel::UBSortFilterProxyModel():
77
setDynamicSortFilter(false);
88
setSortCaseSensitivity(Qt::CaseInsensitive);
99
setRecursiveFilteringEnabled(true);
10+
setAutoAcceptChildRows(true);
1011
}
1112

1213
bool UBSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
@@ -28,24 +29,5 @@ bool UBSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex
2829
bool UBSortFilterProxyModel::filterAcceptsRow(int sourceRow,
2930
const QModelIndex &sourceParent) const
3031
{
31-
UBDocumentTreeModel *model = dynamic_cast<UBDocumentTreeModel*>(sourceModel());
32-
if(model == nullptr)
33-
{
34-
return false;
35-
}
36-
else
37-
{
38-
QModelIndex idx = model->index(sourceRow, 0, sourceParent);
39-
40-
if (idx.isValid())
41-
{
42-
if (idx == model->myDocumentsIndex() || idx == model->trashIndex())
43-
{
44-
return true;
45-
}
46-
}
47-
48-
// Filter the documents
49-
return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
50-
}
32+
return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
5133
}

0 commit comments

Comments
 (0)