aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlpropertyvalidator.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-01-31 17:49:42 +0100
committerUlf Hermann <ulf.hermann@qt.io>2024-02-01 16:32:51 +0100
commitf3bcbfd6a50fb7e74f4ff6714d3b3066fa74e253 (patch)
tree675580377465f8988e3903aad22f248bd784de46 /src/qml/qml/qqmlpropertyvalidator.cpp
parent04c1588965b9a4b12ebf04b23e5336fe88bb4f56 (diff)
QtQml: Re-allow assigning of raw numbers to enum property aliases
This used to work and we cannot just take it away. Amends commit 3ea55bf398412d373daab9c92b1498f45de70e96. Pick-to: 6.7 6.6 6.5 6.2 Fixes: QTBUG-121710 Change-Id: I7f856140286bba9d49b7ed1abfdf398a65fb1962 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlpropertyvalidator.cpp')
-rw-r--r--src/qml/qml/qqmlpropertyvalidator.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlpropertyvalidator.cpp b/src/qml/qml/qqmlpropertyvalidator.cpp
index 82fd072698..a49393e425 100644
--- a/src/qml/qml/qqmlpropertyvalidator.cpp
+++ b/src/qml/qml/qqmlpropertyvalidator.cpp
@@ -374,6 +374,11 @@ QQmlError QQmlPropertyValidator::validateLiteralBinding(
if (binding->hasFlag(QV4::CompiledData::Binding::IsResolvedEnum))
return noError;
+ // TODO: For historical reasons you can assign any number to an enum property alias
+ // This can be fixed with an opt-out mechanism, for example a pragma.
+ if (property->isAlias() && binding->isNumberBinding())
+ return noError;
+
QString value = compilationUnit->bindingValueAsString(binding);
QMetaProperty p = propertyCache->firstCppMetaObject()->property(property->coreIndex());
bool ok;