From 7716ab02a6386f92e6957e7ec730df82ce0a2286 Mon Sep 17 00:00:00 2001 From: zhuzichu Date: Mon, 25 Sep 2023 18:10:24 +0800 Subject: [PATCH] update --- example/qml-Qt6/global/ItemsOriginal.qml | 11 ++++++ example/qml-Qt6/page/T_CalendarPicker.qml | 2 +- example/qml-Qt6/page/T_Timeline.qml | 2 +- example/qml/global/ItemsOriginal.qml | 11 ++++++ example/qml/page/T_CalendarPicker.qml | 2 +- example/qml/page/T_Timeline.qml | 2 +- .../imports/FluentUI/Controls/FluAppBar.qml | 5 --- .../FluentUI/Controls/FluNavigationView.qml | 33 ++++++++++++++++++ .../imports/FluentUI/Controls/FluPaneItem.qml | 1 + .../FluentUI/Controls/FluPaneItemExpander.qml | 1 + .../imports/FluentUI/Controls/FluAppBar.qml | 34 +++++++++++++------ .../FluentUI/Controls/FluNavigationView.qml | 33 ++++++++++++++++++ .../imports/FluentUI/Controls/FluPaneItem.qml | 2 ++ .../FluentUI/Controls/FluPaneItemExpander.qml | 1 + 14 files changed, 121 insertions(+), 19 deletions(-) diff --git a/example/qml-Qt6/global/ItemsOriginal.qml b/example/qml-Qt6/global/ItemsOriginal.qml index 20c0b0e4..ab88e9dd 100644 --- a/example/qml-Qt6/global/ItemsOriginal.qml +++ b/example/qml-Qt6/global/ItemsOriginal.qml @@ -129,6 +129,11 @@ FluObject{ onDropped:{ FluApp.navigate("/pageWindow",{title:title,url:url}) } onTap:{ navigationView.push(url) } } + FluPaneItem{ + title:"PaneItem Disabled" + disabled: true + icon: FluentIcons.Error + } } FluPaneItemExpander{ @@ -370,6 +375,12 @@ FluObject{ } } + FluPaneItemExpander{ + title:"PaneItemExpander Disabled" + icon: FluentIcons.Send + disabled: true + } + FluPaneItemSeparator{ spacing:10 size:1 diff --git a/example/qml-Qt6/page/T_CalendarPicker.qml b/example/qml-Qt6/page/T_CalendarPicker.qml index 078d19e6..e73013e8 100644 --- a/example/qml-Qt6/page/T_CalendarPicker.qml +++ b/example/qml-Qt6/page/T_CalendarPicker.qml @@ -36,7 +36,7 @@ FluScrollablePage{ left: parent.left } FluCalendarPicker{ - current:Date.fromLocaleString("2013年7月11日 21:17:42") + current:new Date() onAccepted:{ showSuccess(current.toLocaleString()) } diff --git a/example/qml-Qt6/page/T_Timeline.qml b/example/qml-Qt6/page/T_Timeline.qml index 3e7ae2b7..b28fd5ec 100644 --- a/example/qml-Qt6/page/T_Timeline.qml +++ b/example/qml-Qt6/page/T_Timeline.qml @@ -84,7 +84,7 @@ FluScrollablePage{ text:"找到一份Android外包开发岗位,开发了一个Android应用,满满成就感!前端、服务端、Flutter也都懂一丢丢,什么都会什么都不精通,钱途无望" } ListElement{ - lable:"2020-06-01" + lable:"2021-06-01" text:"由于某个项目紧急,临时加入Qt项目组(就因为大学学了点C++),本来是想进去打个酱油,到后面竟然成开发主力,坑啊" } ListElement{ diff --git a/example/qml/global/ItemsOriginal.qml b/example/qml/global/ItemsOriginal.qml index b85cb875..9b844f77 100644 --- a/example/qml/global/ItemsOriginal.qml +++ b/example/qml/global/ItemsOriginal.qml @@ -129,6 +129,11 @@ FluObject{ onDropped:{ FluApp.navigate("/pageWindow",{title:title,url:url}) } onTap:{ navigationView.push(url) } } + FluPaneItem{ + title:"PaneItem Disabled" + disabled: true + icon: FluentIcons.Error + } } FluPaneItemExpander{ @@ -370,6 +375,12 @@ FluObject{ } } + FluPaneItemExpander{ + title:"PaneItemExpander Disabled" + icon: FluentIcons.Send + disabled: true + } + FluPaneItemSeparator{ spacing:10 size:1 diff --git a/example/qml/page/T_CalendarPicker.qml b/example/qml/page/T_CalendarPicker.qml index fd889f4f..bc50d56d 100644 --- a/example/qml/page/T_CalendarPicker.qml +++ b/example/qml/page/T_CalendarPicker.qml @@ -37,7 +37,7 @@ FluScrollablePage{ left: parent.left } FluCalendarPicker{ - current:Date.fromLocaleString("2013年7月11日 21:17:42") + current:new Date() onAccepted:{ showSuccess(current.toLocaleString()) } diff --git a/example/qml/page/T_Timeline.qml b/example/qml/page/T_Timeline.qml index 43767b1a..09c29e0d 100644 --- a/example/qml/page/T_Timeline.qml +++ b/example/qml/page/T_Timeline.qml @@ -85,7 +85,7 @@ FluScrollablePage{ text:"找到一份Android外包开发岗位,开发了一个Android应用,满满成就感!前端、服务端、Flutter也都懂一丢丢,什么都会什么都不精通,钱途无望" } ListElement{ - lable:"2020-06-01" + lable:"2021-06-01" text:"由于某个项目紧急,临时加入Qt项目组(就因为大学学了点C++),本来是想进去打个酱油,到后面竟然成开发主力,坑啊" } ListElement{ diff --git a/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml b/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml index 43a0d1bb..65c71a93 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml @@ -164,21 +164,16 @@ Rectangle{ onClicked: closeClickListener() } } - function minimizeButton(){ return btn_minimize } - function maximizeButton(){ return btn_maximize } - function closeButton(){ return btn_close } - function darkButton(){ return btn_dark } - } diff --git a/src/Qt5/imports/FluentUI/Controls/FluNavigationView.qml b/src/Qt5/imports/FluentUI/Controls/FluNavigationView.qml index 284b1cd2..f64312c0 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluNavigationView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluNavigationView.qml @@ -30,6 +30,7 @@ Item { property bool isCompactAndPanel: d.displayMode === FluNavigationViewType.Compact && d.enableNavigationPanel property bool isCompactAndNotPanel:d.displayMode === FluNavigationViewType.Compact && !d.enableNavigationPanel property bool isMinimalAndPanel: d.displayMode === FluNavigationViewType.Minimal && d.enableNavigationPanel + property color itemDisableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1) onIsCompactAndNotPanelChanged: { collapseAll() } @@ -163,6 +164,7 @@ Item { width: layout_list.width FluControl{ id:item_control + enabled: !model.disabled anchors{ top: parent.top bottom: parent.bottom @@ -272,8 +274,17 @@ Item { easing.type: Easing.OutCubic } } + color: { + if(!item_control.enabled){ + return d.itemDisableColor + } + return FluTheme.dark ? "#FFFFFF" : "#000000" + } } color: { + if(!item_control.enabled){ + return Qt.rgba(0,0,0,0) + } if(FluTheme.dark){ if((nav_list.currentIndex === _idx)&&type===0){ return Qt.rgba(1,1,1,0.06) @@ -302,6 +313,12 @@ Item { return 0 } iconSize: 15 + color: { + if(!item_control.enabled){ + return d.itemDisableColor + } + return FluTheme.dark ? "#FFFFFF" : "#000000" + } } } Item{ @@ -344,6 +361,9 @@ Item { right: item_icon_expand.left } color:{ + if(!item_control.enabled){ + return d.itemDisableColor + } if(item_control.pressed){ return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120 } @@ -414,6 +434,7 @@ Item { FluControl{ property var modelData: model id:item_control + enabled: !model.disabled anchors{ top: parent.top bottom: parent.bottom @@ -485,6 +506,9 @@ Item { radius: 4 anchors.fill: parent color: { + if(!item_control.enabled){ + return Qt.rgba(0,0,0,0) + } if(FluTheme.dark){ if(type===0){ if(nav_list.currentIndex === _idx){ @@ -524,6 +548,12 @@ Item { } return 0 } + color: { + if(!item_control.enabled){ + return d.itemDisableColor + } + return FluTheme.dark ? "#FFFFFF" : "#000000" + } iconSize: 15 } } @@ -562,6 +592,9 @@ Item { } elide: Text.ElideRight color:{ + if(!item_control.enabled){ + return d.itemDisableColor + } if(item_mouse.pressed){ return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120 } diff --git a/src/Qt5/imports/FluentUI/Controls/FluPaneItem.qml b/src/Qt5/imports/FluentUI/Controls/FluPaneItem.qml index 0002bb39..abf0975c 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluPaneItem.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluPaneItem.qml @@ -10,6 +10,7 @@ QtObject { property int order : 0 property int icon property var url + property bool disabled: false property Component cusIcon property Component infoBadge property bool recentlyAdded: false diff --git a/src/Qt5/imports/FluentUI/Controls/FluPaneItemExpander.qml b/src/Qt5/imports/FluentUI/Controls/FluPaneItemExpander.qml index 4a700085..4d97f812 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluPaneItemExpander.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluPaneItemExpander.qml @@ -7,6 +7,7 @@ FluObject { property int _idx property string title property var icon + property bool disabled: false property Component cusIcon property bool isExpand: false property var parent diff --git a/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml b/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml index e10623be..677f3bb6 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml @@ -13,11 +13,14 @@ Rectangle{ property string closeText : "关闭" property color textColor: FluTheme.dark ? "#FFFFFF" : "#000000" property color minimizeNormalColor: Qt.rgba(0,0,0,0) - property color minimizeHoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.1) : Qt.rgba(0,0,0,0.06) + property color minimizeHoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03) + property color minimizePressColor: FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06) property color maximizeNormalColor: Qt.rgba(0,0,0,0) - property color maximizeHoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.1) : Qt.rgba(0,0,0,0.06) + property color maximizeHoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03) + property color maximizePressColor: FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06) property color closeNormalColor: Qt.rgba(0,0,0,0) property color closeHoverColor: Qt.rgba(251/255,115/255,115/255,1) + property color closePressColor: Qt.rgba(251/255,115/255,115/255,0.8) property bool showDark: false property bool showClose: true property bool showMinimize: true @@ -114,7 +117,12 @@ Rectangle{ radius: 0 visible: !isMac && showMinimize iconColor: control.textColor - color: hovered ? minimizeHoverColor : minimizeNormalColor + color: { + if(pressed){ + return minimizePressColor + } + return hovered ? minimizeHoverColor : minimizeNormalColor + } onClicked: minClickListener() } FluIconButton{ @@ -122,7 +130,12 @@ Rectangle{ Layout.preferredWidth: 40 Layout.preferredHeight: 30 iconSource : d.isRestore ? FluentIcons.ChromeRestore : FluentIcons.ChromeMaximize - color: hovered ? maximizeHoverColor : maximizeNormalColor + color: { + if(pressed){ + return maximizePressColor + } + return hovered ? maximizeHoverColor : maximizeNormalColor + } Layout.alignment: Qt.AlignVCenter visible: d.resizable && !isMac && showMaximize radius: 0 @@ -142,25 +155,26 @@ Rectangle{ radius: 0 iconSize: 10 iconColor: hovered ? Qt.rgba(1,1,1,1) : control.textColor - color:hovered ? closeHoverColor : closeNormalColor + color:{ + if(pressed){ + return closePressColor + } + return hovered ? closeHoverColor : closeNormalColor + } onClicked: closeClickListener() } } - function minimizeButton(){ return btn_minimize } - function maximizeButton(){ return btn_maximize } - function closeButton(){ return btn_close } - function darkButton(){ return btn_dark } - } + diff --git a/src/Qt6/imports/FluentUI/Controls/FluNavigationView.qml b/src/Qt6/imports/FluentUI/Controls/FluNavigationView.qml index 68c3e583..0237ffac 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluNavigationView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluNavigationView.qml @@ -31,6 +31,7 @@ Item { property bool isCompactAndPanel: d.displayMode === FluNavigationViewType.Compact && d.enableNavigationPanel property bool isCompactAndNotPanel:d.displayMode === FluNavigationViewType.Compact && !d.enableNavigationPanel property bool isMinimalAndPanel: d.displayMode === FluNavigationViewType.Minimal && d.enableNavigationPanel + property color itemDisableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1) onIsCompactAndNotPanelChanged: { collapseAll() } @@ -164,6 +165,7 @@ Item { width: layout_list.width FluControl{ id:item_control + enabled: !model.disabled anchors{ top: parent.top bottom: parent.bottom @@ -273,8 +275,17 @@ Item { easing.type: Easing.OutCubic } } + color: { + if(!item_control.enabled){ + return d.itemDisableColor + } + return FluTheme.dark ? "#FFFFFF" : "#000000" + } } color: { + if(!item_control.enabled){ + return Qt.rgba(0,0,0,0) + } if(FluTheme.dark){ if((nav_list.currentIndex === _idx)&&type===0){ return Qt.rgba(1,1,1,0.06) @@ -303,6 +314,12 @@ Item { return 0 } iconSize: 15 + color: { + if(!item_control.enabled){ + return d.itemDisableColor + } + return FluTheme.dark ? "#FFFFFF" : "#000000" + } } } Item{ @@ -345,6 +362,9 @@ Item { right: item_icon_expand.left } color:{ + if(!item_control.enabled){ + return d.itemDisableColor + } if(item_control.pressed){ return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120 } @@ -415,6 +435,7 @@ Item { FluControl{ property var modelData: model id:item_control + enabled: !model.disabled anchors{ top: parent.top bottom: parent.bottom @@ -486,6 +507,9 @@ Item { radius: 4 anchors.fill: parent color: { + if(!item_control.enabled){ + return Qt.rgba(0,0,0,0) + } if(FluTheme.dark){ if(type===0){ if(nav_list.currentIndex === _idx){ @@ -525,6 +549,12 @@ Item { } return 0 } + color: { + if(!item_control.enabled){ + return d.itemDisableColor + } + return FluTheme.dark ? "#FFFFFF" : "#000000" + } iconSize: 15 } } @@ -563,6 +593,9 @@ Item { } elide: Text.ElideRight color:{ + if(!item_control.enabled){ + return d.itemDisableColor + } if(item_mouse.pressed){ return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120 } diff --git a/src/Qt6/imports/FluentUI/Controls/FluPaneItem.qml b/src/Qt6/imports/FluentUI/Controls/FluPaneItem.qml index 0bc756e7..f51726db 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluPaneItem.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluPaneItem.qml @@ -2,6 +2,7 @@ import QtQuick import QtQuick.Controls import FluentUI + QtObject { readonly property string key : FluTools.uuid() property int _idx @@ -10,6 +11,7 @@ QtObject { property int order : 0 property int icon property var url + property bool disabled: false property Component cusIcon property Component infoBadge property bool recentlyAdded: false diff --git a/src/Qt6/imports/FluentUI/Controls/FluPaneItemExpander.qml b/src/Qt6/imports/FluentUI/Controls/FluPaneItemExpander.qml index 2efc2d3a..a152d010 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluPaneItemExpander.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluPaneItemExpander.qml @@ -7,6 +7,7 @@ FluObject { property int _idx property string title property var icon + property bool disabled: false property Component cusIcon property bool isExpand: false property var parent