import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.5
Window {
width: 640
height: 480
color: "white"
title: qsTr("My QML")
visible: true
Button{
id:btn
width: 50
height: 50
//不点击看不见
// flat:true
//默认深色点击变浅色
// highlighted: true
//点击变色 在深色点击变浅色 在浅色点击变深色
checkable: false
onCheckableChanged: {
console.log("changed",checkable)
}
onClicked: {
//在checked置为true时checkable强制置为true
btn.checked = !btn.checked
}
}
}
QML-Button
最新推荐文章于 2024-06-15 11:46:27 发布