Preserve transparency on StackView layers with QtQuick.Controls 2.5



  • I was able to achive preserving transparency of the layers with a hack:

    StackView {
            id: stack
            initialItem: myItem
            anchors.fill: parent
            pushEnter: Transition {
                PropertyAnimation {
                    property: "opacity"
                    from: 0
                    to:1
                    duration: 200
                }
            }
            pushExit: Transition {
                PropertyAnimation {
                    property: "opacity"
                    from: 1
                    to: 1
                    duration: 200000000                        ///here is the hack
                }
            }
    
            popEnter: Transition {
                PropertyAnimation {
                    property: "opacity"
                    from: 0
                    to:1
                    duration: 200
                }
            }
            popExit: Transition {
                PropertyAnimation {
                    property: "opacity"
                    from: 1
                    to:0
                    duration: 200
                }
            }
        }
    

    The problem is that once the Transition is done, it makes the underlying layer not visible, so by making the transition take a very large amount of time, I was able to hack my way in, but this is not so effective.

    I couldn't find something just to disable making the underlying layer not visible.

    Do you guys suggest any other component that can solve this? Or maybe a better hack?

    Thank you!



  • I think you can try to add: StackView.visible: true to your Item



  • Found the answer, needed to add "StackView.visible: true" inside Items loaded by stackView



  • @daljit97 Thank you, it worked ;)


 

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