QmlDesigner: Support for ExtendedSceneEnvironment.GlowBlendMode

This is the first nested enum scope. Therefore we have to add support
for nested enum scopes.

In a subsequent patch, Enumeration has to be adjusted. This patch is
minimizing the risk for QDS 4.5.

Task-number: QDS-12645
Change-Id: I6ddfa89f3a3038eac8a7ce73c8c593191fa05b84
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Thomas Hartmann
2024-05-03 11:29:42 +02:00
parent 6cec311c5d
commit 96bfa8e29f
2 changed files with 23 additions and 16 deletions

View File

@@ -143,7 +143,7 @@ void PropertyEditorValue::setValue(const QVariant &value)
QString PropertyEditorValue::enumeration() const
{
return m_value.value<Enumeration>().nameToString();
return m_value.value<Enumeration>().nameToString().split('.').last();
}
QString PropertyEditorValue::expression() const

View File

@@ -94,21 +94,23 @@ bool isGlobalQtEnums(QStringView value)
bool isKnownEnumScopes(QStringView value)
{
static constexpr auto list = Utils::to_array<std::u16string_view>({u"TextInput",
u"TextEdit",
u"Material",
u"Universal",
u"Font",
u"Shape",
u"ShapePath",
u"AbstractButton",
u"Text",
u"ShaderEffectSource",
u"Grid",
u"ItemLayer",
u"ImageLayer",
u"SpriteLayer",
u"Light"});
static constexpr auto list = Utils::to_array<std::u16string_view>(
{u"TextInput",
u"TextEdit",
u"Material",
u"Universal",
u"Font",
u"Shape",
u"ShapePath",
u"AbstractButton",
u"Text",
u"ShaderEffectSource",
u"Grid",
u"ItemLayer",
u"ImageLayer",
u"SpriteLayer",
u"Light",
u"ExtendedSceneEnvironment.GlowBlendMode"});
return std::find(std::begin(list), std::end(list), QmlDesigner::ModelUtils::toStdStringView(value))
!= std::end(list);
@@ -559,6 +561,11 @@ public:
//Check for known enum scopes used globally
if (isKnownEnumScopes(astValueList.constFirst()))
return QVariant::fromValue(Enumeration(astValue));
} else if (astValueList.size() == 3) {
QString enumName = astValueList.constFirst() + '.' + astValueList.at(1);
if (isKnownEnumScopes(enumName))
return QVariant::fromValue(
Enumeration(enumName.toUtf8(), astValueList.constLast().toUtf8()));
}
auto eStmt = AST::cast<AST::ExpressionStatement *>(rhs);