From b8c6c3ea0fe3ab96a31147d8804d3845c79c92b9 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 16 Jan 2023 18:17:10 +0100 Subject: 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 --- src/qmlcompiler/qqmljsfunctioninitializer.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/qmlcompiler/qqmljsfunctioninitializer.cpp') 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()) -- cgit v1.2.3