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. Dealing with animations
Forum Updated to NodeBB v4.3 + New Features

Dealing with animations

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
38 Posts 6 Posters 11.4k Views 2 Watching
  • 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.
  • tomyT tomy

    @mrjj
    Hi,
    Thanks for your time. But that example is much more complicated the my own one! :)

    If you answer the questions (I've asked more than three times here on this thread) about simple things, I think it would also be helpful. :)

    1- Why isn't the property on x or y but a string with a floating point value 0.0?
    2- Why isn't there any change if we don't use 0.0 but a negative number, say, -5, or a positive one, say, +5, or farther?

    3- Why isn't there any change when we alter the duration and make big difference?

    J.HilkJ Offline
    J.HilkJ Offline
    J.Hilk
    Moderators
    wrote on last edited by
    #13

    HI, let me see if I can help you.
    @tomy said in Dealing with animations:

    1- Why isn't the property on x or y but a string with a floating point value 0.0?
    The property property is basicaly the reference what property shall be targeted for the animation, its referenced as a string.
    Would you want to change the x value you would have to write property: "x" for y property: "y" for x and y properties: "x,y"

    Why is it a string instead of the property, well no idea, but my best guess is, if its a propery you would have to reference it with an ID e.g myItem.x. But that is lost of you convoluted QML obejects. And everything but an Item is convoluted.

    2- Why isn't there any change if we don't use 0.0 but a negative number, say, -5, or a positive one, say, +5, or farther?

    3- Why isn't there any change when we alter the duration and make big difference?

    No idea, I find this example very confusing and hard to read.
    Have you tried the Qt Quick Examples - Animation ? I think that would be better for getting started in QML-Animations


    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


    Q: What's that?
    A: It's blue light.
    Q: What does it do?
    A: It turns blue.

    tomyT 1 Reply Last reply
    2
    • J.HilkJ J.Hilk

      HI, let me see if I can help you.
      @tomy said in Dealing with animations:

      1- Why isn't the property on x or y but a string with a floating point value 0.0?
      The property property is basicaly the reference what property shall be targeted for the animation, its referenced as a string.
      Would you want to change the x value you would have to write property: "x" for y property: "y" for x and y properties: "x,y"

      Why is it a string instead of the property, well no idea, but my best guess is, if its a propery you would have to reference it with an ID e.g myItem.x. But that is lost of you convoluted QML obejects. And everything but an Item is convoluted.

      2- Why isn't there any change if we don't use 0.0 but a negative number, say, -5, or a positive one, say, +5, or farther?

      3- Why isn't there any change when we alter the duration and make big difference?

      No idea, I find this example very confusing and hard to read.
      Have you tried the Qt Quick Examples - Animation ? I think that would be better for getting started in QML-Animations

      tomyT Offline
      tomyT Offline
      tomy
      wrote on last edited by tomy
      #14

      @J-Hilk
      Hi, Thanks, you did.

      but my best guess is, if its a propery you would have to reference it with an ID e.g myItem.x.

      Did you mean that 'value' acts here like a unique property making the property independent of need to refer to a specific item's property?

      No idea, I find this example very confusing and hard to read.

      So do I. I'm highly astonished why there isn't any good reference appropriate for newcomers of QML!! It's a hardship.
      Thanks also for the example. I'm appreciative of that but it's too long for this level of me (hundreds of lines of code with several components including many types and new items). I would need a simpler one.
      Anyway, if Docs is the only reference for learning QML in your point of view too, which is better than that online book, where to start from? Some point that much resembles a step-by-step route from beginning to the end (similar to a book).

      J.HilkJ 1 Reply Last reply
      0
      • tomyT tomy

        @J-Hilk
        Hi, Thanks, you did.

        but my best guess is, if its a propery you would have to reference it with an ID e.g myItem.x.

        Did you mean that 'value' acts here like a unique property making the property independent of need to refer to a specific item's property?

        No idea, I find this example very confusing and hard to read.

        So do I. I'm highly astonished why there isn't any good reference appropriate for newcomers of QML!! It's a hardship.
        Thanks also for the example. I'm appreciative of that but it's too long for this level of me (hundreds of lines of code with several components including many types and new items). I would need a simpler one.
        Anyway, if Docs is the only reference for learning QML in your point of view too, which is better than that online book, where to start from? Some point that much resembles a step-by-step route from beginning to the end (similar to a book).

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #15

        @tomy said in Dealing with animations:

        Did you mean that 'value' acts here like a unique property making the property independent of need to refer to a specific item's property?

        It basically looks for a specific property name, in this case value of your QML-Object and all its "base-classes" and binds the animation to that property, if it can find one appropriatly named.

        I would guess a process similar to Qt4 SignalSlot

        Thanks also for the example. I'm appreciative of that but it's too long for this level of me (hundreds of lines of code with several components including many types and new items). I would need a simpler one.

        of course the example covers more or less the whole area of property animations. For your current case, you should simply look into Transitions.qml. Thats 133 Lines of code dealing with 3 Rectangels a logo and NumberAnimation and states. You should be able to simply copy and paste that into a clean new project.

        Anyway, if Docs is the only reference for learning QML in your point of view too, which is better than that online book, where to start from? Some point that much resembles a step-by-step route from beginning to the end (similar to a book).

        In the end it really depends on you, your time available and the money you're willing to spend.

        There are a couple Qt-certificated Partners that offer small group training sessions, KDAB comes to my mind here. Really good and usually on the point, but very expensive.

        What I usually do is the following:

        • I set in mind a specific goal I want to archive.
        • If its new territory, do a quick google search on the topic.
        • Spend some time going through examples, trying to understand them.
        • Create a basic working program with the examples and/or the docu
        • If that is more difficult than expected => recreate the example by hand
        • Refine and expand the code until the previously set goal is reached

        this usually takes some time, but I can also remember stuff years later ;-)


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        tomyT 1 Reply Last reply
        2
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #16

          Hi
          Maybe this one is is worth checking out
          https://www.amazon.com/Getting-started-Quick-multidevice-applications-ebook/dp/B01B9DV54G

          1 Reply Last reply
          1
          • tekojoT Offline
            tekojoT Offline
            tekojo
            wrote on last edited by
            #17

            @tomy
            You might want to take a look at the QML book https://qmlbook.github.io/en/
            Chapter 5 talks about animations.

            mrjjM tomyT 2 Replies Last reply
            2
            • tekojoT tekojo

              @tomy
              You might want to take a look at the QML book https://qmlbook.github.io/en/
              Chapter 5 talks about animations.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #18

              @tekojo
              I think he is already using the book but feels its not as detailed step by step as he would like.
              As far as I could find, it is the book for learning QML.

              1 Reply Last reply
              1
              • tomyT tomy

                @mrjj
                Hi,
                Thanks for your time. But that example is much more complicated the my own one! :)

                If you answer the questions (I've asked more than three times here on this thread) about simple things, I think it would also be helpful. :)

                1- Why isn't the property on x or y but a string with a floating point value 0.0?
                2- Why isn't there any change if we don't use 0.0 but a negative number, say, -5, or a positive one, say, +5, or farther?

                3- Why isn't there any change when we alter the duration and make big difference?

                M Offline
                M Offline
                mostefa
                wrote on last edited by mostefa
                #19

                @tomy said in Dealing with animations:

                @mrjj
                Hi,
                Thanks for your time. But that example is much more complicated the my own one! :)

                If you answer the questions (I've asked more than three times here on this thread) about simple things, I think it would also be helpful. :)

                1- Why isn't the property on x or y but a string with a floating point value 0.0?
                2- Why isn't there any change if we don't use 0.0 but a negative number, say, -5, or a positive one, say, +5, or farther?

                3- Why isn't there any change when we alter the duration and make big difference?

                Easing is the curve that is used during your animation, have a look at this doc about easing.

                I advise you also to run this example , and to see how easing change your animation.

                1- Why isn't the property on x or y but a string with a floating point value 0.0?

                The string is used in property to know which property we need to animate , see this link

                property : string

                These properties are used as a set to determine which properties should be animated. The singular and plural forms are functionally identical, e.g.

                NumberAnimation { target: theItem; property: "x"; to: 500 }

                2- Why isn't there any change if we don't use 0.0 but a negative number, say, -5, or a positive one, say, +5, or farther?

                Because the -5 that you are writing is just an initial value, after that you are telling in NumberAnimation that value must be from 0 to 1.

                NumberAnimation {
                    id: anim
                    target: root
                    property: 'value'
                    from: 0
                    to: 1
                    duration: 3000
                }
                

                3- Why isn't there any change when we alter the duration and make big difference?

                Cause your animation is driven by AnimationController (in your case the timer is not used at all) and the Qt Doc says that :

                Normally animations are driven by an internal timer, but the AnimationController allows the given animation to be driven by a progress value explicitly.

                As @tekojo said qmlbook is a good one to start qml.

                I don't know what are you doing exactly , but for my personal opinion you don't have to use AnimationController at all. you can do a lot of funny animation only with (NumberAnimation , SequentialAnimation, ParallelAnimation)

                Take a look in this Qt Quick Example

                I hope this can help you , and if not ,you can tell me what do you want to achieve , and i will try to help you !

                tomyT 1 Reply Last reply
                3
                • J.HilkJ J.Hilk

                  @tomy said in Dealing with animations:

                  Did you mean that 'value' acts here like a unique property making the property independent of need to refer to a specific item's property?

                  It basically looks for a specific property name, in this case value of your QML-Object and all its "base-classes" and binds the animation to that property, if it can find one appropriatly named.

                  I would guess a process similar to Qt4 SignalSlot

                  Thanks also for the example. I'm appreciative of that but it's too long for this level of me (hundreds of lines of code with several components including many types and new items). I would need a simpler one.

                  of course the example covers more or less the whole area of property animations. For your current case, you should simply look into Transitions.qml. Thats 133 Lines of code dealing with 3 Rectangels a logo and NumberAnimation and states. You should be able to simply copy and paste that into a clean new project.

                  Anyway, if Docs is the only reference for learning QML in your point of view too, which is better than that online book, where to start from? Some point that much resembles a step-by-step route from beginning to the end (similar to a book).

                  In the end it really depends on you, your time available and the money you're willing to spend.

                  There are a couple Qt-certificated Partners that offer small group training sessions, KDAB comes to my mind here. Really good and usually on the point, but very expensive.

                  What I usually do is the following:

                  • I set in mind a specific goal I want to archive.
                  • If its new territory, do a quick google search on the topic.
                  • Spend some time going through examples, trying to understand them.
                  • Create a basic working program with the examples and/or the docu
                  • If that is more difficult than expected => recreate the example by hand
                  • Refine and expand the code until the previously set goal is reached

                  this usually takes some time, but I can also remember stuff years later ;-)

                  tomyT Offline
                  tomyT Offline
                  tomy
                  wrote on last edited by
                  #20

                  @J.Hilk
                  Thank you for all of your suggestions. I appreciate them.

                  1 Reply Last reply
                  0
                  • tekojoT tekojo

                    @tomy
                    You might want to take a look at the QML book https://qmlbook.github.io/en/
                    Chapter 5 talks about animations.

                    tomyT Offline
                    tomyT Offline
                    tomy
                    wrote on last edited by
                    #21

                    @tekojo
                    Thanks, but I think I'm reading that book and getting stuck in it often! :)

                    1 Reply Last reply
                    0
                    • M mostefa

                      @tomy said in Dealing with animations:

                      @mrjj
                      Hi,
                      Thanks for your time. But that example is much more complicated the my own one! :)

                      If you answer the questions (I've asked more than three times here on this thread) about simple things, I think it would also be helpful. :)

                      1- Why isn't the property on x or y but a string with a floating point value 0.0?
                      2- Why isn't there any change if we don't use 0.0 but a negative number, say, -5, or a positive one, say, +5, or farther?

                      3- Why isn't there any change when we alter the duration and make big difference?

                      Easing is the curve that is used during your animation, have a look at this doc about easing.

                      I advise you also to run this example , and to see how easing change your animation.

                      1- Why isn't the property on x or y but a string with a floating point value 0.0?

                      The string is used in property to know which property we need to animate , see this link

                      property : string

                      These properties are used as a set to determine which properties should be animated. The singular and plural forms are functionally identical, e.g.

                      NumberAnimation { target: theItem; property: "x"; to: 500 }

                      2- Why isn't there any change if we don't use 0.0 but a negative number, say, -5, or a positive one, say, +5, or farther?

                      Because the -5 that you are writing is just an initial value, after that you are telling in NumberAnimation that value must be from 0 to 1.

                      NumberAnimation {
                          id: anim
                          target: root
                          property: 'value'
                          from: 0
                          to: 1
                          duration: 3000
                      }
                      

                      3- Why isn't there any change when we alter the duration and make big difference?

                      Cause your animation is driven by AnimationController (in your case the timer is not used at all) and the Qt Doc says that :

                      Normally animations are driven by an internal timer, but the AnimationController allows the given animation to be driven by a progress value explicitly.

                      As @tekojo said qmlbook is a good one to start qml.

                      I don't know what are you doing exactly , but for my personal opinion you don't have to use AnimationController at all. you can do a lot of funny animation only with (NumberAnimation , SequentialAnimation, ParallelAnimation)

                      Take a look in this Qt Quick Example

                      I hope this can help you , and if not ,you can tell me what do you want to achieve , and i will try to help you !

                      tomyT Offline
                      tomyT Offline
                      tomy
                      wrote on last edited by
                      #22

                      @mostefa
                      Thank you very much. It was helpful and I appreciate you.
                      The book you (and the other guy) suggested is the one I'm currently reading.

                      1 Reply Last reply
                      1
                      • tomyT Offline
                        tomyT Offline
                        tomy
                        wrote on last edited by tomy
                        #23

                        @mostefa

                        I want to explain the first parts of the code based on my understanding and if possible, you please state your idea on it.

                        Rectangle {
                            id: root
                            width: 100
                            height: 100
                            clip: true
                            property real value: 0.0
                            property int pointCount: 100
                            property string title
                            signal clicked()
                        
                            property alias easingType: anim.easing.type
                        
                        
                            Image {
                                anchors.fill: parent
                                source: "blueprint.jpg"
                            }
                        
                            Rectangle {
                                anchors.fill: view
                                anchors.leftMargin: -8
                                anchors.rightMargin: -8
                                color: 'transparent'
                                border.color: "#53d769"
                                border.width: 4
                                opacity: 0.5
                        
                            }
                        
                            NumberAnimation {
                                id: anim
                                target: root
                                property: "value"
                                from: 0
                                to: 1
                            }
                        

                        First we have a squared rectangle (100, 100) that limits all painting to its borders. And it has some properties (of types real, int, string, signal and alias) which will be used later on the code. Until now that rectangle won't be shown because it hasn't a color.

                        On Image, the blue square like one of these will fit onto the previous rectangle.

                        After these two items, we reach the next Rectangle with the color transparent. This rectangle is mostly for drawing two top and down lines to act like two x-axes for the curve.
                        The next object is NumberAnimation. It specifies the root as its target and the property as 'value' to be used by the AnimationController. It also sets the range to be used for making the curve from 0 to 1. I remove the duration property.

                        Up to this point, is all of the above comprehension about each section correct please?

                        M 1 Reply Last reply
                        1
                        • tomyT tomy

                          @mostefa

                          I want to explain the first parts of the code based on my understanding and if possible, you please state your idea on it.

                          Rectangle {
                              id: root
                              width: 100
                              height: 100
                              clip: true
                              property real value: 0.0
                              property int pointCount: 100
                              property string title
                              signal clicked()
                          
                              property alias easingType: anim.easing.type
                          
                          
                              Image {
                                  anchors.fill: parent
                                  source: "blueprint.jpg"
                              }
                          
                              Rectangle {
                                  anchors.fill: view
                                  anchors.leftMargin: -8
                                  anchors.rightMargin: -8
                                  color: 'transparent'
                                  border.color: "#53d769"
                                  border.width: 4
                                  opacity: 0.5
                          
                              }
                          
                              NumberAnimation {
                                  id: anim
                                  target: root
                                  property: "value"
                                  from: 0
                                  to: 1
                              }
                          

                          First we have a squared rectangle (100, 100) that limits all painting to its borders. And it has some properties (of types real, int, string, signal and alias) which will be used later on the code. Until now that rectangle won't be shown because it hasn't a color.

                          On Image, the blue square like one of these will fit onto the previous rectangle.

                          After these two items, we reach the next Rectangle with the color transparent. This rectangle is mostly for drawing two top and down lines to act like two x-axes for the curve.
                          The next object is NumberAnimation. It specifies the root as its target and the property as 'value' to be used by the AnimationController. It also sets the range to be used for making the curve from 0 to 1. I remove the duration property.

                          Up to this point, is all of the above comprehension about each section correct please?

                          M Offline
                          M Offline
                          mostefa
                          wrote on last edited by
                          #24

                          @tomy said in Dealing with animations:

                          @mostefa

                          I want to explain the first parts of the code based on my understanding and if possible, you please state your idea on it.

                          Rectangle {
                              id: root
                              width: 100
                              height: 100
                              clip: true
                              property real value: 0.0
                              property int pointCount: 100
                              property string title
                              signal clicked()
                          
                              property alias easingType: anim.easing.type
                          
                          
                              Image {
                                  anchors.fill: parent
                                  source: "blueprint.jpg"
                              }
                          
                              Rectangle {
                                  anchors.fill: view
                                  anchors.leftMargin: -8
                                  anchors.rightMargin: -8
                                  color: 'transparent'
                                  border.color: "#53d769"
                                  border.width: 4
                                  opacity: 0.5
                          
                              }
                          
                              NumberAnimation {
                                  id: anim
                                  target: root
                                  property: "value"
                                  from: 0
                                  to: 1
                              }
                          

                          First we have a squared rectangle (100, 100) that limits all painting to its borders. And it has some properties (of types real, int, string, signal and alias) which will be used later on the code. Until now that rectangle won't be shown because it hasn't a color.

                          On Image, the blue square like one of these will fit onto the previous rectangle.

                          After these two items, we reach the next Rectangle with the color transparent. This rectangle is mostly for drawing two top and down lines to act like two x-axes for the curve.
                          The next object is NumberAnimation. It specifies the root as its target and the property as 'value' to be used by the AnimationController. It also sets the range to be used for making the curve from 0 to 1. I remove the duration property.

                          Up to this point, is all of the above comprehension about each section correct please?

                          For me i think that all your explanation is correct ! =)

                          tomyT 1 Reply Last reply
                          2
                          • M mostefa

                            @tomy said in Dealing with animations:

                            @mostefa

                            I want to explain the first parts of the code based on my understanding and if possible, you please state your idea on it.

                            Rectangle {
                                id: root
                                width: 100
                                height: 100
                                clip: true
                                property real value: 0.0
                                property int pointCount: 100
                                property string title
                                signal clicked()
                            
                                property alias easingType: anim.easing.type
                            
                            
                                Image {
                                    anchors.fill: parent
                                    source: "blueprint.jpg"
                                }
                            
                                Rectangle {
                                    anchors.fill: view
                                    anchors.leftMargin: -8
                                    anchors.rightMargin: -8
                                    color: 'transparent'
                                    border.color: "#53d769"
                                    border.width: 4
                                    opacity: 0.5
                            
                                }
                            
                                NumberAnimation {
                                    id: anim
                                    target: root
                                    property: "value"
                                    from: 0
                                    to: 1
                                }
                            

                            First we have a squared rectangle (100, 100) that limits all painting to its borders. And it has some properties (of types real, int, string, signal and alias) which will be used later on the code. Until now that rectangle won't be shown because it hasn't a color.

                            On Image, the blue square like one of these will fit onto the previous rectangle.

                            After these two items, we reach the next Rectangle with the color transparent. This rectangle is mostly for drawing two top and down lines to act like two x-axes for the curve.
                            The next object is NumberAnimation. It specifies the root as its target and the property as 'value' to be used by the AnimationController. It also sets the range to be used for making the curve from 0 to 1. I remove the duration property.

                            Up to this point, is all of the above comprehension about each section correct please?

                            For me i think that all your explanation is correct ! =)

                            tomyT Offline
                            tomyT Offline
                            tomy
                            wrote on last edited by
                            #25

                            @mostefa
                            Thank you.

                            M 1 Reply Last reply
                            0
                            • tomyT tomy

                              @mostefa
                              Thank you.

                              M Offline
                              M Offline
                              mostefa
                              wrote on last edited by
                              #26

                              @tomy said in Dealing with animations:

                              @mostefa
                              Thank you.

                              You are welcome =)

                              1 Reply Last reply
                              0
                              • E Offline
                                E Offline
                                Eeli K
                                wrote on last edited by
                                #27

                                @tomy This is going to be off-topic, but I thought maybe I could help in another way.

                                Maybe the problem is not so much the book (which really is problematic in some ways) but your learning strategy. You seem to want to understand every detail when you see it. It's a good thing but can lead to situation where you get stuck with things which are actually irrelevant for you at the moment. You have said you need and want to learn QML. Why? For what do you need it? Do you want to learn to animate cool visual things? Or do you want to create a working and practical user interface for some application which you need? If it's the latter, you don't need animations at all and can read the animation part of the book with a cursory glance. Nobody can expect to read a book with a new subject area and understand it all. There's much in Qt or even just in the QML part of it which you will never need or use. There's also much you don't need to know actively, for example you don't need to create grouped properties or attached properties right away, you just need to recognize them when you see them and use something which someone else has created.

                                It's important to learn meta-learning skills, i.e. learn to how to learn effectively. One part of it is knowing what to not learn at the moment and just let some things be and go forward. Sometimes I read a book (not necessarily about programming) of which I understand maybe 10% or less. But when I read more and more I will understand those things which I didn't previously understood, and I wouldn't have understood them if I hadn't previously read that 90% which I didn't understand back then. Giving up isn't a bad thing if you know when and how to do it. Don't give up your greater goals, learn to give up some details if they hinder you from going forward.

                                Another important thing is that if you don't have a personal task it's more difficult to learn. Just going through some examples which someone has made up is tedious, at least for me. I need some short-term goal, for example a user interface which does something for me which I actually want or need. Then I can search for things which are actually relevant for me and I can integrate them into my own task. The feeling when you get something done for your own needs is much better than when going through made-up examples. Do you have something specific you want to do with QML?

                                tomyT 1 Reply Last reply
                                2
                                • E Eeli K

                                  @tomy This is going to be off-topic, but I thought maybe I could help in another way.

                                  Maybe the problem is not so much the book (which really is problematic in some ways) but your learning strategy. You seem to want to understand every detail when you see it. It's a good thing but can lead to situation where you get stuck with things which are actually irrelevant for you at the moment. You have said you need and want to learn QML. Why? For what do you need it? Do you want to learn to animate cool visual things? Or do you want to create a working and practical user interface for some application which you need? If it's the latter, you don't need animations at all and can read the animation part of the book with a cursory glance. Nobody can expect to read a book with a new subject area and understand it all. There's much in Qt or even just in the QML part of it which you will never need or use. There's also much you don't need to know actively, for example you don't need to create grouped properties or attached properties right away, you just need to recognize them when you see them and use something which someone else has created.

                                  It's important to learn meta-learning skills, i.e. learn to how to learn effectively. One part of it is knowing what to not learn at the moment and just let some things be and go forward. Sometimes I read a book (not necessarily about programming) of which I understand maybe 10% or less. But when I read more and more I will understand those things which I didn't previously understood, and I wouldn't have understood them if I hadn't previously read that 90% which I didn't understand back then. Giving up isn't a bad thing if you know when and how to do it. Don't give up your greater goals, learn to give up some details if they hinder you from going forward.

                                  Another important thing is that if you don't have a personal task it's more difficult to learn. Just going through some examples which someone has made up is tedious, at least for me. I need some short-term goal, for example a user interface which does something for me which I actually want or need. Then I can search for things which are actually relevant for me and I can integrate them into my own task. The feeling when you get something done for your own needs is much better than when going through made-up examples. Do you have something specific you want to do with QML?

                                  tomyT Offline
                                  tomyT Offline
                                  tomy
                                  wrote on last edited by tomy
                                  #28

                                  @Eeli-K

                                  I appreciate your good talks. That's very kind of you.
                                  I will make them remained in my mind.

                                  1 Reply Last reply
                                  1
                                  • tomyT Offline
                                    tomyT Offline
                                    tomy
                                    wrote on last edited by tomy
                                    #29

                                    I want to express my understanding on the rest of the code.
                                    On the way, we reach the ListModel type. It's like a container. After that is AnimationController, which executes its body instructions. So it first clears the container and then adds a hundred floating point numbers (0.0, 0.01, 0.02, ..., 0.99) to the container (using append).

                                    The next executed type (according to the from-top-to-down order) is PathView. Its job is displaying the data (those 100 floating point numbers stored in the ListModel). So the actual draw/design/display of the curve is done by PathView). On delegate it defines how data should be displayed by creating 4x4 orangish rectangles. In fact, it wants to put 100 4x4 rectangles to display the cure. By Path, the type creates a horizontal line (0, 100 to 100, 100). And then it finishes.

                                    The Text type is used for allowing the type EasyingType to have a text property. The MouseArea is used on the component to receive clicks.

                                    What about this part please? Is what I've understood mentioned-above correct?

                                    E 1 Reply Last reply
                                    0
                                    • tomyT tomy

                                      I want to express my understanding on the rest of the code.
                                      On the way, we reach the ListModel type. It's like a container. After that is AnimationController, which executes its body instructions. So it first clears the container and then adds a hundred floating point numbers (0.0, 0.01, 0.02, ..., 0.99) to the container (using append).

                                      The next executed type (according to the from-top-to-down order) is PathView. Its job is displaying the data (those 100 floating point numbers stored in the ListModel). So the actual draw/design/display of the curve is done by PathView). On delegate it defines how data should be displayed by creating 4x4 orangish rectangles. In fact, it wants to put 100 4x4 rectangles to display the cure. By Path, the type creates a horizontal line (0, 100 to 100, 100). And then it finishes.

                                      The Text type is used for allowing the type EasyingType to have a text property. The MouseArea is used on the component to receive clicks.

                                      What about this part please? Is what I've understood mentioned-above correct?

                                      E Offline
                                      E Offline
                                      Eeli K
                                      wrote on last edited by
                                      #30

                                      @tomy I think you have understood the purpose of almost all parts correctly, although terminology isn't very clear. Here are some details which aren't crucial:

                                      Types aren't "executed", I'd rather say that objects of those types are created. As I have said earlier (at least I remember having said), the creation order isn't necessarily top-down in implementation, but it's enough for understanding the logic. On the other hand it may be important to understand that Component.onCompleted functions are executed only after the object tree has been created to some point so that objects and their properties can be used in those Component.onCompleted functions, and the order of executing different objects' Component.onCompleted functions is undefined (it's explicitly told in the documentation) and I actually have stumbled on this fact, so it may be important in some situations.

                                      You make one mistake: the last Text element isn't a property. It's just an object which is added to its parent's children list and is one visible object amongst the Image, Rectangle and PathView objects.

                                      tomyT 1 Reply Last reply
                                      2
                                      • E Eeli K

                                        @tomy I think you have understood the purpose of almost all parts correctly, although terminology isn't very clear. Here are some details which aren't crucial:

                                        Types aren't "executed", I'd rather say that objects of those types are created. As I have said earlier (at least I remember having said), the creation order isn't necessarily top-down in implementation, but it's enough for understanding the logic. On the other hand it may be important to understand that Component.onCompleted functions are executed only after the object tree has been created to some point so that objects and their properties can be used in those Component.onCompleted functions, and the order of executing different objects' Component.onCompleted functions is undefined (it's explicitly told in the documentation) and I actually have stumbled on this fact, so it may be important in some situations.

                                        You make one mistake: the last Text element isn't a property. It's just an object which is added to its parent's children list and is one visible object amongst the Image, Rectangle and PathView objects.

                                        tomyT Offline
                                        tomyT Offline
                                        tomy
                                        wrote on last edited by
                                        #31

                                        @Eeli-K

                                        the last Text element isn't a property. It's just an object which is added to its parent's children list and is one visible object amongst the Image, Rectangle and PathView objects.

                                        Hi,
                                        Yes, I meant that object is used for populating the alias property of the root making it capable of having a property with the name 'title' on its use on the other component.

                                        Would you please take another look at the AnimationControler?

                                        AnimationController {
                                                id: controller
                                                animation: anim
                                                Component.onCompleted: {
                                                    valueModel.clear()
                                                    for(var i=0; i<root.pointCount; i++) {
                                                        progress = i/root.pointCount
                                                        valueModel.append({value: root.value})
                                                    }
                                                }
                                            }
                                        

                                        In valueModel.append({value: root.value}), the progress values aren't used apparently! What is appended is a constant value, 0.0, which is the value of root!

                                        1 Reply Last reply
                                        0
                                        • tomyT Offline
                                          tomyT Offline
                                          tomy
                                          wrote on last edited by
                                          #32

                                          Still I can't create a good story based on what I comprehended from that component.

                                          E 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