TimeoutIndicator.qml

File Metadata

Author
GB_2
Created
Apr 5 2019, 6:18 PM

TimeoutIndicator.qml

import QtQuick 2.0
import org.kde.plasma.core 2.0
Canvas {
property color highlightColor: theme.highlightColor
property var num: 0
NumberAnimation on num { to: 360; duration: 5000 }
onNumChanged: { requestPaint() }
anchors.fill: parent
onPaint: {
var ctx = getContext("2d");
ctx.reset();
var centerX = width / 2;
var centerY = height / 2;
ctx.beginPath();
ctx.fillStyle = highlightColor;
ctx.moveTo(centerX, centerY);
ctx.arc(centerX, centerY, units.iconSizes.tiny, toRadians(num), toRadians(360));
ctx.lineTo(centerX, centerY);
ctx.fill();
}
function toRadians(deg) {
return (deg - 90) * Math.PI / 180
}
}