QtQuick control2.0 样式定制

ApplicationWindow {
    id:root
    visible: true;
    height: 480;
    width: 320;

    property color  accentcol:"red"
    property color  backgroundcol:"white"
    property color  foregroundcol:"white"
    property color  primarycol:"red"
    Material.accent:accentcol
    Material.background:backgroundcol
    Material.foreground:foregroundcol
      Material.primary: primarycol

    ColorDialog{

        title: "sel"
        property string colortype: "accent"
        id:col;
       showAlphaChannel:true;
        onAccepted: {
             console.log(color);
              if(colortype=="accent")
              {
                    accentcol=color;
              }else if(colortype=="background")
              {
                    backgroundcol=color;
              }else if(colortype=="foreground")
              {
                    foregroundcol=color;
              }else if(colortype=="primary")
              {
                  primarycol=color;

              }

        }

    }

    SwipeView{

        id:sv;
        anchors.fill: parent;
        currentIndex: footertabBar.currentIndex
        Page{
//            wheelEnabled: true
            Flickable{
                width: parent.width
                height: parent.height
                contentHeight:cols.height+20;



            Column{

                id:cols;
                spacing: 1;
                Label{
                    text:"第一页"
                }
                CheckBox{
                    id:check;
                    text:"全局";
                     onClicked: {

                     }

                }

                Button{
                    text:"accent";
                    highlighted: true
                    onClicked: {
                        col.colortype=text;
                        col.open();
                    }
                }
                Rectangle{
                    border.width: 2;
                    border.color: "#ffffff"
                    width: 20;
                    height: 20;
                    color: accentcol
                }

                Button{
                    text:"background";
                    onClicked: {
                        col.colortype=text;
                        col.open();
                    }
                }
                Rectangle{
                    border.width: 2;
                    border.color: "#ffffff"
                    width: 20;
                    height: 20;
                    color: backgroundcol
                }
                Button{
                    text:"foreground";
                    onClicked: {
                        col.colortype=text;
                        col.open();
                    }
                }
                Rectangle{
                    border.width: 2;
                    border.color: "#ffffff"
                    width: 20;
                    height: 20;
                    color: foregroundcol
                }
                Button{
                    text:"primary";
                    onClicked: {
                        col.colortype=text;
                        col.open();
                    }
                }
                Rectangle{
                    border.width: 2;
                    border.color: "#ffffff"
                    width: 20;
                    height: 20;
                    color: primarycol
                }
                Slider{
                    width: parent.width
                    from:0;
                    to:100


                }
                CheckBox{

                    text:"CheckBox"
                }
                Text{
                    text:"Text"
                }
                TextArea{
                     text:"Text"
                }
                ProgressBar{
                    from:0;
                    to:100
                }

            }
        }

        }

        Page{
            id:page2
            Label {

                text:"第二页"
            }
            Slider{
                from:0;
                to:100
                anchors.centerIn: parent
            }
        }
    }

    footer: TabBar {
        id: footertabBar
        currentIndex: sv.currentIndex
        TabButton {

            text: qsTr("footer Tab1");
        }
        TabButton {
            text: qsTr("footer Tab2")
        }
        TabButton {
            text: qsTr("footer Tab3")
        }
    }
}

这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值