Created
July 22, 2019 15:12
-
-
Save HamedMasafi/5da5a8a476d16811c64ce3792c9bc2bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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