KItemModels

krecursivefilterproxymodel.h
1 /*
2  SPDX-FileCopyrightText: 2009 Stephen Kelly <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef KRECURSIVEFILTERPROXYMODEL_H
8 #define KRECURSIVEFILTERPROXYMODEL_H
9 
10 #include "kitemmodels_export.h"
11 
12 #if KITEMMODELS_ENABLE_DEPRECATED_SINCE(5, 65)
13 #include <QSortFilterProxyModel>
14 
15 class KRecursiveFilterProxyModelPrivate;
16 
80 class KITEMMODELS_EXPORT KRecursiveFilterProxyModel : public QSortFilterProxyModel
81 {
82  Q_OBJECT
83 public:
87  KITEMMODELS_DEPRECATED_VERSION(5, 65, "Use QSortFilterProxyModel directly and QSortFilterProxyModel::setRecursiveFilteringEnabled(true)")
88  explicit KRecursiveFilterProxyModel(QObject *parent = nullptr);
89 
93  ~KRecursiveFilterProxyModel() override;
94 
96  void setSourceModel(QAbstractItemModel *model) override;
97 
101  QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits = 1,
103 
104 protected:
108  virtual bool acceptRow(int sourceRow, const QModelIndex &sourceParent) const;
109 
111  bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
112 
113  KRecursiveFilterProxyModelPrivate *const d_ptr;
114 
115 private:
116  //@cond PRIVATE
117  Q_DECLARE_PRIVATE(KRecursiveFilterProxyModel)
118 
119  Q_PRIVATE_SLOT(d_func(), void sourceDataChanged(const QModelIndex &source_top_left, const QModelIndex &source_bottom_right, const QVector<int> &roles = QVector<int>()))
120  Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeInserted(const QModelIndex &source_parent, int start, int end))
121  Q_PRIVATE_SLOT(d_func(), void sourceRowsInserted(const QModelIndex &source_parent, int start, int end))
122  Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeRemoved(const QModelIndex &source_parent, int start, int end))
123  Q_PRIVATE_SLOT(d_func(), void sourceRowsRemoved(const QModelIndex &source_parent, int start, int end))
124  //@endcond
125 };
126 
127 #endif
128 
129 #endif
typedef MatchFlags
virtual void setSourceModel(QAbstractItemModel *sourceModel) override
virtual QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits, Qt::MatchFlags flags) const const override
Implements recursive filtering of models.
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 22:50:00 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.