KCGroups

kapplicationscopelistmodel.h
1// SPDX-FileCopyrightText: 2020 Henri Chain <henri.chain@enioka.com>
2// SPDX-FileCopyrightText: 2020 Kevin Ottens <kevin.ottens@enioka.com>
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
14class 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 */
21class KCGROUPS_EXPORT KApplicationScopeListModel : public QAbstractListModel
22{
23 Q_OBJECT
24public:
25 /**
26 * @brief The exposed data roles
27 */
29 /**
30 * Corresponds to KApplicationScope object
31 */
32 ObjectRole = Qt::UserRole + 1,
33 };
34 Q_ENUM(KApplicationScopeRoles)
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);
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
50private:
51 KApplicationScopeListModelPrivate *const d_ptr;
52 Q_DECLARE_PRIVATE(KApplicationScopeListModel)
53};
54
55#endif // KAPPLICATIONSCOPELISTMODEL_H
A ListModel for use in QML to interact with an updated list of KApplicationScope's.
KApplicationScopeRoles
The exposed data roles.
Keeps an updated list of desktop application systemd scopes.
virtual QVariant data(const QModelIndex &index, int role) const const=0
virtual QHash< int, QByteArray > roleNames() const const
virtual int rowCount(const QModelIndex &parent) const const=0
Q_ENUM(...)
UserRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:17:27 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.