Skip to content

Commit

Permalink
Enable recursive filtering and keeping children, in all QSortFilterPr…
Browse files Browse the repository at this point in the history
…oxyModels

This makes it a lot easier to find e.g. a widget or a model in the tree,
and still see all of its children.
  • Loading branch information
dfaure-kdab committed Jul 19, 2024
1 parent 235acf6 commit 3ce6598
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions core/remote/serverproxymodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@
#include <QVector>

namespace GammaRay {

template<typename BaseProxy> void init(BaseProxy *) {}

template<> inline void init<QSortFilterProxyModel>(QSortFilterProxyModel *proxy)
{
proxy->setRecursiveFilteringEnabled(true);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
proxy->setAutoAcceptChildRows(true);
#endif
}

/** Sort/filter proxy model for server-side use to pass through extra roles in itemData().
* Every remoted proxy model should be wrapped into this template, unless you already have
* a special implementation for itemData() handling this.
Expand All @@ -35,6 +46,7 @@ class ServerProxyModel : public BaseProxy
, m_sourceModel(nullptr)
, m_active(false)
{
init<BaseProxy>(this);
}

/** Additional roles used from the source model for transfer to the client. */
Expand Down

0 comments on commit 3ce6598

Please sign in to comment.