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 animation not working
Forum Updated to NodeBB v4.3 + New Features

QML animation not working

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.5k 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.
  • D Offline
    D Offline
    daljit97
    wrote on last edited by
    #1

    Hello, I am trying to build a simple listview where if the delegate is clicked, its index is changed (-1). Now, I am using a Qml ListModel and its function move(), it works fine but I want to add animation when the position is changed. I am using the "Behavior on" function, but I don't understand why it is not working.
    @import QtQuick 1.1
    import com.nokia.symbian 1.1

    Page {
    id: page
    ListModel{
    id: listModel

        ListElement{
            name: "Red"
        }
        ListElement{
            name: "Green"
        }
        ListElement{
            name: "Blue"
        }
    }
    ListView{
        id: listView
        anchors.fill: parent
        interactive: false
        model: listModel
        spacing: 10        
        delegate: Rectangle{
            height: 50
            width: 360
            color: name
            MouseArea{
                anchors.fill: parent
                onClicked:listModel.move(index,index-1,1)
            }
            Behavior on y{
                NumberAnimation {}
            }
        }
    }
    

    }
    @

    1 Reply Last reply
    0
    • K Offline
      K Offline
      Kysymys
      wrote on last edited by
      #2

      To apply animations related to changes to the model, you should use the transition properties of the ListView.
      See "ListView.move":http://qt-project.org/doc/qt-5.1/qtquick/qml-qtquick2-listview.html

      \o/ \o/ Kudos ...

      Paholaisen Kysymys

      1 Reply Last reply
      0
      • D Offline
        D Offline
        daljit97
        wrote on last edited by
        #3

        [quote author="Kysymys" date="1387069766"]To apply animations related to changes to the model, you should use the transition properties of the ListView.
        See "ListView.move":http://qt-project.org/doc/qt-5.1/qtquick/qml-qtquick2-listview.html[/quote]
        That function is available only in Qt 5, I am using Qt 4.7.

        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