KCGroups

kapplicationscopelistmodel.h
1 // SPDX-FileCopyrightText: 2020 Henri Chain <[email protected]>
2 // SPDX-FileCopyrightText: 2020 Kevin Ottens <[email protected]>
3 //
4 // SPDX-License-Identifier: LGPL-2.1-or-later
5 
6 #ifndef KAPPLICATIONSCOPELISTMODEL_H
7 #define KAPPLICATIONSCOPELISTMODEL_H
8 
9 #include "kapplicationscope.h"
10 #include "kapplicationscopelister.h"
11 #include "kcgroups_export.h"
12 #include <QAbstractListModel>
13 
14 class KApplicationScopeListModelPrivate;
15 
16 /**
17  * @brief A ListModel for use in QML to interact with an updated list of KApplicationScope's.
18  * Implements QAbstractListModel
19  * @implements QAbstractListModel
20  */
21 class KCGROUPS_EXPORT KApplicationScopeListModel : public QAbstractListModel
22 {
23  Q_OBJECT
24 public:
25  /**
26  * @brief The exposed data roles
27  */
29  /**
30  * Corresponds to KApplicationScope object
31  */
32  ObjectRole = Qt::UserRole + 1,
33  };
35 
36  explicit KApplicationScopeListModel(QObject *parent = nullptr);
37 
38  /**
39  * @brief Used when a KApplicationScopeLister is already on hand
40  * @param lister
41  * @param parent
42  */
43  explicit KApplicationScopeListModel(KApplicationScopeLister *lister, QObject *parent = nullptr);
44  ~KApplicationScopeListModel() override;
45 
46  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
47  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
48  QHash<int, QByteArray> roleNames() const override;
49 
50 private:
51  KApplicationScopeListModelPrivate *const d_ptr;
52  Q_DECLARE_PRIVATE(KApplicationScopeListModel)
53 };
54 
55 #endif // KAPPLICATIONSCOPELISTMODEL_H
Q_ENUM(...)
A ListModel for use in QML to interact with an updated list of KApplicationScope&#39;s.
KApplicationScopeRoles
The exposed data roles.
Keeps an updated list of desktop application systemd scopes.
UserRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 23:05:48 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.