KNewStuff

knsrcmodel.h
1/*
2 SPDX-FileCopyrightText: 2020 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 KNSRCMODEL_H
8#define KNSRCMODEL_H
9
10#include <QAbstractListModel>
11#include <QUrl>
12
13class KNSRCModel : public QAbstractListModel
14{
16public:
17 explicit KNSRCModel(QObject *parent = nullptr);
18 ~KNSRCModel() override;
19
20 enum Roles {
21 NameRole = Qt::UserRole + 1,
22 FilePathRole,
23 };
24
25 QHash<int, QByteArray> roleNames() const override;
26 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
27 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
28
29private:
30 struct Entry {
31 QString name;
32 QString filePath;
33 };
34 QList<Entry *> m_entries;
35};
36
37#endif // KNSRCMODEL_H
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
Q_OBJECTQ_OBJECT
QObject * parent() const const
UserRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:02:29 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.