From 8595b2fdec97333cc76a5883b696eef3e00e2dd8 Mon Sep 17 00:00:00 2001 From: zhuzichu Date: Thu, 13 Jul 2023 10:20:45 +0800 Subject: [PATCH] update --- example/qml/page/T_InfoBar.qml | 8 ++- src/imports/FluentUI/Controls/FluTreeView.qml | 15 ++++-- src/imports/FluentUI/Controls/FluWindow.qml | 53 +++++++++++++++++++ 3 files changed, 72 insertions(+), 4 deletions(-) diff --git a/example/qml/page/T_InfoBar.qml b/example/qml/page/T_InfoBar.qml index 41b6d76f..24e3d907 100644 --- a/example/qml/page/T_InfoBar.qml +++ b/example/qml/page/T_InfoBar.qml @@ -12,7 +12,7 @@ FluScrollablePage{ FluArea{ Layout.fillWidth: true Layout.topMargin: 20 - height: 200 + height: 240 paddings: 10 ColumnLayout{ spacing: 14 @@ -44,6 +44,12 @@ FluScrollablePage{ showSuccess("这是一个Success样式的InfoBar这是一个Success样式的InfoBar") } } + FluButton{ + text:"Loading" + onClicked: { + showLoading() + } + } } } CodeExpander{ diff --git a/src/imports/FluentUI/Controls/FluTreeView.qml b/src/imports/FluentUI/Controls/FluTreeView.qml index 181a669a..83540716 100644 --- a/src/imports/FluentUI/Controls/FluTreeView.qml +++ b/src/imports/FluentUI/Controls/FluTreeView.qml @@ -105,7 +105,6 @@ Item { verticalCenter: parent.verticalCenter } } - MouseArea{ id:item_layout_mouse anchors.fill: parent @@ -200,9 +199,7 @@ Item { FluIconButton{ id:item_layout_expanded color:"#00000000" - iconSource:item_layout.expanded?FluentIcons.ChevronDown:FluentIcons.ChevronRight opacity: item_layout.hasChild - iconSize: 15 onClicked: { if(!item_layout.hasChild){ item_layout_rect.onClickItem() @@ -210,6 +207,18 @@ Item { } model.expanded = !model.expanded } + contentItem: FluIcon{ + rotation: item_layout.expanded?0:-90 + iconSource:FluentIcons.ChevronDown + iconSize: 15 + Behavior on rotation { + enabled: FluTheme.enableAnimation + NumberAnimation{ + duration: 167 + easing.type: Easing.OutCubic + } + } + } } FluText { text: item_layout.text diff --git a/src/imports/FluentUI/Controls/FluWindow.qml b/src/imports/FluentUI/Controls/FluWindow.qml index 67ee8c61..0bffd633 100644 --- a/src/imports/FluentUI/Controls/FluWindow.qml +++ b/src/imports/FluentUI/Controls/FluWindow.qml @@ -16,6 +16,7 @@ Window { property string route property var argument:({}) property var pageRegister + property Component loadingItem: com_loading property var closeFunc: function(event){ if(closeDestory){ deleteWindow() @@ -50,13 +51,65 @@ Window { anchors.fill: parent clip: true } + Loader{ + property string loadingText: "加载中..." + property bool cancel: false + id:loader_loading + anchors.fill: container + } FluInfoBar{ id:infoBar root: window } + Component{ + id:com_loading + Popup{ + id:popup_loading + modal:true + focus: true + anchors.centerIn: Overlay.overlay + closePolicy: { + if(cancel){ + return Popup.CloseOnEscape | Popup.CloseOnPressOutside + } + return Popup.NoAutoClose + } + Overlay.modal: Rectangle { + color: "#44000000" + } + onVisibleChanged: { + if(!visible){ + loader_loading.sourceComponent = undefined + } + } + visible: true + background: Item{} + contentItem: Item{ + ColumnLayout{ + spacing: 8 + anchors.centerIn: parent + FluProgressRing{ + Layout.alignment: Qt.AlignHCenter + } + FluText{ + text:loadingText + Layout.alignment: Qt.AlignHCenter + } + } + } + } + } WindowHelper{ id:helper } + function showLoading(text = "加载中...",cancel = true){ + loader_loading.loadingText = text + loader_loading.cancel = cancel + loader_loading.sourceComponent = com_loading + } + function hideLoading(){ + loader_loading.sourceComponent = undefined + } function showSuccess(text,duration,moremsg){ infoBar.showSuccess(text,duration,moremsg) }