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