QtMd/main.qml
2024-01-05 17:26:18 +08:00

44 lines
1.0 KiB
QML

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.15
Rectangle {
anchors.fill: parent
border.color: Material.accent
border.width: 1
Row {
anchors.centerIn: parent
spacing: 10
Button {
id: clickBtn
width: 100
text: "点击我"
flat: false
anchors.verticalCenter: parent.verticalCenter
onClicked: {
countText.text = (parseInt(countText.text) + 1).toString();
console.log("按钮被点击了, text:" + countText.text)
}
}
Rectangle {
width: 100
height: 32
anchors.verticalCenter: parent.verticalCenter
border.width: 1
border.color: Material.accent
Text {
id: countText
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("0")
}
}
}
}