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. QML NumberAnimation
QtWS25 Last Chance

QML NumberAnimation

Scheduled Pinned Locked Moved Solved QML and Qt Quick
numberanimation
3 Posts 3 Posters 980 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
    Taz742
    wrote on 18 Feb 2017, 13:18 last edited by A Former User
    #1
    Item 
    {
        id: item
        width: parent.width
        height: parent.height
        
        Rectangle 
        {
            id: rectangle
            color: "red"
            width: 7
            height: 30 
        }
        NumberAnimation
        {
            target: rectangle;
            property: "x";
            from: 0;
            to: item.width;
            duration: 3500;
            easing.type:
                Easing.CosineCurve;
            loops: Animation.Infinite
        }
    }
    

    Inside NumberAnimation why is item.width zero?

    Edit: Formatting -- @Wieland

    Do what you want.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dheerendra
      Qt Champions 2022
      wrote on 18 Feb 2017, 13:30 last edited by dheerendra
      #2

      For item you specifying the parent.width. What is parent here ? Looks like there is not parent for your Item object. Hence item.width is zero. Specify some width & height for your top level object(Item). It should fix by itself.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      5
      • ? Offline
        ? Offline
        A Former User
        wrote on 18 Feb 2017, 13:53 last edited by A Former User
        #3

        As a side note, replace...

        width: parent.width
        height: parent.height
        

        with...

        anchors.fill: parent
        

        to increase performance.

        1 Reply Last reply
        4

        3/3

        18 Feb 2017, 13:53

        • Login

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