Add HCircleProgressBar
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#include <QQmlComponent>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "../submodules/RadialBarDemo/radialbar.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "clipboard.h"
|
||||
|
||||
@@ -28,6 +30,8 @@ int main(int argc, char *argv[]) {
|
||||
objectContext->setContextProperty("CppUtils", new Utils());
|
||||
objectContext->setContextProperty("Clipboard", new Clipboard());
|
||||
|
||||
qmlRegisterType<RadialBar>("RadialBar", 1, 0, "RadialBar");
|
||||
|
||||
QFileInfo qrcPath(":src/qml/Window.qml");
|
||||
|
||||
QQmlComponent component(
|
||||
|
48
src/qml/Base/HCircleProgressBar.qml
Normal file
48
src/qml/Base/HCircleProgressBar.qml
Normal file
@@ -0,0 +1,48 @@
|
||||
import QtQuick 2.12
|
||||
import RadialBar 1.0
|
||||
|
||||
RadialBar {
|
||||
id: bar
|
||||
foregroundColor: theme.controls.circleProgressBar.background
|
||||
progressColor: theme.controls.circleProgressBar.foreground
|
||||
dialWidth: theme.controls.circleProgressBar.thickness
|
||||
startAngle: 0
|
||||
spanAngle: 360
|
||||
|
||||
from: 0
|
||||
to: 100
|
||||
value: 0
|
||||
|
||||
showText: true
|
||||
suffixText: qsTr("%")
|
||||
textFont.pixelSize: theme.fontSize.big
|
||||
textColor: theme.controls.circleProgressBar.text
|
||||
|
||||
|
||||
property alias from: bar.minValue
|
||||
property alias to: bar.maxValue
|
||||
property bool indeterminate: false
|
||||
|
||||
|
||||
Binding {
|
||||
target: bar;
|
||||
property: "value";
|
||||
value: bar.to * theme.controls.circleProgressBar.indeterminateSpan
|
||||
when: bar.indeterminate
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: bar
|
||||
property: "showText"
|
||||
value: false
|
||||
when: bar.indeterminate
|
||||
}
|
||||
|
||||
RotationAnimator on rotation {
|
||||
running: bar.indeterminate
|
||||
from: 0
|
||||
to: 360
|
||||
loops: Animation.Infinite
|
||||
duration: theme ? (theme.animationDuration * 6) : 600
|
||||
}
|
||||
}
|
@@ -176,6 +176,13 @@ controls:
|
||||
color background: colors.inputBackground
|
||||
color foreground: colors.accentBackground
|
||||
|
||||
circleProgressBar:
|
||||
int thickness: Math.max(2, spacing / 2)
|
||||
color background: colors.inputBackground
|
||||
color foreground: colors.accentBackground
|
||||
color text: colors.text
|
||||
real indeterminateSpan: 0.2 // 0-1
|
||||
|
||||
slider:
|
||||
int radius: 2
|
||||
int height: controls.progressBar.height
|
||||
|
Reference in New Issue
Block a user