From 280c75090cb518f0f1a4e2b470a7722f95b9c9ab Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 17 Feb 2018 19:29:41 +0100 Subject: Make filtering useful Add a custom QSortFilterProxyModel which filterAcceptsRow() returns true if the uppermost parent matches the filter RegExp. --- collectionwidgetproxy.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 collectionwidgetproxy.h (limited to 'collectionwidgetproxy.h') diff --git a/collectionwidgetproxy.h b/collectionwidgetproxy.h new file mode 100644 index 0000000..d67f615 --- /dev/null +++ b/collectionwidgetproxy.h @@ -0,0 +1,14 @@ +#ifndef COLLECTIONWIDGETPROXY_H +#define COLLECTIONWIDGETPROXY_H + +#include + +class CollectionWidgetProxy : public QSortFilterProxyModel { + public: + CollectionWidgetProxy(QObject *parent = nullptr); + + protected: + bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; +}; + +#endif // COLLECTIONWIDGETPROXY_H -- cgit v1.2.3-70-g09d2