Here is the same sample that uses a function instead:
Rectangle {
width: 200
height: 50
Timer {
interval: 1000
running: true
repeat: true
onTriggered: setTime()
}
Text {
id: clock
anchors.centerIn: parent
}
function setTime() {
clock.text = Qt.formatTime(new Date())
}
}
↧