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
qqmldebugserviceinterfaces.cpp
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
5
7
8const QString QV4DebugService::s_key = QStringLiteral("V8Debugger");
9const QString QQmlEngineDebugService::s_key = QStringLiteral("QmlDebugger");
10const QString QQmlInspectorService::s_key = QStringLiteral("QmlInspector");
11const QString QQmlProfilerService::s_key = QStringLiteral("CanvasFrameRate");
12const QString QQuickEventReplayService::s_key = QStringLiteral("EventReplay");
13const QString QDebugMessageService::s_key = QStringLiteral("DebugMessages");
14const QString QQmlEngineControlService::s_key = QStringLiteral("EngineControl");
15const QString QQmlNativeDebugService::s_key = QStringLiteral("NativeQmlDebugger");
16#if QT_CONFIG(translation)
17const QString QQmlDebugTranslationService::s_key = QStringLiteral("DebugTranslation");
18#endif
19
20QV4DebugService::~QV4DebugService()
21 = default;
22QQmlEngineDebugService::~QQmlEngineDebugService()
23 = default;
24QQmlInspectorService::~QQmlInspectorService()
25 = default;
26QQmlProfilerService::~QQmlProfilerService()
27 = default;
28QQuickEventReplayService::~QQuickEventReplayService()
29 = default;
30QDebugMessageService::~QDebugMessageService()
31 = default;
32QQmlEngineControlService::~QQmlEngineControlService()
33 = default;
34QQmlNativeDebugService::~QQmlNativeDebugService()
35 = default;
36
38void QQmlEngineDebugService::setStatesDelegateFactory(QQmlDebugStatesDelegate *(*factory)())
39{
40 statesDelegateFactory = factory;
41}
42
43QQmlDebugStatesDelegate *QQmlEngineDebugService::createStatesDelegate()
44{
45 return statesDelegateFactory ? statesDelegateFactory() : nullptr;
46}
47
48#if QT_CONFIG(translation)
49QQmlDebugTranslationService::~QQmlDebugTranslationService()
50 = default;
51
52QT_WARNING_PUSH
53QT_WARNING_DISABLE_GCC("-Wmaybe-uninitialized") // known GCC bug with std::optional and std::variant
54const TranslationBindingInformation TranslationBindingInformation::create(
55 const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit,
56 const QV4::CompiledData::Binding *binding, QObject *scopeObject,
57 QQmlRefPointer<QQmlContextData> ctxt)
58{
59 QQmlTranslation translation;
60 if (binding->type() == QV4::CompiledData::Binding::Type_TranslationById) {
61 const QV4::CompiledData::TranslationData data =
62 compilationUnit->unitData()->translations()[binding->value.translationDataIndex];
63 const QString id = compilationUnit->stringAt(data.stringIndex);
64 const int n = data.number;
65
66 translation = QQmlTranslation(QQmlTranslation::QsTrIdData(id, n));
67 } else {
68 Q_ASSERT(binding->type() == QV4::CompiledData::Binding::Type_Translation);
69
70 const QV4::CompiledData::TranslationData data =
71 compilationUnit->unitData()->translations()[binding->value.translationDataIndex];
72 const QString text = compilationUnit->stringAt(data.stringIndex);
73 const QString comment = compilationUnit->stringAt(data.commentIndex);
74 const bool hasContext
75 = data.contextIndex != QV4::CompiledData::TranslationData::NoContextIndex;
76 const int n = data.number;
77
78 translation = QQmlTranslation(
79 QQmlTranslation::QsTrData(
80 hasContext
81 ? compilationUnit->stringAt(data.contextIndex)
82 : QQmlTranslation::contextFromQmlFilename(
83 compilationUnit->fileName()),
84 text, comment, n));
85 }
86
87 return { compilationUnit,
88 scopeObject,
89 ctxt,
90
91 compilationUnit->stringAt(binding->propertyNameIndex),
92 translation,
93
94 binding->location.line(),
95 binding->location.column() };
96}
97QT_WARNING_POP
98#endif
99
100QT_END_NAMESPACE
101
102#include "moc_qqmldebugserviceinterfaces_p.cpp"
Combined button and popup list for selecting options.
static QQmlDebugStatesDelegate *(* statesDelegateFactory)()