-
Bug
-
Resolution: Done
-
Not Evaluated
-
4.7.4
-
None
-
f18b66ac6cfc734d217ec9d44876774f25e5d900
Issue 1: In the following example, the Behavior is never created (CREATE_SIMPLE and STORE_VALUE_INTERCEPTOR instructions are not generated for the Behavior)
import QtQuick 2.0
Rectangle {
width: 400
height: 400
color.r: 0
color.g: 1
color.b: 0
Behavior on color { ColorAnimation { duration: 500; } }
}
Issue 2: In the following example, the error "Property has already been assigned a value" is produced:
import QtQuick 2.0 Rectangle { width: 400 height: 400 color: "green" Behavior on color.r { ColorAnimation { duration: 500; } } }
The following patch gets rid of the error for issue 2, but still doesn't not allow the two color-related assignments to play well with each other:
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index fb98a8c..900ffd3 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -1997,10 +1997,15 @@ bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeScript::Property *pr
if (prop->type >= 0 && enginePrivate->valueTypes[prop->type]) {
if (!prop->values.isEmpty()) {
- if (prop->values.first()->location < prop->value->location) {
- COMPILE_EXCEPTION(prop->value, tr( "Property has already been assigned a value"));
- } else {
- COMPILE_EXCEPTION(prop->values.first(), tr( "Property has already been assigned a value"));
+ //only error if we are assigning values, and not e.g. a property interceptor
+ for (Property *dotProp = prop->value->properties.first(); dotProp; dotProp = prop->value->properties.next(dotProp)) {
+ if (!dotProp->values.isEmpty()) {
+ if (prop->values.first()->location < prop->value->location) {
+ COMPILE_EXCEPTION(prop->value, tr( "Property has already been assigned a value"));
+ } else {
+ COMPILE_EXCEPTION(prop->values.first(), tr( "Property has already been assigned a value"));
+ }
+ }
}
}
The issue is caused at the compiler level where the two assignments appear to be mutually exclusive, e.g. either buildGroupedProperty or buildPropertyAssignment will be called, but not both.
- resulted from
-
QTBUG-20827 Adding a Behavior to Scale's origin.x/y sets x/y to 0
-
- Closed
-