KNewStuff

providersmodel.h
1/*
2 SPDX-FileCopyrightText: 2021 Dan Leinir Turthra Jensen <admin@leinir.dk>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef KNSCORE_PROVIDERSMODELL_H
8#define KNSCORE_PROVIDERSMODELL_H
9
10#include <QAbstractListModel>
11
12#include "knewstuffcore_export.h"
13
14#include <memory>
15
16namespace KNSCore
17{
18class ProvidersModelPrivate;
19/**
20 * @brief A model which holds information on all known Providers for a specific Engine
21 *
22 * @since 5.85
23 */
25{
26 Q_OBJECT
27 /**
28 * The Engine for which this model displays Providers
29 */
30 Q_PROPERTY(QObject *engine READ engine WRITE setEngine NOTIFY engineChanged)
31public:
32 explicit ProvidersModel(QObject *parent = nullptr);
33 ~ProvidersModel() override;
34
35 enum Roles {
36 IdRole = Qt::UserRole + 1,
37 NameRole,
38 VersionRole,
39 WebsiteRole,
40 HostRole,
41 ContactEmailRole,
42 SupportsSslRole,
43 IconRole,
44 ObjectRole, ///< The actual Provider object. Do not hold this locally and expect it to disappear at a moment's notice
45 };
46 Q_ENUM(Roles)
47
48 QHash<int, QByteArray> roleNames() const override;
49 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
50 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
51
52 QObject *engine() const;
53 void setEngine(QObject *engine);
54 Q_SIGNAL void engineChanged();
55
56private:
57 std::unique_ptr<ProvidersModelPrivate> d;
58};
59}
60
61#endif // KNSCORE_PROVIDERSMODELL_H
A model which holds information on all known Providers for a specific Engine.
@ ObjectRole
The actual Provider object. Do not hold this locally and expect it to disappear at a moment's notice.
UserRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:21:35 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.