4#ifndef QQMLDEBUGCONNECTOR_H
5#define QQMLDEBUGCONNECTOR_H
7#include <QtQml/qtqmlglobal.h>
8#include <QtQml/qjsengine.h>
9#include <QtCore/QVariantList>
11#if QT_CONFIG(qml_debug)
12#include <private/qqmldebugservice_p.h>
28#if !QT_CONFIG(qml_debug)
30class Q_QML_EXPORT QQmlDebugConnector
32 virtual ~QQmlDebugConnector() =
default;
34 static QQmlDebugConnector *instance() {
return nullptr; }
36 template<
class Service>
37 static Service *service() {
return nullptr; }
39 bool hasEngine(QJSEngine *)
const {
return false; }
40 void addEngine(QJSEngine *) {}
41 void removeEngine(QJSEngine *) {}
43 bool open(
const QVariantHash &configuration = QVariantHash())
45 Q_UNUSED(configuration);
52class QQmlDebugService;
53class Q_QML_EXPORT QQmlDebugConnector :
public QObject
57 static void setPluginKey(
const QString &key);
58 static void setServices(
const QStringList &services);
59 static QQmlDebugConnector *instance();
60 static int dataStreamVersion()
62 return s_dataStreamVersion;
65 virtual bool blockingMode()
const = 0;
67 virtual QQmlDebugService *service(
const QString &name)
const = 0;
69 virtual void addEngine(QJSEngine *engine) = 0;
70 virtual void removeEngine(QJSEngine *engine) = 0;
71 virtual bool hasEngine(QJSEngine *engine)
const = 0;
73 virtual bool addService(
const QString &name, QQmlDebugService *service) = 0;
74 virtual bool removeService(
const QString &name) = 0;
76 virtual bool open(
const QVariantHash &configuration = QVariantHash()) = 0;
78 template<
class Service>
79 static Service *service()
81 QQmlDebugConnector *inst = instance();
82 return inst ?
static_cast<Service *>(inst->service(Service::s_key)) :
nullptr;
86 static QString commandLineArguments();
87 static int s_dataStreamVersion;
90class Q_QML_EXPORT QQmlDebugConnectorFactory :
public QObject {
93 virtual QQmlDebugConnector *create(
const QString &key) = 0;
94 ~QQmlDebugConnectorFactory() override;
97#define QQmlDebugConnectorFactory_iid "org.qt-project.Qt.QQmlDebugConnectorFactory"
#define Q_ATOMIC_FLAG_INIT
static Q_CONSTINIT std::atomic_flag s_printedWarning
QT_REQUIRE_CONFIG(qml_debug)
QDebug Q_QML_EXPORT operator<<(QDebug debug, const QQmlError &error)
Q_STATIC_ASSERT(sizeof(SharedImageHeader) % 4==0)