From d7b5c9766c8270241276a4cac6eae0373142f9b5 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 9 Dec 2018 13:54:30 +0100 Subject: [PATCH] fixed missing filterAcceptsRow() in forum proxy model --- .../src/gui/gxsforums/GxsForumThreadWidget.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 4603695c1..10ed08a07 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -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