import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12

Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    StackLayout {
        id: layout1
        anchors.fill: parent
        currentIndex: 0
        Rectangle {
            color: 'green'
            implicitWidth: 200
            implicitHeight: 200
            property var layout: layout1
            Button{
                anchors.top: parent.top
                width: 100
                height: 100
                onClicked: {
                    layout1.currentIndex = 1
                }
            }
        }
        Rectangle {
            color: 'plum'
            implicitWidth: 300
            implicitHeight: 200

            Button{
                anchors.top: parent.top
                width: 100
                height: 100
                onClicked: {
                    layout1.currentIndex = 0
                }
            }
        }
        property var layout: layout1
    }

}


相关文章:

  • 2022-12-23
  • 2021-05-31
  • 2021-09-09
  • 2021-10-29
  • 2021-07-15
  • 2022-12-23
  • 2022-01-29
猜你喜欢
  • 2021-08-05
  • 2022-12-23
  • 2021-11-06
  • 2021-09-01
  • 2022-02-13
  • 2022-12-23
  • 2021-04-25
相关资源
相似解决方案