From 6bcf8f9e163d3433e8aa05c3f9631e8c9d82dbdb Mon Sep 17 00:00:00 2001 From: Mentalflow <312902918@qq.com> Date: Thu, 22 May 2025 16:22:09 +0800 Subject: [PATCH] RibbonBusyRing: Add reverseColor property. --- lib_source/qml/Qt5/RibbonBusyRing.qml | 7 ++++++- lib_source/qml/Qt6/RibbonBusyRing.qml | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib_source/qml/Qt5/RibbonBusyRing.qml b/lib_source/qml/Qt5/RibbonBusyRing.qml index 1b72504..33b8039 100644 --- a/lib_source/qml/Qt5/RibbonBusyRing.qml +++ b/lib_source/qml/Qt5/RibbonBusyRing.qml @@ -18,6 +18,7 @@ BusyIndicator { property real default_saturation: 0 property int animationDuration: RibbonTheme.modernStyle ? 4000 : 1000 property bool clockwise: true + property bool reverseColor: false onAnimationDurationChanged: { running = !running @@ -52,7 +53,11 @@ BusyIndicator { width: radiusWidth height: ringWidth property real item_saturation: (index + item.dynamic_index) % lineNumber * private_property.saturation + default_saturation - color: Qt.hsla(0, 0, RibbonTheme.modernStyle ? RibbonTheme.isDarkMode ? 1 : 0 : item_saturation, 1) + color: Qt.hsla(0, 0, + RibbonTheme.modernStyle ? + (control.reverseColor ? (RibbonTheme.isDarkMode ? 0 : 1) : (RibbonTheme.isDarkMode ? 1 : 0)) : + (control.reverseColor ? 1 - item_saturation : item_saturation), + 1) rotation: index * private_property.angle x: (parent.width / 2) - (radiusLength - ringWidth) * Math.sin(rotation/180 * Math.PI) y: (parent.height / 2 - height / 2) + (radiusLength - ringWidth) * Math.cos(rotation/180 * Math.PI) diff --git a/lib_source/qml/Qt6/RibbonBusyRing.qml b/lib_source/qml/Qt6/RibbonBusyRing.qml index 3f33b32..9df3f56 100644 --- a/lib_source/qml/Qt6/RibbonBusyRing.qml +++ b/lib_source/qml/Qt6/RibbonBusyRing.qml @@ -18,6 +18,7 @@ BusyIndicator { property real default_saturation: 0 property int animationDuration: RibbonTheme.modernStyle ? 4000 : 1000 property bool clockwise: true + property bool reverseColor: false onAnimationDurationChanged: { running = !running @@ -52,7 +53,11 @@ BusyIndicator { width: radiusWidth height: ringWidth property real item_saturation: (index + item.dynamic_index) % lineNumber * private_property.saturation + default_saturation - color: Qt.hsla(0, 0, RibbonTheme.modernStyle ? RibbonTheme.isDarkMode ? 1 : 0 : item_saturation, 1) + color: Qt.hsla(0, 0, + RibbonTheme.modernStyle ? + (control.reverseColor ? (RibbonTheme.isDarkMode ? 0 : 1) : (RibbonTheme.isDarkMode ? 1 : 0)) : + (control.reverseColor ? 1 - item_saturation : item_saturation), + 1) rotation: index * private_property.angle x: (parent.width / 2) - (radiusLength - ringWidth) * Math.sin(rotation/180 * Math.PI) y: (parent.height / 2 - height / 2) + (radiusLength - ringWidth) * Math.cos(rotation/180 * Math.PI)