From e2cefb611444eef971939f1e137cd40bf1a3c178 Mon Sep 17 00:00:00 2001 From: zhuzihcu Date: Thu, 9 Mar 2023 16:44:24 +0800 Subject: [PATCH] update --- example/AboutPage.qml | 2 +- example/MainPage.qml | 2 +- example/T_Slider.qml | 6 ++++ src/controls/FluButton.qml | 4 +-- src/controls/FluFilledButton.qml | 4 +-- src/controls/FluProgressBar.qml | 4 +-- src/controls/FluProgressRing.qml | 8 ++--- src/controls/FluSlider.qml | 60 +++++++++++++++++++++----------- 8 files changed, 58 insertions(+), 32 deletions(-) diff --git a/example/AboutPage.qml b/example/AboutPage.qml index 3f6f2c0..62e4045 100644 --- a/example/AboutPage.qml +++ b/example/AboutPage.qml @@ -34,7 +34,7 @@ FluWindow { fontStyle: FluText.Title } FluText{ - text:"v1.0.1" + text:"v1.0.2" fontStyle: FluText.Body Layout.alignment: Qt.AlignBottom } diff --git a/example/MainPage.qml b/example/MainPage.qml index 6f89eed..a9b65da 100644 --- a/example/MainPage.qml +++ b/example/MainPage.qml @@ -91,7 +91,7 @@ FluWindow { FluMenuItem{ text:"意见反馈" onClicked:{ - showInfo("正在建设中...") + Qt.openUrlExternally("https://github.com/zhuzichu520/FluentUI/issues/new") } } FluMenuItem{ diff --git a/example/T_Slider.qml b/example/T_Slider.qml index 2f2b692..1fedbc0 100644 --- a/example/T_Slider.qml +++ b/example/T_Slider.qml @@ -26,6 +26,12 @@ Item { Layout.leftMargin: 15 value: 50 } + FluSlider{ + orientation:FluSlider.Vertical + Layout.topMargin: 20 + Layout.leftMargin: 15 + value: 50 + } } } } diff --git a/src/controls/FluButton.qml b/src/controls/FluButton.qml index 41b82c4..cfbf82f 100644 --- a/src/controls/FluButton.qml +++ b/src/controls/FluButton.qml @@ -7,8 +7,8 @@ Rectangle { property string text: "Standard Button" property int startPadding : 15 property int endPadding : 15 - property int topPadding: 8 - property int bottomPadding: 8 + property int topPadding: 5 + property int bottomPadding: 5 property bool disabled: false property color primaryColor : "#0064B0" signal clicked diff --git a/src/controls/FluFilledButton.qml b/src/controls/FluFilledButton.qml index 729c624..c3f07be 100644 --- a/src/controls/FluFilledButton.qml +++ b/src/controls/FluFilledButton.qml @@ -8,8 +8,8 @@ Rectangle { property string text: "Filled Button" property int startPadding : 15 property int endPadding : 15 - property int topPadding: 8 - property int bottomPadding: 8 + property int topPadding: 5 + property int bottomPadding: 5 property bool disabled: false signal clicked diff --git a/src/controls/FluProgressBar.qml b/src/controls/FluProgressBar.qml index cef6c30..20bb624 100644 --- a/src/controls/FluProgressBar.qml +++ b/src/controls/FluProgressBar.qml @@ -4,8 +4,8 @@ import QtQuick.Controls 2.12 FluRectangle { id: control - width: 180 - height: 6 + width: 150 + height: 5 radius: [3,3,3,3] clip: true color: FluTheme.isDark ? Qt.rgba(41/255,41/255,41/255,1) : Qt.rgba(214/255,214/255,214/255,1) diff --git a/src/controls/FluProgressRing.qml b/src/controls/FluProgressRing.qml index 2f18a84..f6bf84f 100644 --- a/src/controls/FluProgressRing.qml +++ b/src/controls/FluProgressRing.qml @@ -4,13 +4,13 @@ import QtQuick.Controls 2.12 Rectangle { id: control - width: 60 - height: 60 - radius: 30 + width: 44 + height: 44 + radius: 22 border.width: linWidth color: "#00000000" border.color: FluTheme.isDark ? Qt.rgba(41/255,41/255,41/255,1) : Qt.rgba(214/255,214/255,214/255,1) - property real linWidth : 6 + property real linWidth : 5 property real progress: 0.25 property bool indeterminate: true readonly property real radius2 : radius - linWidth/2 diff --git a/src/controls/FluSlider.qml b/src/controls/FluSlider.qml index fb34c45..b9a3799 100644 --- a/src/controls/FluSlider.qml +++ b/src/controls/FluSlider.qml @@ -6,23 +6,40 @@ Item{ id:root - property int lineWidth: 6 - property int dotSize: 30 + property int lineWidth: 5 + property int dotSize: 26 property int value: 50 + enum Orientation { + Horizontal, + Vertical + } + + height: control.height + width: control.width + + property int orientation: FluSlider.Horizontal + + property bool isHorizontal: orientation === FluSlider.Horizontal + Component.onCompleted: { - dot.x =value/100*control.width - dotSize/2 - root.value = Qt.binding(function(){ - return (dot.x+15)/control.width*100 - }) + if(isHorizontal){ + dot.x =value/100*control.width - dotSize/2 + root.value = Qt.binding(function(){ + return (dot.x+dotSize/2)/control.width*100 + }) + }else{ + dot.y =value/100*control.height - dotSize/2 + root.value = Qt.binding(function(){ + return (dot.y+dotSize/2)/control.height*100 + }) + } } FluRectangle { - id: control - - width: 300 - height: root.lineWidth + width: isHorizontal ? 200 : root.lineWidth + height: isHorizontal ? root.lineWidth : 200 radius: [3,3,3,3] clip: true anchors.verticalCenter: parent.verticalCenter @@ -30,8 +47,8 @@ Item{ Rectangle{ id:rect radius: 3 - width: control.width*(value/100) - height: control.height + width: isHorizontal ? control.width*(value/100) : control.width + height: isHorizontal ? control.height : control.height*(value/100) color:FluTheme.isDark ? FluTheme.primaryColor.lighter :FluTheme.primaryColor.dark } } @@ -40,11 +57,12 @@ Item{ id:dot width: dotSize height: dotSize - FluShadow{ - radius: 15 - } - radius: 15 - anchors.verticalCenter: parent.verticalCenter + FluShadow{ + radius: dotSize/2 + } + radius: dotSize/2 + anchors.verticalCenter: isHorizontal ? parent.verticalCenter : undefined + anchors.horizontalCenter: isHorizontal ? undefined :parent.horizontalCenter color:FluTheme.isDark ? Qt.rgba(69/255,69/255,69/255,1) :Qt.rgba(1,1,1,1) Rectangle{ width: dotSize/2 @@ -65,9 +83,11 @@ Item{ hoverEnabled: true drag { target: dot - axis: Drag.XAxis - minimumX: -dotSize/2 - maximumX: control.width - dotSize/2 + axis: isHorizontal ? Drag.XAxis : Drag.YAxis + minimumX: isHorizontal ? -dotSize/2 : 0 + maximumX: isHorizontal ? (control.width - dotSize/2) : 0 + minimumY: isHorizontal ? 0 : -dotSize/2 + maximumY: isHorizontal ? 0 : (control.height - dotSize/2) } onPressed: { tool_tip.visible = true