Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qqmlinspectorclient.cpp
Go to the documentation of this file.
1
// Copyright (C) 2018 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
5
#
include
"qqmlinspectorclient_p_p.h"
6
7
#
include
<
private
/
qpacket_p
.
h
>
8
#
include
<
private
/
qqmldebugconnection_p
.
h
>
9
#
include
<
QtCore
/
qdebug
.
h
>
10
11
QT_BEGIN_NAMESPACE
12
13
QQmlInspectorClient
::
QQmlInspectorClient
(QQmlDebugConnection *connection) :
14
QQmlDebugClient(*
new
QQmlInspectorClientPrivate(connection))
15
{
16
}
17
18
QQmlInspectorClientPrivate
::QQmlInspectorClientPrivate(
QQmlDebugConnection
*connection) :
19
QQmlDebugClientPrivate
(QLatin1String(
"QmlInspector"
), connection)
20
{
21
}
22
23
int
QQmlInspectorClient
::
setInspectToolEnabled
(
bool
enabled)
24
{
25
Q_D(QQmlInspectorClient);
26
QPacket ds(connection()->currentDataStreamVersion());
27
ds << QByteArray(
"request"
) << ++(d->m_lastRequestId)
28
<< QByteArray(enabled ?
"enable"
:
"disable"
);
29
30
sendMessage(ds.data());
31
return
d->m_lastRequestId;
32
}
33
34
int
QQmlInspectorClient
::
setShowAppOnTop
(
bool
showOnTop)
35
{
36
Q_D(QQmlInspectorClient);
37
QPacket ds(connection()->currentDataStreamVersion());
38
ds << QByteArray(
"request"
) << ++(d->m_lastRequestId)
39
<< QByteArray(
"showAppOnTop"
) << showOnTop;
40
41
sendMessage(ds.data());
42
return
d->m_lastRequestId;
43
}
44
45
int
QQmlInspectorClient
::
setAnimationSpeed
(qreal speed)
46
{
47
Q_D(QQmlInspectorClient);
48
QPacket ds(connection()->currentDataStreamVersion());
49
ds << QByteArray(
"request"
) << ++(d->m_lastRequestId)
50
<< QByteArray(
"setAnimationSpeed"
) << speed;
51
52
sendMessage(ds.data());
53
return
d->m_lastRequestId;
54
}
55
56
int
QQmlInspectorClient
::
select
(
const
QList<
int
> &objectIds)
57
{
58
Q_D(QQmlInspectorClient);
59
QPacket ds(connection()->currentDataStreamVersion());
60
ds << QByteArray(
"request"
) << ++(d->m_lastRequestId)
61
<< QByteArray(
"select"
) << objectIds;
62
63
sendMessage(ds.data());
64
return
d->m_lastRequestId;
65
}
66
67
int
QQmlInspectorClient
::
createObject
(
const
QString &qml,
int
parentId,
const
QStringList &imports,
68
const
QString &filename)
69
{
70
Q_D(QQmlInspectorClient);
71
QPacket ds(connection()->currentDataStreamVersion());
72
ds << QByteArray(
"request"
) << ++(d->m_lastRequestId)
73
<< QByteArray(
"createObject"
) << qml << parentId << imports << filename;
74
sendMessage(ds.data());
75
return
d->m_lastRequestId;
76
}
77
78
int
QQmlInspectorClient
::
moveObject
(
int
childId,
int
newParentId)
79
{
80
Q_D(QQmlInspectorClient);
81
QPacket ds(connection()->currentDataStreamVersion());
82
ds << QByteArray(
"request"
) << ++(d->m_lastRequestId)
83
<< QByteArray(
"moveObject"
) << childId << newParentId;
84
sendMessage(ds.data());
85
return
d->m_lastRequestId;
86
}
87
88
int
QQmlInspectorClient
::
destroyObject
(
int
objectId)
89
{
90
Q_D(QQmlInspectorClient);
91
QPacket ds(connection()->currentDataStreamVersion());
92
ds << QByteArray(
"request"
) << ++(d->m_lastRequestId)
93
<< QByteArray(
"destroyObject"
) << objectId;
94
sendMessage(ds.data());
95
return
d->m_lastRequestId;
96
}
97
98
void
QQmlInspectorClient
::
messageReceived
(
const
QByteArray &message)
99
{
100
QPacket ds(connection()->currentDataStreamVersion(), message);
101
QByteArray type;
102
ds >> type;
103
104
if
(type != QByteArray(
"response"
)) {
105
qDebug() <<
"Unhandled message of type"
<< type;
106
return
;
107
}
108
109
int
responseId;
110
bool
result;
111
ds >> responseId >> result;
112
emit responseReceived(responseId, result);
113
}
114
115
QT_END_NAMESPACE
116
117
#
include
"moc_qqmlinspectorclient_p.cpp"
QQmlDebugClientPrivate
Definition
qqmldebugclient_p_p.h:27
QQmlDebugConnection
Definition
qqmldebugconnection_p.h:28
QQmlInspectorClientPrivate
Definition
qqmlinspectorclient_p_p.h:25
QQmlInspectorClient
Definition
qqmlinspectorclient_p.h:25
QQmlInspectorClient::select
int select(const QList< int > &objectIds)
Definition
qqmlinspectorclient.cpp:56
QQmlInspectorClient::messageReceived
void messageReceived(const QByteArray &message) override
Definition
qqmlinspectorclient.cpp:98
QQmlInspectorClient::setAnimationSpeed
int setAnimationSpeed(qreal speed)
Definition
qqmlinspectorclient.cpp:45
QQmlInspectorClient::createObject
int createObject(const QString &qml, int parentId, const QStringList &imports, const QString &filename)
Definition
qqmlinspectorclient.cpp:67
QQmlInspectorClient::destroyObject
int destroyObject(int objectId)
Definition
qqmlinspectorclient.cpp:88
QQmlInspectorClient::moveObject
int moveObject(int childId, int newParentId)
Definition
qqmlinspectorclient.cpp:78
QQmlInspectorClient::setShowAppOnTop
int setShowAppOnTop(bool showOnTop)
Definition
qqmlinspectorclient.cpp:34
QQmlInspectorClient::setInspectToolEnabled
int setInspectToolEnabled(bool enabled)
Definition
qqmlinspectorclient.cpp:23
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtdeclarative
src
qmldebug
qqmlinspectorclient.cpp
Generated on
for Qt by
1.18.0