aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/labs/stylekit/CMakeLists.txt1
-rw-r--r--src/labs/stylekit/ProgressBar.qml108
-rw-r--r--src/labs/stylekit/impl/BackgroundAndIndicatorDelegate.qml2
-rw-r--r--src/labs/stylekit/impl/FallbackStyle.qml5
-rw-r--r--src/labs/stylekit/qqstylekitcontrols.cpp1
-rw-r--r--src/labs/stylekit/qqstylekitcontrols_p.h3
-rw-r--r--src/labs/stylekit/qqstylekitreader_p.h1
7 files changed, 120 insertions, 1 deletions
diff --git a/src/labs/stylekit/CMakeLists.txt b/src/labs/stylekit/CMakeLists.txt
index 9133e76648..9597beb275 100644
--- a/src/labs/stylekit/CMakeLists.txt
+++ b/src/labs/stylekit/CMakeLists.txt
@@ -37,6 +37,7 @@ qt_internal_add_qml_module(QtQuickStyleKit
ComboBox.qml
Frame.qml
ItemDelegate.qml
+ ProgressBar.qml
RadioButton.qml
RangeSlider.qml
Slider.qml
diff --git a/src/labs/stylekit/ProgressBar.qml b/src/labs/stylekit/ProgressBar.qml
new file mode 100644
index 0000000000..ebb6868b0f
--- /dev/null
+++ b/src/labs/stylekit/ProgressBar.qml
@@ -0,0 +1,108 @@
+// Copyright (C) 2025 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:significant reason:default
+
+import QtQuick
+import QtQuick.Templates as T
+import Qt.labs.StyleKit
+import Qt.labs.StyleKit.impl
+
+T.ProgressBar {
+ id: control
+
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
+
+ leftPadding: styleReader.leftPadding
+ topPadding: styleReader.topPadding
+ rightPadding: styleReader.rightPadding
+ bottomPadding: styleReader.bottomPadding
+ spacing: styleReader.spacing
+
+ StyleKitControl.controlType: styleReader.type
+ StyleKitReader {
+ id: styleReader
+ type: StyleKitReader.ProgressBar
+ enabled: control.enabled
+ focused: control.activeFocus
+ hovered: control.hovered
+ palette: control.palette
+ }
+
+ contentItem: IndicatorDelegate {
+ parentControl: control
+ indicatorProperties: styleReader.indicator
+ secondProgress: control.visualPosition
+
+ Connections {
+ target: control
+ function onIndeterminateChanged() {
+ if (indeterminate) {
+ control.contentItem.firstProgress = 0
+ control.contentItem.secondProgress = 0
+ control.contentItem.indeterminateAnim.restart()
+ } else {
+ control.contentItem.indeterminateAnim.stop()
+ control.contentItem.firstProgress = 0
+ control.contentItem.secondProgress = Qt.binding(()=>{ return control.visualPosition })
+ }
+ }
+ }
+
+ Behavior on firstProgress {
+ enabled: !control.indeterminate && !control.contentItem.indeterminateAnim.running
+ NumberAnimation {
+ duration: 100
+ easing.type: Easing.Linear
+ }
+ }
+
+ Behavior on secondProgress {
+ enabled: !control.indeterminate && !control.contentItem.indeterminateAnim.running
+ NumberAnimation {
+ duration: 100
+ easing.type: Easing.Linear
+ }
+ }
+
+ property Animation indeterminateAnim: SequentialAnimation {
+ running: control.indeterminate
+ loops: Animation.Infinite
+ NumberAnimation {
+ target: control.contentItem
+ property: "secondProgress"
+ to: 1
+ duration: 300
+ easing.type: Easing.Linear
+ }
+ NumberAnimation {
+ target: control.contentItem
+ property: "firstProgress"
+ to: 0.95
+ duration: 600
+ easing.type: Easing.OutExpo
+ }
+ NumberAnimation {
+ target: control.contentItem
+ property: "firstProgress"
+ to: 0
+ duration: 300
+ easing.type: Easing.Linear
+ }
+ NumberAnimation {
+ target: control.contentItem
+ property: "secondProgress"
+ to: 0.05
+ duration: 600
+ easing.type: Easing.OutExpo
+ }
+ }
+ }
+
+ background: BackgroundDelegate {
+ parentControl: control
+ backgroundProperties: styleReader.background
+ }
+}
diff --git a/src/labs/stylekit/impl/BackgroundAndIndicatorDelegate.qml b/src/labs/stylekit/impl/BackgroundAndIndicatorDelegate.qml
index 4e9f5d81e3..703b791a01 100644
--- a/src/labs/stylekit/impl/BackgroundAndIndicatorDelegate.qml
+++ b/src/labs/stylekit/impl/BackgroundAndIndicatorDelegate.qml
@@ -82,7 +82,7 @@ Item {
id: indicator
parentControl: root.parentControl
indicatorProperties: root.indicatorProperties
- vertical: parentControl.vertical
+ vertical: root.vertical
z: 1
x: !vertical ? indicatorItem.x : parentControl.leftPadding + (parentControl.availableWidth - height) / 2
y: !vertical ? indicatorItem.y : parentControl.topPadding + width
diff --git a/src/labs/stylekit/impl/FallbackStyle.qml b/src/labs/stylekit/impl/FallbackStyle.qml
index 276f31b1fa..3b434aa808 100644
--- a/src/labs/stylekit/impl/FallbackStyle.qml
+++ b/src/labs/stylekit/impl/FallbackStyle.qml
@@ -198,6 +198,11 @@ BaseStyle {
}
}
+ progressBar {
+ background.visible: false
+ indicator.implicitWidth: 150
+ }
+
slider {
background {
visible: false
diff --git a/src/labs/stylekit/qqstylekitcontrols.cpp b/src/labs/stylekit/qqstylekitcontrols.cpp
index a1bb01e33f..a74e69731b 100644
--- a/src/labs/stylekit/qqstylekitcontrols.cpp
+++ b/src/labs/stylekit/qqstylekitcontrols.cpp
@@ -70,6 +70,7 @@ IMPLEMENT_ACCESSORS(button, QQStyleKitReader::ControlType::Button)
IMPLEMENT_ACCESSORS(flatButton, QQStyleKitReader::ControlType::FlatButton)
IMPLEMENT_ACCESSORS(checkBox, QQStyleKitReader::ControlType::CheckBox)
IMPLEMENT_ACCESSORS(comboBox, QQStyleKitReader::ControlType::ComboBox)
+IMPLEMENT_ACCESSORS(progressBar, QQStyleKitReader::ControlType::ProgressBar)
IMPLEMENT_ACCESSORS(slider, QQStyleKitReader::ControlType::Slider)
IMPLEMENT_ACCESSORS(spinBox, QQStyleKitReader::ControlType::SpinBox)
IMPLEMENT_ACCESSORS(switchControl, QQStyleKitReader::ControlType::SwitchControl)
diff --git a/src/labs/stylekit/qqstylekitcontrols_p.h b/src/labs/stylekit/qqstylekitcontrols_p.h
index 3bb008d255..6311a4cfd2 100644
--- a/src/labs/stylekit/qqstylekitcontrols_p.h
+++ b/src/labs/stylekit/qqstylekitcontrols_p.h
@@ -37,6 +37,7 @@ class QQStyleKitControls : public QObject, public QQmlParserStatus
Q_PROPERTY(QQStyleKitControl *checkBox READ checkBox WRITE set_checkBox NOTIFY checkBoxChanged FINAL)
Q_PROPERTY(QQStyleKitControl *comboBox READ comboBox WRITE set_comboBox NOTIFY comboBoxChanged FINAL)
Q_PROPERTY(QQStyleKitControl *flatButton READ flatButton WRITE set_flatButton NOTIFY flatButtonChanged FINAL)
+ Q_PROPERTY(QQStyleKitControl *progressBar READ progressBar WRITE set_progressBar NOTIFY progressBarChanged FINAL)
Q_PROPERTY(QQStyleKitControl *slider READ slider WRITE set_slider NOTIFY sliderChanged FINAL)
Q_PROPERTY(QQStyleKitControl *spinBox READ spinBox WRITE set_spinBox NOTIFY spinBoxChanged FINAL)
Q_PROPERTY(QQStyleKitControl *tabBar READ tabBar WRITE set_tabBar NOTIFY tabBarChanged FINAL)
@@ -74,6 +75,7 @@ public:
IMPLEMENT_ACCESSORS(checkBox)
IMPLEMENT_ACCESSORS(comboBox)
IMPLEMENT_ACCESSORS(flatButton)
+ IMPLEMENT_ACCESSORS(progressBar)
IMPLEMENT_ACCESSORS(slider)
IMPLEMENT_ACCESSORS(spinBox)
IMPLEMENT_ACCESSORS(tabBar)
@@ -110,6 +112,7 @@ signals:
void checkBoxChanged();
void comboBoxChanged();
void flatButtonChanged();
+ void progressBarChanged();
void sliderChanged();
void spinBoxChanged();
void tabBarChanged();
diff --git a/src/labs/stylekit/qqstylekitreader_p.h b/src/labs/stylekit/qqstylekitreader_p.h
index 8896989ad8..14c7264d36 100644
--- a/src/labs/stylekit/qqstylekitreader_p.h
+++ b/src/labs/stylekit/qqstylekitreader_p.h
@@ -55,6 +55,7 @@ public:
CheckBox,
ComboBox,
FlatButton,
+ ProgressBar,
Slider,
SpinBox,
SwitchControl,