Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Little mistake in example

Little mistake in example

Scheduled Pinned Locked Moved QML and Qt Quick
9 Posts 3 Posters 1.8k Views
  • 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 Offline
    T Offline
    tarod.net
    wrote on last edited by
    #1

    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
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

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

      (Z(:^

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tarod.net
        wrote on last edited by
        #3

        [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
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          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
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            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
            0
            • T Offline
              T Offline
              tarod.net
              wrote on last edited by
              #6

              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
              0
              • T Offline
                T Offline
                tarod.net
                wrote on last edited by
                #7

                [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
                0
                • sierdzioS Offline
                  sierdzioS Offline
                  sierdzio
                  Moderators
                  wrote on last edited by
                  #8

                  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
                  0
                  • T Offline
                    T Offline
                    tarod.net
                    wrote on last edited by
                    #9

                    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
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved