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. [solved]How to animate "width" property of ListView Item ?
Forum Updated to NodeBB v4.3 + New Features

[solved]How to animate "width" property of ListView Item ?

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 886 Views 1 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.
  • p3c0P Offline
    p3c0P Offline
    p3c0
    Moderators
    wrote on last edited by
    #1

    I have following code which is supposed to animate the "width" property of the Item which is being added to a ListView. But it doesn't work. However if i replace the "width" property with "x" or "opacity" it works.
    Following is the code :

    @ListView {
    anchors.fill: parent
    spacing: 10
    model: listmodel
    delegate: mydelegate
    add: Transition {
    PropertyAnimation { property: "width"; from:0; to: 780; duration: 500 }
    }
    ListModel { id: listmodel }
    }

    Component {
    id: mydelegate
    Item {
    width: 780;
    height: 40;
    Rectangle {
    width: 780
    height: 40
    color: "#FAFAFA"; radius: 5
    Text {
    text: mytext
    }
    }
    }
    }@

    So is this the right way to animate the ListView item ? Please help.

    157

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Got the above code working. Setting the width of Rectangle to parent.width made it work. Posting here just in case if some one comes under simliar situation.
      @Component {
      id: mydelegate
      Item {
      width: 780;
      height: 40;
      Rectangle {
      width: parent.width
      height: 40
      color: "#FAFAFA"; radius: 5
      Text {
      text: mytext
      }
      }
      }
      }@

      157

      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