Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdbusmodel.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef QDBUSMODEL_H
5#define QDBUSMODEL_H
6
7#include <QtCore/qabstractitemmodel.h>
8#include <QtDBus/QDBusConnection>
9
10struct QDBusItem;
11
15
16
18{
20
21public:
23
24 QDBusModel(const QString &service, const QDBusConnection &connection);
25 ~QDBusModel();
26
27
28 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
29 QModelIndex parent(const QModelIndex &child) const override;
30 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
31 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
32 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
33 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
34
35 Type itemType(const QModelIndex &index) const;
36 QString dBusPath(const QModelIndex &index) const;
37 QString dBusInterface(const QModelIndex &index) const;
38 QString dBusMethodName(const QModelIndex &index) const;
39 QString dBusTypeSignature(const QModelIndex &index) const;
40
41 void refresh(const QModelIndex &index = QModelIndex());
42
43 QModelIndex findObject(const QDBusObjectPath &objectPath);
44
46 void busError(const QString &text);
47
48private:
49 QDomDocument introspect(const QString &path);
50 void addMethods(QDBusItem *parent, const QDomElement &iface);
51 void addPath(QDBusItem *parent);
52
53 QString service;
54 QDBusConnection c;
55 QDBusItem *root;
56};
57
58#endif
QString dBusMethodName(const QModelIndex &index) const
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns for the children of the given parent.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Returns the data stored under the given role for the item referred to by the index.
QString dBusTypeSignature(const QModelIndex &index) const
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows under the given parent.
QModelIndex parent(const QModelIndex &child) const override
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Returns the data for the given role and section in the header with the specified orientation.
void refresh(const QModelIndex &index=QModelIndex())
QString dBusPath(const QModelIndex &index) const
QModelIndex findObject(const QDBusObjectPath &objectPath)
Type itemType(const QModelIndex &index) const
QString dBusInterface(const QModelIndex &index) const
QDBusModel(const QString &service, const QDBusConnection &connection)
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Returns the index of the item in the model specified by the given row, column and parent index.
\inmodule QtDBus
QT_FORWARD_DECLARE_CLASS(QDomDocument)
QT_FORWARD_DECLARE_CLASS(QDomElement)
QDBusItem * parent
QDBusModel::Type type
QString name
QString path() const
QString caption
QString typeSignature
QList< QDBusItem * > children
bool isPrefetched
QDBusItem(QDBusModel::Type aType, const QString &aName, QDBusItem *aParent=0)