From deee95ecd5d92b93956061d4e6ae63246b8bc928 Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 14 Jun 2013 15:14:58 +0200 Subject: Filter recursive Well, well... Recursion isn't that bad at all. Filter experimental ArchiveView recursive by the following rules: * check children _and_ parents for filter * if any child _or_ parent matches, accept the current row, parents and children. The column is converted to a QString and matched by QRegExp, so don't try to match numbers or anything else. --- archivemodel.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'archivemodel.h') diff --git a/archivemodel.h b/archivemodel.h index 8055c31..29f10ab 100644 --- a/archivemodel.h +++ b/archivemodel.h @@ -30,6 +30,7 @@ class ArchiveModel : public SmTreeModel { ArchiveCollector *collector() { return mCollector; } virtual QVariant data(const QModelIndex &index, int role) const; virtual bool setData(const QModelIndex &idx, const QVariant &value, int role); + virtual bool matchRecursive(const QModelIndex &parent, const QRegExp ®ex, int column = 0) const; virtual bool removeNode(const QModelIndex &idx); QStringList indexToPath(const QModelIndex &idx) const; QModelIndexList pathToIndex(const QStringList &path) const; @@ -47,6 +48,7 @@ class ArchiveModel : public SmTreeModel { void collectorFinished(); private: + bool checkParents(const SmTreeItem *item, const QRegExp ®ex, int column) const; void emitDatabaseError(const QSqlError &e); QSqlDatabase mDb; QHash mAvailableOrders; -- cgit v1.2.3-70-g09d2