Skip to content

Instantly share code, notes, and snippets.

@HamedMasafi
Created July 22, 2019 15:12
Show Gist options
  • Save HamedMasafi/5da5a8a476d16811c64ce3792c9bc2bb to your computer and use it in GitHub Desktop.
Save HamedMasafi/5da5a8a476d16811c64ce3792c9bc2bb to your computer and use it in GitHub Desktop.
import QtQuick 2.12
import QtQuick.Window 2.12
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Text {
id: counter
property int value: 0
text: Math.floor(value / 60).toString()
+ ":"
+ ((value % 60) < 10 ? "0" : "")
+ (value % 60).toString()
}
NumberAnimation {
id: counterAnim
function begin(n) {
from = n
duration = n * 1000
start()
}
target: counter
property: "value"
to: 0
}
MouseArea{
anchors.fill: parent
onClicked: counterAnim.begin(70)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment