Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Little mistake in example

    QML and Qt Quick
    3
    9
    1402
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      tarod.net last edited by

      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: 200

      property 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.

      "Individually, we are one drop. Together, we are an ocean."

      1 Reply Last reply Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

        Why do you think it is a mistake? Do you get any errors at runtime?

        (Z(:^

        1 Reply Last reply Reply Quote 0
        • T
          tarod.net last edited by

          [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.

          "Individually, we are one drop. Together, we are an ocean."

          1 Reply Last reply Reply Quote 0
          • sierdzio
            sierdzio Moderators last edited by

            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.

            (Z(:^

            1 Reply Last reply Reply Quote 0
            • SGaist
              SGaist Lifetime Qt Champion last edited by

              Hi,

              Which version of Qt are you using ? Just tested and it seemed to be working fine

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply Reply Quote 0
              • T
                tarod.net last edited by

                Thank you very much.

                I'm going to report this little mistake.

                "Individually, we are one drop. Together, we are an ocean."

                1 Reply Last reply Reply Quote 0
                • T
                  tarod.net last edited by

                  [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.

                  "Individually, we are one drop. Together, we are an ocean."

                  1 Reply Last reply Reply Quote 0
                  • sierdzio
                    sierdzio Moderators last edited by

                    No, because the child see the scope of the parent. But it does help in reading to be more explicit, so you are right.

                    (Z(:^

                    1 Reply Last reply Reply Quote 0
                    • T
                      tarod.net last edited by

                      Mmm... it is strange then because I don't understand why it is not working.

                      Thanks anyway!

                      "Individually, we are one drop. Together, we are an ocean."

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post