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
committerUlf Hermann <ulf.hermann@qt.io>2023-02-03 14:31:51 +0100
commitb8c6c3ea0fe3ab96a31147d8804d3845c79c92b9 (patch)
tree67379214d917fdbaa0f09350f4cf81d6afaddee2 /src/qmlcompiler/qqmljsfunctioninitializer.cpp
parent236439de7b8270d8da0e762fbfaae29aac24f0b0 (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. Pick-to: 6.5 Fixes: QTBUG-105251 Change-Id: I107132294ba0ca56ff522fc29e7a1972553390bd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
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())