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.cpp
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#include "qdbusviewer.h"
5#include "qdbusmodel.h"
8#include "logviewer.h"
9
10#include <QtWidgets/QLineEdit>
11#include <QtWidgets/QVBoxLayout>
12#include <QtWidgets/QSplitter>
13#include <QtWidgets/QInputDialog>
14#include <QtWidgets/QMessageBox>
15#include <QtWidgets/QMenu>
16#include <QtWidgets/QTableWidget>
17#include <QtWidgets/QTreeWidget>
18#include <QtWidgets/QHeaderView>
19
20#include <QtDBus/QDBusConnectionInterface>
21#include <QtDBus/QDBusInterface>
22#include <QtDBus/QDBusMetaType>
23#include <QtDBus/QDBusServiceWatcher>
24
25#include <QtGui/QAction>
26#include <QtGui/QClipboard>
27#include <QtGui/QKeyEvent>
28#include <QtGui/QShortcut>
29
30#include <QtCore/QStringListModel>
31#include <QtCore/QMetaProperty>
32#include <QtCore/QSettings>
33
34#include <private/qdbusutil_p.h>
35
36using namespace Qt::StringLiterals;
37
38// Use enum for context menu's QAction::data to avoid collisions
51
53{
54public:
55 inline QDBusViewModel(const QString &service, const QDBusConnection &connection)
56 : QDBusModel(service, connection)
57 {}
58
59 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override
60 {
61 if (role == Qt::FontRole && itemType(index) == InterfaceItem) {
62 QFont f;
63 f.setItalic(true);
64 return f;
65 }
66 return QDBusModel::data(index, role);
67 }
68};
69
71{
72public:
73 explicit ServicesModel(QObject *parent = nullptr)
75 {}
76
77 Qt::ItemFlags flags(const QModelIndex &index) const override
78 {
79 return QStringListModel::flags(index) & ~Qt::ItemIsEditable;
80 }
81};
82
83QDBusViewer::QDBusViewer(const QDBusConnection &connection, QWidget *parent)
84 : QWidget(parent), c(connection), objectPathRegExp("\\‍[ObjectPath: (.*)\\‍]"_L1)
85{
86 serviceFilterLine = new QLineEdit(this);
87 serviceFilterLine->setPlaceholderText(tr("Search..."));
88
89 // Create model for services list
90 servicesModel = new ServicesModel(this);
91 // Wrap service list model in proxy for easy filtering and interactive sorting
92 servicesProxyModel = new ServicesProxyModel(this);
93 servicesProxyModel->setSourceModel(servicesModel);
94 servicesProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
95
96 servicesView = new QTableView(this);
97 servicesView->installEventFilter(this);
98 servicesView->setModel(servicesProxyModel);
99 // Make services grid view behave like a list view with headers
100 servicesView->verticalHeader()->hide();
101 servicesView->horizontalHeader()->setStretchLastSection(true);
102 servicesView->setShowGrid(false);
103 // Sort service list by default
104 servicesView->setSortingEnabled(true);
105 servicesView->sortByColumn(0, Qt::AscendingOrder);
106 servicesView->setContextMenuPolicy(Qt::CustomContextMenu);
107 connect(servicesView, &QWidget::customContextMenuRequested, this, &QDBusViewer::showServicesViewContextMenu);
108
109 connect(serviceFilterLine, &QLineEdit::textChanged, servicesProxyModel, &QSortFilterProxyModel::setFilterFixedString);
110 connect(serviceFilterLine, &QLineEdit::returnPressed, this, &QDBusViewer::serviceFilterReturnPressed);
111
112 tree = new QTreeView;
113 tree->setContextMenuPolicy(Qt::CustomContextMenu);
114 connect(tree, &QWidget::customContextMenuRequested, this, &QDBusViewer::showTreeViewContextMenu);
115 connect(tree, &QAbstractItemView::activated, this, &QDBusViewer::activate);
116
117 refreshChildrenAction = new QAction(tr("&Refresh"), this);
118 refreshChildrenAction->setData(ACTION_DATA_REFRESH_CHILDREN);
119 refreshChildrenAction->setShortcut(QKeySequence::Refresh);
120 connect(refreshChildrenAction, &QAction::triggered, this, &QDBusViewer::refreshChildren);
121
122 QShortcut *refreshShortcut = new QShortcut(QKeySequence::Refresh, this);
123 connect(refreshShortcut, &QShortcut::activated, this, &QDBusViewer::refreshChildren);
124
125 copyServiceNameAction = new QAction(tr("&Copy Service Name"), this);
126 copyServiceNameAction->setData(ACTION_DATA_COPY_SERVICE_NAME);
127 copyServiceNameAction->setShortcut(QKeySequence::Copy);
128
129 copyObjectPathAction = new QAction(tr("&Copy Object Path"), this);
130 copyObjectPathAction->setData(ACTION_DATA_COPY_OBJECT_PATH);
131 copyInterfaceNameAction = new QAction(tr("Copy &Interface Name"), this);
132 copyInterfaceNameAction->setData(ACTION_DATA_COPY_INTERFACE_NAME);
133 // Mutually exclusive actions share the same data tag
134 copyMemberSignalNameAction = new QAction(tr("Copy Signal &Name"), this);
135 copyMemberSignalNameAction->setData(ACTION_DATA_COPY_MEMBER_NAME);
136 copyMemberMethodNameAction = new QAction(tr("Copy Method &Name"), this);
137 copyMemberMethodNameAction->setData(ACTION_DATA_COPY_MEMBER_NAME);
138 copyMemberPropertyNameAction = new QAction(tr("Copy Property &Name"), this);
139 copyMemberPropertyNameAction->setData(ACTION_DATA_COPY_MEMBER_NAME);
140
141 connectAction = new QAction(tr("&Connect"), this);
142 connectAction->setData(ACTION_DATA_CONNECT);
143 callAction = new QAction(tr("&Call"), this);
144 callAction->setData(ACTION_DATA_CALL);
145
146 QVBoxLayout *layout = new QVBoxLayout(this);
147 topSplitter = new QSplitter(Qt::Vertical, this);
148 layout->addWidget(topSplitter);
149
150 log = new LogViewer;
151 connect(log, &QTextBrowser::anchorClicked, this, &QDBusViewer::anchorClicked);
152
153 splitter = new QSplitter(topSplitter);
154 splitter->addWidget(servicesView);
155
156 QWidget *servicesWidget = new QWidget;
157 QVBoxLayout *servicesLayout = new QVBoxLayout(servicesWidget);
158 servicesLayout->setContentsMargins(QMargins());
159 servicesLayout->addWidget(serviceFilterLine);
160 servicesLayout->addWidget(servicesView);
161 splitter->addWidget(servicesWidget);
162 splitter->addWidget(tree);
163
164 topSplitter->addWidget(splitter);
165 topSplitter->addWidget(log);
166
167 connect(servicesView->selectionModel(), &QItemSelectionModel::currentChanged, this, &QDBusViewer::serviceChanged);
168
169 QMetaObject::invokeMethod(this, &QDBusViewer::refresh, Qt::QueuedConnection);
170
171 if (c.isConnected()) {
172 QDBusServiceWatcher *watcher =
173 new QDBusServiceWatcher("*", c, QDBusServiceWatcher::WatchForOwnerChange, this);
174 connect(watcher, &QDBusServiceWatcher::serviceOwnerChanged, this,
175 &QDBusViewer::serviceOwnerChanged);
176 logMessage(tr("Connected to D-Bus."));
177 } else {
178 logError(tr("Cannot connect to D-Bus: %1").arg(c.lastError().message()));
179 }
180
181 objectPathRegExp.setPatternOptions(QRegularExpression::InvertedGreedinessOption);
182}
183
185{
186 return u"topSplitterState"_s;
187}
188
190{
191 return u"splitterState"_s;
192}
193
194void QDBusViewer::saveState(QSettings *settings) const
195{
196 settings->setValue(topSplitterStateKey(), topSplitter->saveState());
197 settings->setValue(splitterStateKey(), splitter->saveState());
198}
199
200void QDBusViewer::restoreState(const QSettings *settings)
201{
202 topSplitter->restoreState(settings->value(topSplitterStateKey()).toByteArray());
203 splitter->restoreState(settings->value(splitterStateKey()).toByteArray());
204}
205
206void QDBusViewer::logMessage(const QString &msg)
207{
208 log->append(msg + '\n'_L1);
209}
210
211void QDBusViewer::showEvent(QShowEvent *)
212{
213 serviceFilterLine->setFocus();
214}
215
216bool QDBusViewer::eventFilter(QObject *obj, QEvent *event)
217{
218 if (obj == servicesView) {
219 if (event->type() == QEvent::KeyPress) {
220 QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
221 if (keyEvent->modifiers() == Qt::NoModifier) {
222 if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return) {
223 tree->setFocus();
224 }
225 }
226 }
227 }
228 return false;
229}
230
231void QDBusViewer::logError(const QString &msg)
232{
233 log->append(tr("<font color=\"red\">Error: </font>%1<br>").arg(msg.toHtmlEscaped()));
234}
235
236void QDBusViewer::refresh()
237{
238 servicesModel->removeRows(0, servicesModel->rowCount());
239
240 if (c.isConnected()) {
241 const QStringList serviceNames = c.interface()->registeredServiceNames();
242 servicesModel->setStringList(serviceNames);
243 }
244}
245
246void QDBusViewer::activate(const QModelIndex &item)
247{
248 if (!item.isValid())
249 return;
250
251 const QDBusModel *model = static_cast<const QDBusModel *>(item.model());
252
253 BusSignature sig;
254 sig.mService = currentService;
255 sig.mPath = model->dBusPath(item);
256 sig.mInterface = model->dBusInterface(item);
257 sig.mName = model->dBusMethodName(item);
258 sig.mTypeSig = model->dBusTypeSignature(item);
259
260 switch (model->itemType(item)) {
261 case QDBusModel::SignalItem:
262 connectionRequested(sig);
263 break;
264 case QDBusModel::MethodItem:
265 callMethod(sig);
266 break;
267 case QDBusModel::PropertyItem:
268 getProperty(sig);
269 break;
270 default:
271 break;
272 }
273}
274
275void QDBusViewer::getProperty(const BusSignature &sig)
276{
277 QDBusMessage message = QDBusMessage::createMethodCall(
278 sig.mService, sig.mPath, "org.freedesktop.DBus.Properties"_L1, "Get"_L1);
279 QList<QVariant> arguments;
280 arguments << sig.mInterface << sig.mName;
281 message.setArguments(arguments);
282 c.callWithCallback(message, this, SLOT(dumpMessage(QDBusMessage)), SLOT(dumpError(QDBusError)));
283}
284
285void QDBusViewer::setProperty(const BusSignature &sig)
286{
287 QDBusInterface iface(sig.mService, sig.mPath, sig.mInterface, c);
288 QMetaProperty prop = iface.metaObject()->property(iface.metaObject()->indexOfProperty(sig.mName.toLatin1()));
289
290 bool ok;
291 QString input = QInputDialog::getText(this, tr("Arguments"),
292 tr("Please enter the value of the property %1 (type %2)").arg(
293 sig.mName, QString::fromLatin1(prop.typeName())),
294 QLineEdit::Normal, QString(), &ok);
295 if (!ok)
296 return;
297
298 QVariant value = input;
299 if (!value.convert(prop.metaType())) {
300 QMessageBox::warning(this, tr("Unable to marshall"),
301 tr("Value conversion failed, unable to set property"));
302 return;
303 }
304
305 QDBusMessage message = QDBusMessage::createMethodCall(
306 sig.mService, sig.mPath, "org.freedesktop.DBus.Properties"_L1, "Set"_L1);
307 QList<QVariant> arguments;
308 arguments << sig.mInterface << sig.mName << QVariant::fromValue(QDBusVariant(value));
309 message.setArguments(arguments);
310 c.callWithCallback(message, this, SLOT(dumpMessage(QDBusMessage)), SLOT(dumpError(QDBusError)));
311}
312
313static QString getDbusSignature(const QMetaMethod& method)
314{
315 // create a D-Bus type signature from QMetaMethod's parameters
316 QString sig;
317 for (const auto &type : method.parameterTypes())
318 sig.append(QString::fromLatin1(QDBusMetaType::typeToSignature(QMetaType::fromName(type))));
319 return sig;
320}
321
322void QDBusViewer::callMethod(const BusSignature &sig)
323{
324 QDBusInterface iface(sig.mService, sig.mPath, sig.mInterface, c);
325 const QMetaObject *mo = iface.metaObject();
326
327 // find the method
328 QMetaMethod method;
329 for (int i = 0; i < mo->methodCount(); ++i) {
330 const QString signature = QString::fromLatin1(mo->method(i).methodSignature());
331 if (signature.startsWith(sig.mName) && signature.at(sig.mName.size()) == '('_L1)
332 if (getDbusSignature(mo->method(i)) == sig.mTypeSig)
333 method = mo->method(i);
334 }
335 if (!method.isValid()) {
336 QMessageBox::warning(this, tr("Unable to find method"),
337 tr("Unable to find method %1 on path %2 in interface %3").arg(
338 sig.mName).arg(sig.mPath).arg(sig.mInterface));
339 return;
340 }
341
342 PropertyDialog dialog;
343 QList<QVariant> args;
344
345 const QList<QByteArray> paramTypes = method.parameterTypes();
346 const QList<QByteArray> paramNames = method.parameterNames();
347 QList<int> types; // remember the low-level D-Bus type
348 for (int i = 0; i < paramTypes.size(); ++i) {
349 const QByteArray paramType = paramTypes.at(i);
350 if (paramType.endsWith('&'))
351 continue; // ignore OUT parameters
352
353 const int type = QMetaType::fromName(paramType).id();
354 dialog.addProperty(QString::fromLatin1(paramNames.value(i)), type);
355 types.append(type);
356 }
357
358 if (!types.isEmpty()) {
359 dialog.setInfo(tr("Please enter parameters for the method \"%1\"").arg(sig.mName));
360
361 if (dialog.exec() != QDialog::Accepted)
362 return;
363
364 args = dialog.values();
365 }
366
367 // Try to convert the values we got as closely as possible to the
368 // dbus signature. This is especially important for those input as strings
369 for (int i = 0; i < args.size(); ++i) {
370 QVariant a = args.at(i);
371 int desttype = types.at(i);
372 if (desttype < int(QMetaType::User) && desttype != qMetaTypeId<QVariantMap>()) {
373 const QMetaType metaType(desttype);
374 if (a.canConvert(metaType))
375 args[i].convert(metaType);
376 }
377 // Special case - convert a value to a QDBusVariant if the
378 // interface wants a variant
379 if (types.at(i) == qMetaTypeId<QDBusVariant>())
380 args[i] = QVariant::fromValue(QDBusVariant(args.at(i)));
381 }
382
383 QDBusMessage message = QDBusMessage::createMethodCall(sig.mService, sig.mPath, sig.mInterface,
384 sig.mName);
385 message.setArguments(args);
386 c.callWithCallback(message, this, SLOT(dumpMessage(QDBusMessage)), SLOT(dumpError(QDBusError)));
387}
388
389void QDBusViewer::showServicesViewContextMenu(const QPoint &point)
390{
391 QModelIndex item = servicesView->indexAt(point);
392 if (!item.isValid())
393 return;
394
395 const QString serviceName = item.data().toString();
396
397 QMenu menu;
398 // servicesView doesn't need a manual refresh action, because the model updates automatically
399 menu.addAction(copyServiceNameAction);
400
401 QAction *selectedAction = menu.exec(servicesView->viewport()->mapToGlobal(point));
402 if (!selectedAction)
403 return;
404
405 switch (selectedAction->data().toInt()) {
406 case ACTION_DATA_COPY_SERVICE_NAME:
407 QGuiApplication::clipboard()->setText(serviceName);
408 break;
409 default:
410 break;
411 }
412}
413
414void QDBusViewer::showTreeViewContextMenu(const QPoint &point)
415{
416 QModelIndex item = tree->indexAt(point);
417 if (!item.isValid())
418 return;
419
420 const QDBusModel *model = static_cast<const QDBusModel *>(item.model());
421
422 auto itemType = model->itemType(item);
423
424 BusSignature sig;
425 sig.mService = currentService;
426 sig.mPath = model->dBusPath(item);
427 sig.mInterface = model->dBusInterface(item);
428 sig.mName = model->dBusMethodName(item);
429 sig.mTypeSig = model->dBusTypeSignature(item);
430
431 QMenu menu;
432 menu.addAction(refreshChildrenAction);
433
434 // Object path is applicable to all types of items
435 menu.addAction(copyObjectPathAction);
436
437 // Interface name is applicable to interfaces and members
438 switch (itemType) {
439 case QDBusModel::InterfaceItem:
440 case QDBusModel::SignalItem:
441 case QDBusModel::MethodItem:
442 case QDBusModel::PropertyItem:
443 menu.addAction(copyInterfaceNameAction);
444 break;
445 default:
446 break;
447 }
448
449 switch (itemType) {
450 case QDBusModel::SignalItem: {
451 menu.addAction(copyMemberSignalNameAction);
452 menu.addAction(connectAction);
453 break; }
454 case QDBusModel::MethodItem: {
455 menu.addAction(copyMemberMethodNameAction);
456 menu.addAction(callAction);
457 break; }
458 case QDBusModel::PropertyItem: {
459 menu.addAction(copyMemberPropertyNameAction);
460 QDBusInterface iface(sig.mService, sig.mPath, sig.mInterface, c);
461 QMetaProperty prop = iface.metaObject()->property(iface.metaObject()->indexOfProperty(sig.mName.toLatin1()));
462 QAction *actionSet = new QAction(tr("&Set value"), &menu);
463 actionSet->setData(ACTION_DATA_SET_PROPERTY);
464 actionSet->setEnabled(prop.isWritable());
465 QAction *actionGet = new QAction(tr("&Get value"), &menu);
466 actionGet->setEnabled(prop.isReadable());
467 actionGet->setData(ACTION_DATA_GET_PROPERTY);
468 menu.addAction(actionSet);
469 menu.addAction(actionGet);
470 break; }
471 default:
472 break;
473 }
474
475 QAction *selectedAction = menu.exec(tree->viewport()->mapToGlobal(point));
476 if (!selectedAction)
477 return;
478
479 switch (selectedAction->data().toInt()) {
480 case ACTION_DATA_COPY_OBJECT_PATH:
481 QGuiApplication::clipboard()->setText(sig.mPath);
482 break;
483 case ACTION_DATA_COPY_INTERFACE_NAME:
484 QGuiApplication::clipboard()->setText(sig.mInterface);
485 break;
486 case ACTION_DATA_COPY_MEMBER_NAME:
487 QGuiApplication::clipboard()->setText(sig.mName);
488 break;
489 case ACTION_DATA_CONNECT:
490 connectionRequested(sig);
491 break;
492 case ACTION_DATA_CALL:
493 callMethod(sig);
494 break;
495 case ACTION_DATA_SET_PROPERTY:
496 setProperty(sig);
497 break;
498 case ACTION_DATA_GET_PROPERTY:
499 getProperty(sig);
500 break;
501 default:
502 break;
503 }
504}
505
506void QDBusViewer::connectionRequested(const BusSignature &sig)
507{
508 if (c.connect(sig.mService, QString(), sig.mInterface, sig.mName, this,
509 SLOT(dumpMessage(QDBusMessage)))) {
510 logMessage(tr("Connected to service %1, path %2, interface %3, signal %4").arg(
511 sig.mService, sig.mPath, sig.mInterface, sig.mName));
512 } else {
513 logError(tr("Unable to connect to service %1, path %2, interface %3, signal %4").arg(
514 sig.mService, sig.mPath, sig.mInterface, sig.mName));
515 }
516}
517
518void QDBusViewer::dumpMessage(const QDBusMessage &message)
519{
520 QList<QVariant> args = message.arguments();
521
522 QString messageType;
523 switch (message.type()) {
524 case QDBusMessage::SignalMessage:
525 messageType = tr("signal");
526 break;
527 case QDBusMessage::ErrorMessage:
528 messageType = tr("error message");
529 break;
530 case QDBusMessage::ReplyMessage:
531 messageType = tr("reply");
532 break;
533 default:
534 messageType = tr("message");
535 break;
536 }
537
538 QString out = tr("Received %1 from %2").arg(messageType).arg(message.service());
539
540 if (!message.path().isEmpty())
541 out += tr(", path %1").arg(message.path());
542 if (!message.interface().isEmpty())
543 out += tr(", interface <i>%1</i>").arg(message.interface());
544 if (!message.member().isEmpty())
545 out += tr(", member %1").arg(message.member());
546 out += "<br>"_L1;
547 if (args.isEmpty()) {
548 out += tr("&nbsp;&nbsp;(no arguments)");
549 } else {
550 QStringList argStrings;
551 for (const QVariant &arg : std::as_const(args)) {
552 QString str = QDBusUtil::argumentToString(arg).toHtmlEscaped();
553 // turn object paths into clickable links
554 str.replace(objectPathRegExp, tr("[ObjectPath: <a href=\"qdbus://bus\\1\">\\1</a>]"));
555 // convert new lines from command to proper HTML line breaks
556 str.replace("\n"_L1, "<br/>"_L1);
557 argStrings.append(str);
558 }
559 out += tr("&nbsp;&nbsp;Arguments: %1").arg(argStrings.join(tr(", ")));
560 }
561
562 log->append(out);
563}
564
565void QDBusViewer::dumpError(const QDBusError &error)
566{
567 logError(error.message());
568}
569
570void QDBusViewer::serviceChanged(const QModelIndex &index)
571{
572 delete tree->model();
573
574 currentService.clear();
575 if (!index.isValid())
576 return;
577 currentService = index.data().toString();
578
579 QDBusViewModel *model = new QDBusViewModel(currentService, c);
580 tree->setModel(model);
581 connect(model, &QDBusModel::busError, this, &QDBusViewer::logError);
582}
583
584void QDBusViewer::serviceRegistered(const QString &service)
585{
586 if (service == c.baseService())
587 return;
588
589 servicesModel->insertRows(0, 1);
590 servicesModel->setData(servicesModel->index(0, 0), service);
591}
592
593static QModelIndex findItem(QStringListModel *servicesModel, const QString &name)
594{
595 QModelIndexList hits = servicesModel->match(servicesModel->index(0, 0), Qt::DisplayRole, name);
596 if (hits.isEmpty())
597 return QModelIndex();
598
599 return hits.first();
600}
601
602void QDBusViewer::serviceOwnerChanged(const QString &name, const QString &oldOwner,
603 const QString &newOwner)
604{
605 QModelIndex hit = findItem(servicesModel, name);
606
607 if (!hit.isValid() && oldOwner.isEmpty() && !newOwner.isEmpty())
608 serviceRegistered(name);
609 else if (hit.isValid() && !oldOwner.isEmpty() && newOwner.isEmpty())
610 servicesModel->removeRows(hit.row(), 1);
611 else if (hit.isValid() && !oldOwner.isEmpty() && !newOwner.isEmpty()) {
612 servicesModel->removeRows(hit.row(), 1);
613 serviceRegistered(name);
614 }
615}
616
617void QDBusViewer::serviceFilterReturnPressed()
618{
619 if (servicesProxyModel->rowCount() <= 0)
620 return;
621
622 servicesView->selectRow(0);
623 servicesView->setFocus();
624}
625
626void QDBusViewer::refreshChildren()
627{
628 QDBusModel *model = qobject_cast<QDBusModel *>(tree->model());
629 if (!model)
630 return;
631 model->refresh(tree->currentIndex());
632}
633
634void QDBusViewer::anchorClicked(const QUrl &url)
635{
636 if (url.scheme() != "qdbus"_L1)
637 // not ours
638 return;
639
640 // swallow the click without setting a new document
641 log->setSource(QUrl());
642
643 QDBusModel *model = qobject_cast<QDBusModel *>(tree->model());
644 if (!model)
645 return;
646
647 QModelIndex idx = model->findObject(QDBusObjectPath(url.path()));
648 if (!idx.isValid())
649 return;
650
651 tree->scrollTo(idx);
652 tree->setCurrentIndex(idx);
653}
QDBusViewModel(const QString &service, const QDBusConnection &connection)
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.
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 ...
ServicesModel(QObject *parent=nullptr)
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns the flags for the item with the given index.
static QString topSplitterStateKey()
static QString getDbusSignature(const QMetaMethod &method)
DBusActionData
@ ACTION_DATA_CONNECT
@ ACTION_DATA_COPY_SERVICE_NAME
@ ACTION_DATA_SET_PROPERTY
@ ACTION_DATA_COPY_MEMBER_NAME
@ ACTION_DATA_CALL
@ ACTION_DATA_COPY_OBJECT_PATH
@ ACTION_DATA_GET_PROPERTY
@ ACTION_DATA_COPY_INTERFACE_NAME
@ ACTION_DATA_REFRESH_CHILDREN
static QString splitterStateKey()
static QModelIndex findItem(QStringListModel *servicesModel, const QString &name)