Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
朱子楚\zhuzi committed Aug 11, 2023
1 parent 6fe3081 commit 855305f
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 28 deletions.
2 changes: 1 addition & 1 deletion example/qml/component/CustomWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ FluWindow {
setWindowFixedSize(fixSize)
title_bar.maximizeButton.visible = !fixSize
if (blurBehindWindowEnabled)
window.backgroundVisible = false
window.background = undefined
window.show()
}
}
Expand Down
9 changes: 5 additions & 4 deletions example/qml/page/T_Home.qml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ FluScrollablePage{
anchors.fill: parent
tintColor: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
target: bg
blurRadius : 40
targetRect: Qt.rect(list.x-list.contentX+10+(control.width)*index,list.y+10,width,height)
}
Rectangle{
Expand All @@ -85,14 +86,14 @@ FluScrollablePage{
color:{
if(FluTheme.dark){
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{
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)
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions example/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ FRAMELESSHELPER_USE_NAMESPACE
QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io");
QGuiApplication::setApplicationName("FluentUI");
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::CenterWindowBeforeShow);
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur);
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
#ifdef Q_OS_WIN // 此设置仅在Windows下生效
FramelessConfig::instance()->set(Global::Option::ForceHideWindowFrameBorder);
#endif
#ifdef Q_OS_MACOS
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur,false);
#endif
Expand Down
6 changes: 3 additions & 3 deletions src/FluApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegist
return;
}
QVariantMap properties;
properties.insert("route",route);
properties.insert("_route",route);
if(fluRegister){
properties.insert("pageRegister",QVariant::fromValue(fluRegister));
properties.insert("_pageRegister",QVariant::fromValue(fluRegister));
}
properties.insert("argument",argument);
QQuickWindow *view=nullptr;
for (auto& pair : wnds) {
QString r = pair->property("route").toString();
QString r = pair->property("_route").toString();
if(r == route){
view = pair;
break;
Expand Down
39 changes: 22 additions & 17 deletions src/imports/FluentUI/Controls/FluWindow.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import QtQuick
import QtQuick.Window
import QtQuick.Controls
import QtQuick.Layouts
import FluentUI
Expand All @@ -8,10 +7,11 @@ Window {
default property alias content: container.data
property bool closeDestory: true
property int launchMode: FluWindowType.Standard
property string route
property var argument:({})
property var pageRegister
property var background : com_background
property Component loadingItem: com_loading
property var _pageRegister
property string _route
property var closeFunc: function(event){
if(closeDestory){
deleteWindow()
Expand All @@ -20,26 +20,31 @@ Window {
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)
id:window
color:"transparent"
onClosing:(event)=>closeFunc(event)
Component.onCompleted: {
helper.initWindow(window)
initArgument(argument)
}
Rectangle{
id: bg
Connections{
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
color: backgroundColor
sourceComponent: background
}
Item{
id:container
Expand Down Expand Up @@ -124,8 +129,8 @@ Window {
FluApp.deleteWindow(window)
}
function onResult(data){
if(pageRegister){
pageRegister.onResult(data)
if(_pageRegister){
_pageRegister.onResult(data)
}
}
}

0 comments on commit 855305f

Please sign in to comment.