继承关系
// NumberButton.qml
import QtQuick 2.9
import QtQuick.Controls 2.12
Button {
id: root
property int flashDuration: 100
property alias label: labelText.text
background: Rectangle {color: "transparent"}
contentItem: Text {
id: labelText
font.pixelSize: getWidth(37)
font.bold: true
font.family: "Arial"
color: "#00CE31"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors.centerIn: parent
}
Rectangle {
id: flashRect
anchors.fill: parent
color: "#00CE31"
visible: false // 初始隐藏
}
Timer {
id: flashTimer
interval: root.flashDuration;
running: false;
repeat: false
onTriggered: flashRect.visible = false
}
onClicked: {
flashRect.visible = true
flashTimer.start()
}
}
继承关系