StackViewTransition not working.



  • I wrote my custom stackView transitions which are :

    • PopTransition
    • PushTransition

    if i push something into the stack the transition works fine, same applies to popping out somthing.


    Now my problem comes here:


    According to documentation, i should be able to use the replace method with the transition that i want.
    E.g :
    stack.replace(aboutComponent, StackView.PopTransition)

    Which is not working for me.



  • Please elaborate what "not working" means in practice, and provide a minimal test case that reproduces the problem you are experiencing. The following example, based on the example in the linked documentation, works fine with Qt 5.9.2 at least.

    import QtQuick 2.9
    import QtQuick.Controls 2.2
    
    ApplicationWindow {
        id: window
        width: 360
        height: 360
        visible: true
    
        StackView {
            id: stackView
            anchors.fill: parent
    
            pushExit: Transition { NumberAnimation { property: "scale"; from: 1.0; to: 0.0; duration: 100 } }
            pushEnter: Transition { NumberAnimation { property: "scale"; from: 0.0; to: 1.0; duration: 400 } }
    
            popExit: Transition { NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 100 } }
            popEnter: Transition { NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 400 } }
    
            initialItem: Component {
                id: page
    
                Page {
                    Column {
                        spacing: 20
                        anchors.centerIn: parent
    
                        Button {
                            text: "Replace\n(default)"
                            onClicked: stackView.replace(page)
                        }
                        Button {
                            text: "Replace\n(push/scale)"
                            onClicked: stackView.replace(page, StackView.PushTransition)
                        }
                        Button {
                            text: "Replace\n(pop/opacity)"
                            onClicked: stackView.replace(page, StackView.PopTransition)
                        }
                    }
                }
            }
        }
    }
    

Log in to reply
 

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