aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsfunctioninitializer.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-01-16 18:17:10 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-02-04 07:34:49 +0000
commit9f5ee86550bae7eaf7e2ffe6458b35e0a25496c0 (patch)
tree96ab9bb853195f919a691e23814b827e39bd75f6 /src/qmlcompiler/qqmljsfunctioninitializer.cpp
parent7301e4d5bf22375b53e775c2550b6990b30e222a (diff)
QmlCompiler: Add hint about generalized grouped properties
If a property cannot be found but there are immediate properties in the surrounding type, that indicates that the construct in question may be phrased using generalized grouped properties. Fixes: QTBUG-105251 Change-Id: I107132294ba0ca56ff522fc29e7a1972553390bd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit b8c6c3ea0fe3ab96a31147d8804d3845c79c92b9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/qmlcompiler/qqmljsfunctioninitializer.cpp')
-rw-r--r--src/qmlcompiler/qqmljsfunctioninitializer.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/qmlcompiler/qqmljsfunctioninitializer.cpp b/src/qmlcompiler/qqmljsfunctioninitializer.cpp
index 997771489b..a9322e90c8 100644
--- a/src/qmlcompiler/qqmljsfunctioninitializer.cpp
+++ b/src/qmlcompiler/qqmljsfunctioninitializer.cpp
@@ -213,9 +213,15 @@ QQmlJSCompilePass::Function QQmlJSFunctionInitializer::run(
? m_typeResolver->qObjectListType()
: propertyType;
} else {
- diagnose(u"Cannot resolve property type %1 for binding on %2"_s.arg(
- property.typeName(), propertyName),
- QtWarningMsg, bindingLocation, error);
+ QString message = u"Cannot resolve property type %1 for binding on %2."_s
+ .arg(property.typeName(), propertyName);
+ if (m_objectType->isNameDeferred(propertyName)) {
+ // If the property doesn't exist but the name is deferred, then
+ // it's deferred via the presence of immediate names. Those are
+ // most commonly used to enable generalized grouped properties.
+ message += u" You may want use ID-based grouped properties here.";
+ }
+ diagnose(message, QtWarningMsg, bindingLocation, error);
}
if (!property.bindable().isEmpty() && !property.isPrivate())