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