diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2023-01-23 14:44:32 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-01-25 18:08:36 +0100 |
commit | 518509297fd545892ed4200b7b806f87d19cc57d (patch) | |
tree | f24ae9289aa36fa41b5fea9715fb17fc05cf9649 /src | |
parent | 6972cf37228a9808ed225915b1fc4e38ff17b06a (diff) |
qmltyperegistrar: Strip '*' from list value types
We do this for function return types, property types, and function
argument types already. Formally, we would have to store some
"isPointer" somewhere, but considering that we never read it anyway,
let's not go there.
This allows the compilers to recognize lists of QObject-derived types as
proper lists. This way we can generate better code for moving them
around or getting their length.
Pick-to: 6.5
Task-number: QTBUG-110438
Change-Id: I35e0fc21d574afc18799e9c3cef402f05b60a3ed
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qmltyperegistrar/qqmltypescreator.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/qmltyperegistrar/qqmltypescreator.cpp b/src/qmltyperegistrar/qqmltypescreator.cpp index d9d2ab6763..dbc438c50e 100644 --- a/src/qmltyperegistrar/qqmltypescreator.cpp +++ b/src/qmltyperegistrar/qqmltypescreator.cpp @@ -50,8 +50,12 @@ void QmlTypesCreator::writeClassProperties(const QmlTypesClassDescription &colle if (!collector.superClass.isEmpty()) m_qml.writeScriptBinding(QLatin1String("prototype"), enquote(collector.superClass)); - if (!collector.sequenceValueType.isEmpty()) - m_qml.writeScriptBinding(QLatin1String("valueType"), enquote(collector.sequenceValueType)); + if (!collector.sequenceValueType.isEmpty()) { + const QString name = collector.sequenceValueType.endsWith('*'_L1) + ? collector.sequenceValueType.chopped(1) + : collector.sequenceValueType; + m_qml.writeScriptBinding(QLatin1String("valueType"), enquote(name)); + } if (!collector.extensionType.isEmpty()) m_qml.writeScriptBinding(QLatin1String("extension"), enquote(collector.extensionType)); |