MultiplayerDemo
import QtQuick 2.0
Rectangle {
id: timeView
width: text.width+ paddingHorizontal*2
height: text.height+ paddingVertical*2
radius: 4
color: "pink"
property int paddingHorizontal: 10
property int paddingVertical: 2
property alias textOverride: text.text
property double remainingTime: 0
Text {
id: text
anchors.centerIn: parent
anchors.verticalCenterOffset: 1
font.pixelSize: 14
color: "black"
}
onRemainingTimeChanged: {
var formatAsTime = function (numericTime) {
var sec_num = parseInt(numericTime, 10);
var minutes = Math.floor(sec_num / 60);
var seconds = sec_num - (minutes * 60);
if (minutes < 10) {minutes = "0"+minutes;}
if (seconds < 10) {seconds = "0"+seconds;}
var time = minutes + ':' + seconds;
return time;
}