Button實現邊界隱藏

import QtQuick 2.0
import QtQuick.Window 2.0
import QtQuick.Controls 1.3
import QtQuick.Controls.Styles 1.4
Window{
    title:"xuanfuanniu"
    width: 400
    height: 200
    x:400
    y:200
    color:"white"
    visible: true
    Button {
        id:rec
        property alias rec: rec
        width:rec.hovered?30:5
        height:80
        anchors.verticalCenter:parent.verticalCenter
        anchors.right:parent.right
       style:ButtonStyle{
            background: Rectangle{
                color:(control.pressed||control.hovered)?"green":"#11262B"
            }
}
        onClicked: {
            //rec.width=200
            console.log("the Button is Clicked!");
        }
    }
}

多按F1查看元素的屬性很重要!
發佈了41 篇原創文章 · 獲贊 14 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章