1、新建CPbutton的状态的显示。
显示效果如下:
import QtQuick 2.15
import DigitalCluster 1.0
Item {
id:cpbutton
width:120
height:50
property alias mouseArea:mouseArea //鼠标
property alias labelText:buttonLabel.text //文本文字
property alias buttonState:buttonbg.state //按钮状态
property alias iconSource:buttonIcon.source //图标资源
state:"off"
CPbuttonBg{
id:buttonbg
anchors.fill: parent
}
Item{
id:buttonContent
opacity:0.5
anchors.fill: parent
Image{
id:buttonIcon
visible:cpbutton.labelText === "" ? true : false
source:""
cache:false
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}