This commit is contained in:
朱子楚\zhuzi 2023-08-11 22:47:36 +08:00
parent 6fe3081d23
commit 855305f197
5 changed files with 34 additions and 28 deletions

View File

@ -41,7 +41,7 @@ FluWindow {
setWindowFixedSize(fixSize) setWindowFixedSize(fixSize)
title_bar.maximizeButton.visible = !fixSize title_bar.maximizeButton.visible = !fixSize
if (blurBehindWindowEnabled) if (blurBehindWindowEnabled)
window.backgroundVisible = false window.background = undefined
window.show() window.show()
} }
} }

View File

@ -77,6 +77,7 @@ FluScrollablePage{
anchors.fill: parent anchors.fill: parent
tintColor: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1) tintColor: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
target: bg target: bg
blurRadius : 40
targetRect: Qt.rect(list.x-list.contentX+10+(control.width)*index,list.y+10,width,height) targetRect: Qt.rect(list.x-list.contentX+10+(control.width)*index,list.y+10,width,height)
} }
Rectangle{ Rectangle{
@ -85,14 +86,14 @@ FluScrollablePage{
color:{ color:{
if(FluTheme.dark){ if(FluTheme.dark){
if(item_mouse.containsMouse){ if(item_mouse.containsMouse){
return Qt.rgba(1,1,1,0.03) return Qt.rgba(1,1,1,0.06)
} }
return Qt.rgba(0,0,0,0) return Qt.rgba(0,0,0,0.03)
}else{ }else{
if(item_mouse.containsMouse){ if(item_mouse.containsMouse){
return Qt.rgba(0,0,0,0.03) return Qt.rgba(0,0,0,0.09)
} }
return Qt.rgba(0,0,0,0) return Qt.rgba(0,0,0,0.06)
} }
} }
} }

View File

@ -21,13 +21,13 @@ FRAMELESSHELPER_USE_NAMESPACE
QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io"); QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io");
QGuiApplication::setApplicationName("FluentUI"); QGuiApplication::setApplicationName("FluentUI");
QGuiApplication app(argc, argv); QGuiApplication app(argc, argv);
#ifdef Q_OS_WIN // 此设置仅在Windows下生效
FramelessConfig::instance()->set(Global::Option::ForceHideWindowFrameBorder);
#endif
FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial); FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial);
FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow); FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow);
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur); FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur);
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow); FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
#ifdef Q_OS_WIN // 此设置仅在Windows下生效
FramelessConfig::instance()->set(Global::Option::ForceHideWindowFrameBorder);
#endif
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur,false); FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur,false);
#endif #endif

View File

@ -49,14 +49,14 @@ void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegist
return; return;
} }
QVariantMap properties; QVariantMap properties;
properties.insert("route",route); properties.insert("_route",route);
if(fluRegister){ if(fluRegister){
properties.insert("pageRegister",QVariant::fromValue(fluRegister)); properties.insert("_pageRegister",QVariant::fromValue(fluRegister));
} }
properties.insert("argument",argument); properties.insert("argument",argument);
QQuickWindow *view=nullptr; QQuickWindow *view=nullptr;
for (auto& pair : wnds) { for (auto& pair : wnds) {
QString r = pair->property("route").toString(); QString r = pair->property("_route").toString();
if(r == route){ if(r == route){
view = pair; view = pair;
break; break;

View File

@ -1,5 +1,4 @@
import QtQuick import QtQuick
import QtQuick.Window
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import FluentUI import FluentUI
@ -8,10 +7,11 @@ Window {
default property alias content: container.data default property alias content: container.data
property bool closeDestory: true property bool closeDestory: true
property int launchMode: FluWindowType.Standard property int launchMode: FluWindowType.Standard
property string route
property var argument:({}) property var argument:({})
property var pageRegister property var background : com_background
property Component loadingItem: com_loading property Component loadingItem: com_loading
property var _pageRegister
property string _route
property var closeFunc: function(event){ property var closeFunc: function(event){
if(closeDestory){ if(closeDestory){
deleteWindow() deleteWindow()
@ -20,26 +20,31 @@ Window {
event.accepted = false event.accepted = false
} }
} }
property color backgroundColor: {
if(active){
return FluTheme.dark ? Qt.rgba(26/255,34/255,40/255,1) : Qt.rgba(238/255,244/255,249/255,1)
}
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
}
property alias backgroundOpacity: bg.opacity
property alias backgroundVisible: bg.visible
signal initArgument(var argument) signal initArgument(var argument)
id:window id:window
color:"transparent" color:"transparent"
onClosing:(event)=>closeFunc(event)
Component.onCompleted: { Component.onCompleted: {
helper.initWindow(window) helper.initWindow(window)
initArgument(argument) initArgument(argument)
} }
Rectangle{ Connections{
id: bg target: window
function onClosing(event){closeFunc(event)}
}
Component{
id:com_background
Rectangle{
color: {
if(active){
return FluTheme.dark ? Qt.rgba(26/255,34/255,40/255,1) : Qt.rgba(238/255,244/255,249/255,1)
}
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
}
}
}
Loader{
anchors.fill: parent anchors.fill: parent
color: backgroundColor sourceComponent: background
} }
Item{ Item{
id:container id:container
@ -124,8 +129,8 @@ Window {
FluApp.deleteWindow(window) FluApp.deleteWindow(window)
} }
function onResult(data){ function onResult(data){
if(pageRegister){ if(_pageRegister){
pageRegister.onResult(data) _pageRegister.onResult(data)
} }
} }
} }