fixed missing filterAcceptsRow() in forum proxy model

This commit is contained in:
csoler 2018-12-09 13:54:30 +01:00
parent d5928ca84e
commit d7b5c9766c
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C

View File

@ -285,6 +285,14 @@ public:
return left.data(RsGxsForumModel::SortRole) < right.data(RsGxsForumModel::SortRole) ;
}
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
{
//std::cerr << "FilterAcceptsRow(): source_row=" << source_row << " parent=" << (void*)source_parent.internalPointer() << " role=\"" <<
// sourceModel()->index(source_row,0,source_parent).data(RsGxsForumModel::FilterRole).toString().toStdString() << std::endl;
return sourceModel()->index(source_row,0,source_parent).data(RsGxsForumModel::FilterRole).toString() == RsGxsForumModel::FilterString ;
}
private:
const QHeaderView *m_header ;
};
@ -1684,6 +1692,9 @@ void GxsForumThreadWidget::filterItems(const QString& text)
uint32_t count;
mThreadModel->setFilter(filterColumn,lst,count) ;
// We do this in order to trigger a new filtering action in the proxy model.
mThreadProxyModel->setFilterRegExp(QRegExp(QString(RsGxsForumModel::FilterString))) ;
if(!lst.empty())
ui->threadTreeWidget->expandAll();
else