From 4b01fcf2b457126bcec70a0a4168a8bdf979149f Mon Sep 17 00:00:00 2001 From: zhuzichu Date: Fri, 8 Sep 2023 19:14:45 +0800 Subject: [PATCH] update --- .../FluentUI/Controls/FluNavigationView.qml | 49 +++++++------ .../imports/FluentUI/Controls/FluShadow.qml | 70 ++++--------------- .../FluentUI/Controls/FluNavigationView.qml | 49 +++++++------ .../imports/FluentUI/Controls/FluShadow.qml | 70 ++++--------------- 4 files changed, 80 insertions(+), 158 deletions(-) diff --git a/src/Qt5/imports/FluentUI/Controls/FluNavigationView.qml b/src/Qt5/imports/FluentUI/Controls/FluNavigationView.qml index 24bdbaf3..d7061bf4 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluNavigationView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluNavigationView.qml @@ -409,6 +409,31 @@ Item { Drag.hotSpot.x: item_control.width / 2 Drag.hotSpot.y: item_control.height / 2 Drag.dragType: Drag.Automatic + onClicked: { + if(type === 0){ + if(model.onTapListener){ + model.onTapListener() + }else{ + nav_list.currentIndex = _idx + layout_footer.currentIndex = -1 + model.tap() + if(d.isMinimal || d.isCompact){ + d.enableNavigationPanel = false + } + } + }else{ + if(model.onTapListener){ + model.onTapListener() + }else{ + nav_list.currentIndex = nav_list.count-layout_footer.count+_idx + layout_footer.currentIndex = _idx + model.tap() + if(d.isMinimal || d.isCompact){ + d.enableNavigationPanel = false + } + } + } + } MouseArea{ id:item_mouse anchors.fill: parent @@ -433,29 +458,7 @@ Item { loader_item_menu.item.popup(); } }else{ - if(type === 0){ - if(model.onTapListener){ - model.onTapListener() - }else{ - nav_list.currentIndex = _idx - layout_footer.currentIndex = -1 - model.tap() - if(d.isMinimal || d.isCompact){ - d.enableNavigationPanel = false - } - } - }else{ - if(model.onTapListener){ - model.onTapListener() - }else{ - nav_list.currentIndex = nav_list.count-layout_footer.count+_idx - layout_footer.currentIndex = _idx - model.tap() - if(d.isMinimal || d.isCompact){ - d.enableNavigationPanel = false - } - } - } + item_control.clicked() } } } diff --git a/src/Qt5/imports/FluentUI/Controls/FluShadow.qml b/src/Qt5/imports/FluentUI/Controls/FluShadow.qml index 38f4be88..41b03992 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluShadow.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluShadow.qml @@ -3,64 +3,22 @@ import QtQuick.Controls 2.15 import FluentUI 1.0 Item { - - property color color: FluTheme.dark ? "#FFFFFF" : "#999999" + //高性能阴影!!!比DropShadow阴影性能高出数倍!!! + property color color: FluTheme.dark ? "#999999" : "#999999" + property int elevation: 5 property int radius: 4 id:control anchors.fill: parent - anchors.margins: -4 - Rectangle{ - width: control.width - height: control.height - anchors.centerIn: parent - color: "#00000000" - opacity: 0.02 - border.width: 1 - radius: control.radius - border.color: control.color + Repeater{ + model: elevation + Rectangle{ + anchors.fill: parent + color: "#00000000" + opacity: 0.02 * (elevation-index+1) + anchors.margins: -index+1 + radius: control.radius + border.width: index + border.color: control.color + } } - - Rectangle{ - width: control.width - 2 - height: control.height - 2 - anchors.centerIn: parent - color: "#00000000" - opacity: 0.04 - border.width: 1 - radius: control.radius - border.color: control.color - } - Rectangle{ - width: control.width - 4 - height: control.height - 4 - anchors.centerIn: parent - color: "#00000000" - opacity: 0.06 - border.width: 1 - radius: control.radius - border.color: control.color - } - - Rectangle{ - width: control.width - 6 - height: control.height - 6 - anchors.centerIn: parent - color: "#00000000" - opacity: 0.08 - border.width: 1 - radius: control.radius - border.color: control.color - } - - Rectangle{ - width: control.width - 8 - height: control.height - 8 - anchors.centerIn: parent - opacity: 0.1 - radius: control.radius - color: "#00000000" - border.width: 1 - border.color: control.color - } - } diff --git a/src/Qt6/imports/FluentUI/Controls/FluNavigationView.qml b/src/Qt6/imports/FluentUI/Controls/FluNavigationView.qml index 682ee717..a855d42c 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluNavigationView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluNavigationView.qml @@ -410,6 +410,31 @@ Item { Drag.hotSpot.x: item_control.width / 2 Drag.hotSpot.y: item_control.height / 2 Drag.dragType: Drag.Automatic + onClicked:{ + if(type === 0){ + if(model.onTapListener){ + model.onTapListener() + }else{ + nav_list.currentIndex = _idx + layout_footer.currentIndex = -1 + model.tap() + if(d.isMinimal || d.isCompact){ + d.enableNavigationPanel = false + } + } + }else{ + if(model.onTapListener){ + model.onTapListener() + }else{ + nav_list.currentIndex = nav_list.count-layout_footer.count+_idx + layout_footer.currentIndex = _idx + model.tap() + if(d.isMinimal || d.isCompact){ + d.enableNavigationPanel = false + } + } + } + } MouseArea{ id:item_mouse anchors.fill: parent @@ -434,29 +459,7 @@ Item { loader_item_menu.item.popup(); } }else{ - if(type === 0){ - if(model.onTapListener){ - model.onTapListener() - }else{ - nav_list.currentIndex = _idx - layout_footer.currentIndex = -1 - model.tap() - if(d.isMinimal || d.isCompact){ - d.enableNavigationPanel = false - } - } - }else{ - if(model.onTapListener){ - model.onTapListener() - }else{ - nav_list.currentIndex = nav_list.count-layout_footer.count+_idx - layout_footer.currentIndex = _idx - model.tap() - if(d.isMinimal || d.isCompact){ - d.enableNavigationPanel = false - } - } - } + item_control.clicked() } } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluShadow.qml b/src/Qt6/imports/FluentUI/Controls/FluShadow.qml index 280ed107..8601958e 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluShadow.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluShadow.qml @@ -3,64 +3,22 @@ import QtQuick.Controls import FluentUI Item { - - property color color: FluTheme.dark ? "#FFFFFF" : "#999999" + //高性能阴影!!!比DropShadow阴影性能高出数倍!!! + property color color: FluTheme.dark ? "#999999" : "#999999" + property int elevation: 5 property int radius: 4 id:control anchors.fill: parent - anchors.margins: -4 - Rectangle{ - width: control.width - height: control.height - anchors.centerIn: parent - color: "#00000000" - opacity: 0.02 - border.width: 1 - radius: control.radius - border.color: control.color + Repeater{ + model: elevation + Rectangle{ + anchors.fill: parent + color: "#00000000" + opacity: 0.02 * (elevation-index+1) + anchors.margins: -index+1 + radius: control.radius + border.width: index + border.color: control.color + } } - - Rectangle{ - width: control.width - 2 - height: control.height - 2 - anchors.centerIn: parent - color: "#00000000" - opacity: 0.04 - border.width: 1 - radius: control.radius - border.color: control.color - } - Rectangle{ - width: control.width - 4 - height: control.height - 4 - anchors.centerIn: parent - color: "#00000000" - opacity: 0.06 - border.width: 1 - radius: control.radius - border.color: control.color - } - - Rectangle{ - width: control.width - 6 - height: control.height - 6 - anchors.centerIn: parent - color: "#00000000" - opacity: 0.08 - border.width: 1 - radius: control.radius - border.color: control.color - } - - Rectangle{ - width: control.width - 8 - height: control.height - 8 - anchors.centerIn: parent - opacity: 0.1 - radius: control.radius - color: "#00000000" - border.width: 1 - border.color: control.color - } - }