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
qdbusviewer.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 QDBUSVIEWER_H
5#define QDBUSVIEWER_H
6
7#include <QtWidgets/QWidget>
8#include <QtDBus/QDBusConnection>
9#include <QtCore/QRegularExpression>
10
12
14QT_FORWARD_DECLARE_CLASS(QTreeView)
15QT_FORWARD_DECLARE_CLASS(QTreeWidget)
16QT_FORWARD_DECLARE_CLASS(QStringListModel)
17QT_FORWARD_DECLARE_CLASS(QLineEdit)
18QT_FORWARD_DECLARE_CLASS(QTextBrowser)
19QT_FORWARD_DECLARE_CLASS(QDomDocument)
20QT_FORWARD_DECLARE_CLASS(QDomElement)
21QT_FORWARD_DECLARE_CLASS(QSplitter)
22QT_FORWARD_DECLARE_CLASS(QSettings)
23
24struct BusSignature
25{
26 QString mService, mPath, mInterface, mName;
27 QString mTypeSig;
28};
29
30class QDBusViewer: public QWidget
31{
33public:
35
36 void saveState(QSettings *settings) const;
37 void restoreState(const QSettings *settings);
38
39public slots:
40 void refresh();
41
42private slots:
43 void serviceChanged(const QModelIndex &index);
44 void showServicesViewContextMenu(const QPoint &);
45 void showTreeViewContextMenu(const QPoint &);
46 void connectionRequested(const BusSignature &sig);
47 void callMethod(const BusSignature &sig);
48 void getProperty(const BusSignature &sig);
49 void setProperty(const BusSignature &sig);
50 void dumpMessage(const QDBusMessage &msg);
51 void dumpError(const QDBusError &error);
52 void refreshChildren();
53
54 void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
55
56 void serviceFilterReturnPressed();
57 void activate(const QModelIndex &item);
58
59 void logError(const QString &msg);
60 void anchorClicked(const QUrl &url);
61
62private:
63 void serviceRegistered(const QString &service);
64 void logMessage(const QString &msg);
65 void showEvent(QShowEvent *) override;
66 bool eventFilter(QObject *obj, QEvent *event) override;
67
68 QDBusConnection c;
69 QString currentService;
70 QTreeView *tree;
71 QAction *refreshChildrenAction;
72 QAction *copyServiceNameAction;
73 QAction *copyObjectPathAction;
74 QAction *copyInterfaceNameAction;
75 QAction *copyMemberSignalNameAction;
76 QAction *copyMemberMethodNameAction;
77 QAction *copyMemberPropertyNameAction;
78 QAction *connectAction;
79 QAction *callAction;
80 QStringListModel *servicesModel;
81 ServicesProxyModel *servicesProxyModel;
82 QLineEdit *serviceFilterLine;
83 QTableView *servicesView;
84 QTextBrowser *log;
85 QSplitter *topSplitter;
86 QSplitter *splitter;
87 QRegularExpression objectPathRegExp;
88};
89
90#endif
~MainWindow() override
void addCustomBusTab(const QString &bus)
MainWindow(QWidget *parent=nullptr)
bool eventFilter(QObject *obj, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
void saveState(QSettings *settings) const
void restoreState(const QSettings *settings)
void showEvent(QShowEvent *) override
This event handler can be reimplemented in a subclass to receive widget show events which are passed ...
The QTableView class provides a default model/view implementation of a table view.
Definition qtableview.h:19
static QString sessionTabGroup()
static QString systemTabGroup()
static QString windowGeometryKey()