QmlJSEditor: Fix hovering color properties

Color properties set with hex color values display a
color tool tip, but named colors failed for Qt6 while
it was still working with Qt5.

Change-Id: I6457bbdc86dd7f036bc48dc40cfa16cda570b95f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
This commit is contained in:
Christian Stenger
2024-03-22 15:01:15 +01:00
parent 718fdcc607
commit 830e09ccca

View File

@@ -293,7 +293,9 @@ bool QmlJSHoverHandler::matchColorItem(const ScopeChain &scopeChain,
if (auto binding = AST::cast<const AST::UiScriptBinding *>(member)) { if (auto binding = AST::cast<const AST::UiScriptBinding *>(member)) {
if (binding->qualifiedId && posIsInSource(pos, binding->statement)) { if (binding->qualifiedId && posIsInSource(pos, binding->statement)) {
value = scopeChain.evaluate(binding->qualifiedId); value = scopeChain.evaluate(binding->qualifiedId);
if (value && value->asColorValue()) { if (value && (value->asColorValue()
|| (value->asCppComponentValue()
&& value->asCppComponentValue()->className() == "color"))) {
color = textAt(qmlDocument, color = textAt(qmlDocument,
binding->statement->firstSourceLocation(), binding->statement->firstSourceLocation(),
binding->statement->lastSourceLocation()); binding->statement->lastSourceLocation());