StackViewTransition rotation on "y" axis (StackView + page flip)



  • I have a StackView that I use to display slides. When to set each slide, and what slide to set, must be commanded by C++ code, so I don't have a state machine, just a signal from C++ every time I need to set a new slide, and a slot in QML that runs a push() in the StackView.

    This is working fine, and I'm able to implement simple transitions when changing slides:

            StackView {
                id: loader
                anchors.fill: parent
    
                delegate: StackViewDelegate {
                    function transitionFinished(properties) {
                        properties.exitItem.x = 0
                    }
    
                    pushTransition: StackViewTransition {
                        PropertyAnimation {
                            target: enterItem
                            property: "x"
                            from: enterItem.width
                            to: 0
                            easing.type: Easing.OutExpo
                        }
    
                        PropertyAnimation {
                            target: exitItem
                            property: "x"
                            from: 0
                            to: -exitItem.width
                            easing.type: Easing.OutExpo
                        }
                    }
                }
            }
    

    But I'm stuck, for instance, trying to replace the displacement on "x" animation, with a rotation on the "y" axis, simulating a page flip.

    I've seen an example here, but I don't really understand how to apply that to a StackViewTransition, because that works between two states of a single component, rather than the replacement of a component with another.

    What would be the correct way to implement it a page flip on a StackView?


Log in to reply
 

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