From 243f8aa248326bb6db6becad16104b996af9f321 Mon Sep 17 00:00:00 2001 From: zhuzichu Date: Wed, 21 Jun 2023 11:47:05 +0800 Subject: [PATCH] update --- example/qml/component/CodeExpander.qml | 3 +- example/qml/page/T_Buttons.qml | 28 +++++----- example/qml/page/T_Expander.qml | 21 ++++---- example/qml/page/T_RadioButton.qml | 51 +++++++++++++++++++ .../FluentUI/Controls/FluDropDownButton.qml | 3 +- src/imports/FluentUI/Controls/FluExpander.qml | 3 +- src/imports/FluentUI/Controls/FluMenu.qml | 1 - .../FluentUI/Controls/FluNavigationView.qml | 23 +++------ src/imports/FluentUI/Controls/FluPivot.qml | 11 ++-- .../FluentUI/Controls/FluRadioButtons.qml | 30 +++++++++++ 10 files changed, 122 insertions(+), 52 deletions(-) create mode 100644 src/imports/FluentUI/Controls/FluRadioButtons.qml diff --git a/example/qml/component/CodeExpander.qml b/example/qml/component/CodeExpander.qml index 55ec9ed8..41ec8fd9 100644 --- a/example/qml/component/CodeExpander.qml +++ b/example/qml/component/CodeExpander.qml @@ -132,7 +132,8 @@ FluExpander{ "FluAcrylic", "FluRemoteLoader", "FluMenuBar", - "FluPagination" + "FluPagination", + "FluRadioButtons" ]; code = code.replace(/\n/g, "
"); code = code.replace(/ /g, " "); diff --git a/example/qml/page/T_Buttons.qml b/example/qml/page/T_Buttons.qml index 572a9b0d..9d00ab41 100644 --- a/example/qml/page/T_Buttons.qml +++ b/example/qml/page/T_Buttons.qml @@ -221,6 +221,9 @@ FluScrollablePage{ } FluMenuItem{ text:"Menu_4" + onClicked: { + console.debug(parent.height) + } } } FluToggleSwitch{ @@ -259,24 +262,23 @@ FluScrollablePage{ height: 100 paddings: 10 Layout.topMargin: 20 - ColumnLayout{ + FluRadioButtons{ spacing: 8 anchors{ verticalCenter: parent.verticalCenter left: parent.left } - Repeater{ - id:repeater - property int selecIndex : 0 - model: 3 - delegate: FluRadioButton{ - checked : repeater.selecIndex===index - disabled:radio_button_switch.checked - text:"Radio Button_"+index - clickListener:function(){ - repeater.selecIndex = index - } - } + FluRadioButton{ + disabled:radio_button_switch.checked + text:"Radio Button_1" + } + FluRadioButton{ + disabled:radio_button_switch.checked + text:"Radio Button_2" + } + FluRadioButton{ + disabled:radio_button_switch.checked + text:"Radio Button_3" } } FluToggleSwitch{ diff --git a/example/qml/page/T_Expander.qml b/example/qml/page/T_Expander.qml index d31b00a5..36f390e3 100644 --- a/example/qml/page/T_Expander.qml +++ b/example/qml/page/T_Expander.qml @@ -27,7 +27,7 @@ FluScrollablePage{ Layout.topMargin: 20 Item{ anchors.fill: parent - ColumnLayout{ + FluRadioButtons{ spacing: 8 anchors{ top: parent.top @@ -35,17 +35,14 @@ FluScrollablePage{ topMargin: 15 leftMargin: 15 } - Repeater{ - id:repeater - property int selecIndex : 0 - model: 3 - delegate: FluRadioButton{ - checked : repeater.selecIndex===index - text:"Radio Button_"+index - clickListener:function() { - repeater.selecIndex = index - } - } + FluRadioButton{ + text:"Radio Button_1" + } + FluRadioButton{ + text:"Radio Button_2" + } + FluRadioButton{ + text:"Radio Button_3" } } } diff --git a/example/qml/page/T_RadioButton.qml b/example/qml/page/T_RadioButton.qml index 9bf18ceb..07b383b7 100644 --- a/example/qml/page/T_RadioButton.qml +++ b/example/qml/page/T_RadioButton.qml @@ -47,4 +47,55 @@ FluScrollablePage{ }' } + FluArea{ + Layout.fillWidth: true + height: 100 + paddings: 10 + Layout.topMargin: 20 + FluRadioButtons{ + spacing: 8 + anchors.verticalCenter: parent.verticalCenter + anchors{ + verticalCenter: parent.verticalCenter + left: parent.left + } + FluRadioButton{ + disabled: radio_button_switch2.checked + text:"Radio Button_1" + } + FluRadioButton{ + disabled: radio_button_switch2.checked + text:"Radio Button_2" + } + FluRadioButton{ + disabled: radio_button_switch2.checked + text:"Radio Button_3" + } + } + FluToggleSwitch{ + id:radio_button_switch2 + anchors{ + right: parent.right + verticalCenter: parent.verticalCenter + } + text:"Disabled" + } + } + CodeExpander{ + Layout.fillWidth: true + Layout.topMargin: -1 + code:'FluRadioButtons{ + spacing: 8 + FluRadioButton{ + text:"Radio Button_1" + } + FluRadioButton{ + text:"Radio Button_2" + } + FluRadioButton{ + text:"Radio Button_3" + } +}' + } + } diff --git a/src/imports/FluentUI/Controls/FluDropDownButton.qml b/src/imports/FluentUI/Controls/FluDropDownButton.qml index 605b2b9c..57ace0e3 100644 --- a/src/imports/FluentUI/Controls/FluDropDownButton.qml +++ b/src/imports/FluentUI/Controls/FluDropDownButton.qml @@ -77,7 +77,7 @@ Button { onClicked: { if(items && menu.count !==0){ var pos = control.mapToItem(null, 0, 0) - var containerHeight = menu.height + var containerHeight = menu.count*36 if(window.height>pos.y+control.height+containerHeight){ menu.y = control.height }else if(pos.y>containerHeight){ @@ -90,6 +90,7 @@ Button { } FluMenu{ id:menu + modal:true width: control.width } } diff --git a/src/imports/FluentUI/Controls/FluExpander.qml b/src/imports/FluentUI/Controls/FluExpander.qml index 53f774f2..eeee7fa2 100644 --- a/src/imports/FluentUI/Controls/FluExpander.qml +++ b/src/imports/FluentUI/Controls/FluExpander.qml @@ -79,8 +79,7 @@ Item { Behavior on height { NumberAnimation{ duration: 167 - easing.type: Easing.BezierSpline - easing.bezierCurve: expand ? [ 0, 0, 0, 1 ] : [ 1, 0, 0, 0 ] + easing.type: Easing.InCubic } } } diff --git a/src/imports/FluentUI/Controls/FluMenu.qml b/src/imports/FluentUI/Controls/FluMenu.qml index 289cb52d..26646dd0 100644 --- a/src/imports/FluentUI/Controls/FluMenu.qml +++ b/src/imports/FluentUI/Controls/FluMenu.qml @@ -16,7 +16,6 @@ T.Menu { spacing: 0 delegate: FluMenuItem { } enter: Transition { - reversible: true NumberAnimation { property: "opacity" from:0 diff --git a/src/imports/FluentUI/Controls/FluNavigationView.qml b/src/imports/FluentUI/Controls/FluNavigationView.qml index f1f4c8a1..64f7f3d1 100644 --- a/src/imports/FluentUI/Controls/FluNavigationView.qml +++ b/src/imports/FluentUI/Controls/FluNavigationView.qml @@ -122,8 +122,7 @@ Item { Behavior on height { NumberAnimation{ duration: 167 - easing.type: Easing.BezierSpline - easing.bezierCurve: [ 0, 0, 0, 1 ] + easing.type: Easing.InCubic } } } @@ -140,8 +139,7 @@ Item { Behavior on height { NumberAnimation{ duration: 167 - easing.type: Easing.BezierSpline - easing.bezierCurve: [ 0, 0, 0, 1 ] + easing.type: Easing.InCubic } } width: layout_list.width @@ -333,8 +331,7 @@ Item { Behavior on height { NumberAnimation{ duration: 167 - easing.type: Easing.BezierSpline - easing.bezierCurve: [ 0, 0, 0, 1 ] + easing.type: Easing.InCubic } } clip: true @@ -571,8 +568,7 @@ Item { Behavior on Layout.preferredWidth { NumberAnimation{ duration: 167 - easing.type: Easing.BezierSpline - easing.bezierCurve: [ 0, 0, 0, 1 ] + easing.type: Easing.InCubic } } } @@ -638,8 +634,7 @@ Item { Behavior on anchors.leftMargin { NumberAnimation{ duration: 167 - easing.type: Easing.BezierSpline - easing.bezierCurve: [ 0, 0, 0, 1 ] + easing.type: Easing.InCubic } } StackView{ @@ -695,15 +690,13 @@ Item { Behavior on width { NumberAnimation{ duration: 167 - easing.type: Easing.BezierSpline - easing.bezierCurve: [ 0, 0, 0, 1 ] + easing.type: Easing.InCubic } } Behavior on x { NumberAnimation{ duration: 167 - easing.type: Easing.BezierSpline - easing.bezierCurve: [ 0, 0, 0, 1 ] + easing.type: Easing.InCubic } } visible: { @@ -768,7 +761,7 @@ Item { clip: true ScrollBar.vertical: FluScrollBar {} model:d.handleItems() - highlightMoveDuration: 150 + highlightMoveDuration: 167 highlight: Item{ clip: true Rectangle{ diff --git a/src/imports/FluentUI/Controls/FluPivot.qml b/src/imports/FluentUI/Controls/FluPivot.qml index 04f5c127..da424303 100644 --- a/src/imports/FluentUI/Controls/FluPivot.qml +++ b/src/imports/FluentUI/Controls/FluPivot.qml @@ -27,7 +27,8 @@ Item { clip: true spacing: 20 interactive: false - orientation:ListView.Horizontal + orientation: ListView.Horizontal + highlightMoveDuration: 167 highlight: Item{ clip: true Rectangle{ @@ -38,7 +39,8 @@ Item { y:37 Behavior on width { NumberAnimation{ - duration: 150 + duration: 167 + easing.type: Easing.InCubic } } } @@ -61,11 +63,6 @@ Item { return normalColor } } - transitions: Transition { - NumberAnimation{ - duration: 400; - } - } } onClicked: { nav_list.currentIndex = index diff --git a/src/imports/FluentUI/Controls/FluRadioButtons.qml b/src/imports/FluentUI/Controls/FluRadioButtons.qml new file mode 100644 index 00000000..9a5e908b --- /dev/null +++ b/src/imports/FluentUI/Controls/FluRadioButtons.qml @@ -0,0 +1,30 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Basic +import QtQuick.Layouts +import FluentUI + +ColumnLayout { + default property alias buttons: control.data + property int currentIndex : -1 + id:control + onCurrentIndexChanged: { + for(var i = 0;i