diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2016-08-25 13:55:46 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2016-08-25 11:29:08 +0000 |
commit | 43548effc00079adba91ca25456060c5fb976d5f (patch) | |
tree | 3b6236cc82af64b02dc66fb25598096b3d7b1b0a | |
parent | 8a4f42d88b32747e0c222b06638b8f2aef4d9701 (diff) |
Fix qmlcustomizations example
If the interval coefficient was under 0.25, it resulted as zero
interval for the timer, stopping the animation.
The blinking after animation stopped was also broken, as using var
as a temporary color store doesn't work due to var assignments being
by reference. Using a separate color property instead of var works
around this issue.
Task-number: QTRD-2170
Change-Id: I7224ff259a076da3c6e5e6e66bc0c3031aa1dda6
Reviewed-by: Mika Salmela <mika.salmela@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r-- | examples/charts/qmlcustomizations/qml/qmlcustomizations/main.qml | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/charts/qmlcustomizations/qml/qmlcustomizations/main.qml b/examples/charts/qmlcustomizations/qml/qmlcustomizations/main.qml index d10b12c8..391248e6 100644 --- a/examples/charts/qmlcustomizations/qml/qmlcustomizations/main.qml +++ b/examples/charts/qmlcustomizations/qml/qmlcustomizations/main.qml @@ -61,7 +61,7 @@ Item { //![2] Component.onCompleted: { - __intervalCoefficient = Math.random() + 0.1; + __intervalCoefficient = Math.random() + 0.25; for (var i = 0; i < 20; i++) wheelOfFortune.append("", 1); @@ -77,6 +77,8 @@ Item { //![2] Timer { + id: timer + property color switchColor triggeredOnStart: true running: true repeat: true @@ -101,9 +103,9 @@ Item { //![5] // Switch the colors of the slice and the border wheelOfFortune.at(index).borderWidth = 2; - var borderColor = wheelOfFortune.at(index).borderColor; + switchColor = wheelOfFortune.at(index).borderColor; wheelOfFortune.at(index).borderColor = wheelOfFortune.at(index).color; - wheelOfFortune.at(index).color = borderColor; + wheelOfFortune.at(index).color = switchColor; //![5] } } |