Slide animation with anchors problem



  • I don't know how to build a slide animation with an item that is anchored at the sliding direction.
    I get a "expand" like animation, not an item sliding from the bottom up and down.
    I would thank you for some hints.

    Here a code example

    Item {
        anchors.fill: parent
    
        Item {
            id: someItem1
            anchors.top : bottomItem.top // initial state is collapsed
            anchors.right : parent.right
            anchors.left : parent.left
            anchors.bottom : therapyBar.top
    
            //clipping needed for the animation. The dialog has to slide down without
            //disturbing the objects below.
            clip: true
            states: [
                State {
                    name: "collapsed"
                    AnchorChanges {
                        target: someItem1
                        anchors.top:bottomItem.top 
                       // what about the bottom anchor here? I would like to keep a fixed height so it slides down.
                    }
                },
                State {
                    name: "expanded"
                    AnchorChanges {
                        target: someItem1
                        anchors.top:parent.top
                    }
                }
            ]
        }
    
        Item {
            id:bottomItem
            anchors.bottom: parent.bottom
            anchors.left: parent.left
            anchors.right: parent.right
            height: 100
            }
    }
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.