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