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
qqmlabstractprofileradapter_p.h
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
5#ifndef QQMLABSTRACTPROFILERADAPTER_P_H
6#define QQMLABSTRACTPROFILERADAPTER_P_H
7
8#include <private/qtqmlglobal_p.h>
9#include <private/qqmlprofilerdefinitions_p.h>
10
11#include <QtCore/QObject>
12#include <QtCore/QElapsedTimer>
13#include <QtCore/QThread>
14
15//
16// W A R N I N G
17// -------------
18//
19// This file is not part of the Qt API. It exists purely as an
20// implementation detail. This header file may change from version to
21// version without notice, or even be removed.
22//
23// We mean it.
24//
25
27
29
30class QQmlProfilerService;
31class Q_QML_EXPORT QQmlAbstractProfilerAdapter : public QObject, public QQmlProfilerDefinitions {
32 Q_OBJECT
33
34public:
35 static const int s_numMessagesPerBatch = 1000;
36
37 QQmlAbstractProfilerAdapter(QObject *parent = nullptr) : QObject(parent) {}
38 ~QQmlAbstractProfilerAdapter() override
39 {
40 QThread *currentThread = QThread::currentThread();
41 QThread *mainThread = thread();
42 if (currentThread != mainThread) {
43 qFatal("Qml debugging framework was cleaned up from wrong thread. Did you leak your "
44 "QCoreApplication?");
45 }
46 }
47 void setService(QQmlProfilerService *new_service) { service = new_service; }
48
49 virtual qint64 sendMessages(qint64 until, QList<QByteArray> &messages) = 0;
50
51 void startProfiling(quint64 features);
52
53 void stopProfiling();
54
55 void reportData() { Q_EMIT dataRequested(); }
56
57 void stopWaiting() { waiting = false; }
58 void startWaiting() { waiting = true; }
59
60 bool isRunning() const { return running; }
61 quint64 features() const { return featuresEnabled; }
62
63 void synchronize(const QElapsedTimer &t) { Q_EMIT referenceTimeKnown(t); }
64
65Q_SIGNALS:
66 void profilingEnabled(quint64 features);
67 void profilingEnabledWhileWaiting(quint64 features);
68
69 void profilingDisabled();
70 void profilingDisabledWhileWaiting();
71
72 void dataRequested();
73 void referenceTimeKnown(const QElapsedTimer &timer);
74
75protected:
76 QQmlProfilerService *service = nullptr;
77
78private:
79 quint64 featuresEnabled = 0;
80 bool waiting = true;
81 bool running = false;
82};
83
84class Q_QML_EXPORT QQmlAbstractProfilerAdapterFactory : public QObject
85{
86 Q_OBJECT
87public:
88 virtual QQmlAbstractProfilerAdapter *create(const QString &key) = 0;
89};
90
91#define QQmlAbstractProfilerAdapterFactory_iid "org.qt-project.Qt.QQmlAbstractProfilerAdapterFactory"
92
93QT_END_NAMESPACE
94
95#endif // QQMLABSTRACTPROFILERADAPTER_P_H
Combined button and popup list for selecting options.
QT_REQUIRE_CONFIG(liburing)