Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.7.0
-
None
-
0c1f1b8c8f5641609e1a07622127f4e0780c2247
Description
A gradient can only be changed in a State transition if it's referenced externally, by an id;
import Qt 4.6 Rectangle { id: myItem width: 150 height: 150 Rectangle { id: blueBox x : 40 y : 40 width: 50 height: 50 gradient: Gradient { GradientStop { position: 0.0; color: "blue" } GradientStop { position: 1.0; color: "lightsteelblue" } } Gradient { id: newGradient GradientStop { position: 0.0; color: "lightsteelblue" } GradientStop { position: 1.0; color: "blue" } } states : State { name : "inversegradient" when : rbmr.pressed PropertyChanges { target: blueBox gradient: newGradient // *** This does not work *** // gradient: Gradient { // GradientStop { position: 0.0; color: "lightsteelblue" } // GradientStop { position: 1.0; color: "blue" } // } } } } Rectangle { x: 100 y : 100 width: 10 height: 10 color: "red" id: redBox MouseRegion { id : rbmr anchors.fill : parent hoverEnabled: true onClicked: { console.log( "mouse pressed" ) } } } }