KDELibs4Support

kdevicelistmodel.h
1 /* This file is part of the KDE project
2  Copyright (C) 2006 Michael Larouche <[email protected]>
3  2007 Kevin Ottens <[email protected]>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 
19 */
20 #ifndef KDEVICELISTMODEL_H
21 #define KDEVICELISTMODEL_H
22 
23 #include <kdelibs4support_export.h>
24 
25 #include <QAbstractItemModel>
26 
27 #include <solid/device.h>
28 #include <solid/predicate.h>
29 
39 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KDeviceListModel : public QAbstractItemModel
40 {
41  Q_OBJECT
42 public:
43  KDELIBS4SUPPORT_DEPRECATED explicit KDeviceListModel(QObject *parent = nullptr);
44  KDELIBS4SUPPORT_DEPRECATED explicit KDeviceListModel(const QString &predicate, QObject *parent = nullptr);
45  KDELIBS4SUPPORT_DEPRECATED explicit KDeviceListModel(const Solid::Predicate &predicate,
46  QObject *parent = nullptr);
47  ~KDeviceListModel();
48 
58  QVariant data(const QModelIndex &index, int role) const override;
59 
71  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
72 
76  QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
77 
78  QModelIndex rootIndex() const;
79 
83  QModelIndex parent(const QModelIndex &child) const override;
84 
88  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
89 
93  int columnCount(const QModelIndex &parent = QModelIndex()) const override;
94 
95  Solid::Device deviceForIndex(const QModelIndex &index) const;
96 
97 Q_SIGNALS:
98  void modelInitialized();
99 
100 private:
101  Q_PRIVATE_SLOT(d, void _k_initDeviceList())
102  Q_PRIVATE_SLOT(d, void _k_deviceAdded(const QString &))
103  Q_PRIVATE_SLOT(d, void _k_deviceRemoved(const QString &))
104 
105  class Private;
106  Private *const d;
107 };
108 
109 #endif
virtual int rowCount(const QModelIndex &parent) const const =0
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const =0
DisplayRole
virtual QVariant data(const QModelIndex &index, int role) const const =0
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const const
Device list model in Qt&#39;s Interview framework.
virtual int columnCount(const QModelIndex &parent) const const =0
Orientation
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jul 13 2020 22:58:30 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.