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
qqmldebugclient.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant
4
7
8#include <QtCore/qdebug.h>
9#include <QtCore/qpointer.h>
10
12
13QQmlDebugClient::QQmlDebugClient(const QString &name, QQmlDebugConnection *parent) :
14 QObject(*(new QQmlDebugClientPrivate(name, parent)), parent)
15{
16 Q_D(QQmlDebugClient);
17 d->addToConnection();
18}
19
22{
23 Q_D(QQmlDebugClient);
24 d->addToConnection();
25}
26
28{
29 Q_D(QQmlDebugClient);
30 if (d->connection && !d->connection->removeClient(d->name))
31 qWarning() << "QQmlDebugClient: Plugin not registered" << d->name;
32}
33
34QQmlDebugClientPrivate::QQmlDebugClientPrivate(const QString &name,
35 QQmlDebugConnection *connection) :
36 name(name), connection(connection)
37{
38}
39
41{
42 Q_Q(QQmlDebugClient);
43 if (connection && !connection->addClient(name, q)) {
44 qWarning() << "QQmlDebugClient: Conflicting plugin name" << name;
45 connection = nullptr;
46 }
47}
48
50{
51 Q_D(const QQmlDebugClient);
52 return d->name;
53}
54
56{
57 Q_D(const QQmlDebugClient);
58 return d->connection->serviceVersion(d->name);
59}
60
62{
63 Q_D(const QQmlDebugClient);
64 if (!d->connection || !d->connection->isConnected())
65 return NotConnected;
66
67 if (d->connection->serviceVersion(d->name) != -1)
68 return Enabled;
69
70 return Unavailable;
71}
72
73void QQmlDebugClient::sendMessage(const QByteArray &message)
74{
75 Q_D(QQmlDebugClient);
76 d->connection->sendMessage(d->name, message);
77}
78
80{
81 Q_D(const QQmlDebugClient);
82 return d->connection;
83}
84
85void QQmlDebugClient::messageReceived(const QByteArray &message)
86{
87 Q_UNUSED(message);
88}
89
90QT_END_NAMESPACE
91
92#include "moc_qqmldebugclient_p.cpp"
QString name() const
virtual void messageReceived(const QByteArray &message)
float serviceVersion() const
QQmlDebugClient(QQmlDebugClientPrivate &dd)
void sendMessage(const QByteArray &message)
State state() const
QQmlDebugConnection * connection() const
Combined button and popup list for selecting options.