Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[Solved]Any example of StackView?



  • Qt5.2

    Studying StackView but have no idea how to use it.

    @
    import QtQuick 2.2
    import QtQuick.Controls 1.1

    Rectangle {
    id: root

    width: 360
    height: 360
    
    Column{
    
        Button{
            width: root.width
            height: root.height / 10
    
            onClicked: {
                stackView.push({item:Rectangle, properties: {width: root.width, height: root.height}})
            }
        }
    
        StackView {
            id: stackView
            delegate: StackViewDelegate {
                function transitionFinished(properties)
                {
                    properties.exitItem.opacity = 1
                }
    
                property Component pushTransition: StackViewTransition {
                    PropertyAnimation {
                        target: enterItem
                        property: "opacity"
                        from: 0
                        to: 1
                    }
                    PropertyAnimation {
                        target: exitItem
                        property: "opacity"
                        from: 1
                        to: 0
                    }
                }
            }
        }
    }
    

    }

    @

    Apparently, this wouldn't work
    After I click the button, it pop out the error message

    Error:Could not load: file///someaddress/[object Object]:-1 File not found

    How could I push the component into the StackView properly?



  • I find an example by myself

    "example":http://qt-project.org/doc/qt-5.1/qtquickcontrols/touch-main-qml.html

    If you know more examples of StackView, please show me, thanks.


Log in to reply