KNewStuff

knsrcmodel.h
1 /*
2  SPDX-FileCopyrightText: 2020 Dan Leinir Turthra Jensen <[email protected]>
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 
13 class KNSRCModel : public QAbstractListModel
14 {
15  Q_OBJECT
16  Q_PROPERTY(QUrl folder READ folder WRITE setFolder NOTIFY folderChanged)
17 public:
18  explicit KNSRCModel(QObject *parent = nullptr);
19  virtual ~KNSRCModel();
20 
21  enum Roles {
22  NameRole = Qt::UserRole + 1,
23  FilePathRole,
24  };
25 
26  QHash< int, QByteArray > roleNames() const override;
27  QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
28  int rowCount(const QModelIndex& parent = QModelIndex()) const override;
29 
30  QUrl folder() const;
31  void setFolder(const QUrl& folder);
32  Q_SIGNAL void folderChanged();
33 
34 private:
35  class Private;
36  Private *d;
37 };
38 
39 #endif//KNSRCMODEL_H
virtual int rowCount(const QModelIndex &parent) const const =0
virtual QHash< int, QByteArray > roleNames() const const
Q_OBJECTQ_OBJECT
UserRole
virtual QVariant data(const QModelIndex &index, int role) const const =0
Q_PROPERTY(...)
Q_SIGNALQ_SIGNAL
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 25 2021 22:47:27 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.