KCMUtils

kpluginproxymodel.h
1 /*
2  SPDX-FileCopyrightText: 2021 Alexander Lohnau <[email protected]>
3  SPDX-License-Identifier: LGPL-2.0-or-later
4 */
5 
6 #include "kcmutilscore_export.h"
7 
8 #include <KCategorizedSortFilterProxyModel>
9 
10 class Q_DECL_HIDDEN KPluginProxyModel : public KCategorizedSortFilterProxyModel
11 {
12  Q_OBJECT
13  Q_PROPERTY(QString query READ query WRITE setQuery NOTIFY queryChanged)
14  Q_PROPERTY(QAbstractListModel *model WRITE setModel)
15 public:
16  explicit KPluginProxyModel(QObject *parent = nullptr);
17  ~KPluginProxyModel() override;
18 
19  QString query() const;
20  void setQuery(const QString &query);
21  void setModel(QAbstractListModel *model)
22  {
23  setSourceModel(model);
24  }
25 
26 Q_SIGNALS:
27  void queryChanged();
28 
29 protected:
30  bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
31  bool subSortLessThan(const QModelIndex &left, const QModelIndex &right) const override;
32 
33 private:
34  QString m_query;
35 };
Q_PROPERTY(...)
virtual void setSourceModel(QAbstractItemModel *sourceModel) override
KSERVICE_EXPORT KService::List query(FilterFunc filterFunc)
Q_SIGNALSQ_SIGNALS
virtual bool subSortLessThan(const QModelIndex &left, const QModelIndex &right) const
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jun 25 2022 06:17:34 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.