aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2022-02-11 14:22:39 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-02-12 01:47:39 +0000
commit561047e095c136474b7d433372c5f779f82d7982 (patch)
treefe5c966abcff96a75df4eaee074e740f0bdc5eab
parent9c9d6410cae82aa5d624b7bc2654711f34d6588d (diff)
Record deferred and immediate names of anonymous types in qmltypes
Anonymous types can have deferred properties. For instance, a type of a group property might come from C++ (marked with QML_ANONYMOUS) Change-Id: I8e372d5c05d3da2ca86fdb084d730c98c24331f5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit ce942b2cbd97c82bf6e60e936e5f1601994b6d17) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/qmltyperegistrar/qmltypescreator.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/qmltyperegistrar/qmltypescreator.cpp b/src/qmltyperegistrar/qmltypescreator.cpp
index d7eef3421c..135c960758 100644
--- a/src/qmltyperegistrar/qmltypescreator.cpp
+++ b/src/qmltyperegistrar/qmltypescreator.cpp
@@ -85,7 +85,23 @@ void QmlTypesCreator::writeClassProperties(const QmlTypesClassDescription &colle
m_qml.writeArrayBinding(QLatin1String("interfaces"), interfaces);
}
- if (collector.elementName.isEmpty())
+ if (!collector.deferredNames.isEmpty()) {
+ QStringList deferredNames;
+ for (const QString &name : collector.deferredNames)
+ deferredNames << enquote(name);
+
+ m_qml.writeArrayBinding(QLatin1String("deferredNames"), deferredNames);
+ }
+
+ if (!collector.immediateNames.isEmpty()) {
+ QStringList immediateNames;
+ for (const QString &name : collector.immediateNames)
+ immediateNames << enquote(name);
+
+ m_qml.writeArrayBinding(QLatin1String("immediateNames"), immediateNames);
+ }
+
+ if (collector.elementName.isEmpty()) // e.g. if QML_ANONYMOUS
return;
QStringList exports;
@@ -119,22 +135,6 @@ void QmlTypesCreator::writeClassProperties(const QmlTypesClassDescription &colle
if (collector.hasCustomParser)
m_qml.writeScriptBinding(QLatin1String("hasCustomParser"), QLatin1String("true"));
- if (!collector.deferredNames.isEmpty()) {
- QStringList deferredNames;
- for (const QString &name : collector.deferredNames)
- deferredNames << enquote(name);
-
- m_qml.writeArrayBinding(QLatin1String("deferredNames"), deferredNames);
- }
-
- if (!collector.immediateNames.isEmpty()) {
- QStringList immediateNames;
- for (const QString &name : collector.immediateNames)
- immediateNames << enquote(name);
-
- m_qml.writeArrayBinding(QLatin1String("immediateNames"), immediateNames);
- }
-
m_qml.writeArrayBinding(QLatin1String("exportMetaObjectRevisions"), metaObjects);
if (!collector.attachedType.isEmpty())