Little mistake in example
-
Hi!
I think in this example (found on http://qt-project.org/doc/qt-5/qmlfirststeps.html#animations) there is a mistake:
@Rectangle {
color: "lightgray"
width: 200
height: 200property int animatedValue: 0 SequentialAnimation on animatedValue { loops: Animation.Infinite PropertyAnimation { to: 150; duration: 1000 } PropertyAnimation { to: 0; duration: 1000 } } Text { anchors.centerIn: parent text: animatedValue }
}@
"text: animatedValue" should be "text: parent.animatedValue". Another option could be add an id in Rectangle and use it in Text (i.e. myrect.animatedValue)
Sorry it this message should be posted in a different thread.
-
Why do you think it is a mistake? Do you get any errors at runtime?
-
[quote author="sierdzio" date="1407733359"]Why do you think it is a mistake? Do you get any errors at runtime?[/quote]
Well, the example is to show a number from 0 to 150 in the rectangle, but actually the rectangle doesn't show any text.
I need to change the line I wrote in my first post to get the right behavior.
-
OK. Please report this bug "here":http://qt-project.org/wiki/ReportingBugsInQt. If you have the time and will to fix it yourself, here is a oage on "contributing to Qt":http://wiki.qt-project.org/Main_Page.
-
Hi,
Which version of Qt are you using ? Just tested and it seemed to be working fine
-
[quote author="SGaist" date="1407759280"]Hi,
Which version of Qt are you using ? Just tested and it seemed to be working fine[/quote]
Qt 5.3. I'm using Debian and Qt Creator.
Anyway, you are saying that it is not necessary to add the parent or the object which has the attribute, but it seems the logical way to me.
-
No, because the child see the scope of the parent. But it does help in reading to be more explicit, so you are right.