Cpper
C/C++高级工程师 Android高级软件工程师 IT集成工程师 音频工程师 熟悉c,c++,java,c#,py,js,asp等多种语言 程序猿
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Layouts 1.3
import QtQuick.Controls.Styles 1.4
import QtQuick.Dialogs 1.2

Rectangle 
{
    id
: container
    width: 640
    height: 360

    StackLayout {
        id: layout
        width: parent.width - 120
        height: 300

        anchors.top: parent.top
        anchors.topMargin: 6
        anchors.horizontalCenter: parent.horizontalCenter

        currentIndex: count - 1
        Rectangle {
            color: 'teal'
            implicitWidth: 200
            implicitHeight: 200
        
}
        Rectangle 
{
            color
: 'plum'
            implicitWidth: 300
            implicitHeight: 200
        
}
        Rectangle 
{
            color
: 'red'
            implicitWidth: 300
            implicitHeight: 200
        
}
        Rectangle 
{
            color
: 'blue'
            implicitWidth: 300
            implicitHeight: 200
        
}
        Rectangle 
{
            color
: 'green'
            implicitWidth: 300
            implicitHeight: 200
        
}
    }

    Button 
{
        anchors.horizontalCenter
: parent.horizontalCenter
        anchors.top: layout.bottom
        anchors.topMargin: 6
        text: "Prev"

        onClicked:{
            if(layout.currentIndex == 0)
                layout.currentIndex = layout.count-1
            else {
                layout.currentIndex --
            
}
        }
    }
}
posted on 2019-09-11 14:02 ccsdu2009 阅读(171) 评论(0)  编辑 收藏 引用 所属分类: QT编程

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理