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
qqmldebugmessageclient.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 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
6
7#include <QtCore/qdatastream.h>
8
10
11/*!
12 \class QQmlDebugMessageClient
13 \internal
14
15 \brief Client for the debug message service
16
17 The QQmlDebugMessageClient receives debug messages routed through the QML
18 debug connection via QDebugMessageService.
19 */
20
22 : QQmlDebugClient(QLatin1String("DebugMessages"), client)
23{
24}
25
26void QQmlDebugMessageClient::messageReceived(const QByteArray &data)
27{
28 QDataStream ds(data);
29 QByteArray command;
30 ds >> command;
31
32 if (command == "MESSAGE") {
33 int type;
34 int line;
35 QByteArray debugMessage;
36 QByteArray file;
37 QByteArray function;
38 ds >> type >> debugMessage >> file >> line >> function;
40 info.line = line;
41 info.file = QString::fromUtf8(file);
42 info.function = QString::fromUtf8(function);
43 info.timestamp = -1;
44 if (!ds.atEnd()) {
45 QByteArray category;
46 ds >> category;
47 info.category = QString::fromUtf8(category);
48 if (!ds.atEnd())
49 ds >> info.timestamp;
50 }
51 emit message(QtMsgType(type), QString::fromUtf8(debugMessage), info);
52 }
53}
54
55QT_END_NAMESPACE
56
57#include "moc_qqmldebugmessageclient_p.cpp"
Client for the debug message service.
virtual void messageReceived(const QByteArray &) override
Combined button and popup list for selecting options.