From ac253a3de5a8537bf20d6ff9064db11231f0ef44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Sun, 5 May 2024 20:32:48 +0800 Subject: [PATCH] fix bug --- .../imports/FluentUI/Controls/FluWindow.qml | 19 ++++++++++++++----- .../imports/FluentUI/Controls/FluWindow.qml | 19 ++++++++++++++----- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml index 941bb1b1..2acf7ca5 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml @@ -122,12 +122,21 @@ Window { fillMode: Image.PreserveAspectCrop asynchronous: true Component.onCompleted: { - var geometry = FluTools.desktopAvailableGeometry(window) - width = geometry.width - height = geometry.height - sourceSize = Qt.size(width,height) + img_back.updateLayout() source = FluTools.getUrlByFilePath(FluTheme.desktopImagePath) } + Connections{ + target: window + function onScreenChanged(){ + img_back.updateLayout() + } + } + function updateLayout(){ + var geometry = FluTools.desktopAvailableGeometry(window) + img_back.width = geometry.width + img_back.height = geometry.height + img_back.sourceSize = Qt.size(img_back.width,img_back.height) + } Connections{ target: FluTheme function onDesktopImagePathChanged(){ @@ -157,7 +166,7 @@ Window { blurRadius: 64 visible: window.active && FluTheme.blurBehindWindowEnabled tintColor: FluTheme.dark ? Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1) - targetRect: Qt.rect(window.x,window.y,window.width,window.height) + targetRect: Qt.rect(window.x-window.screen.virtualX,window.y-window.screen.virtualY,window.width,window.height) } } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml index 0973a266..0401b858 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml @@ -121,12 +121,21 @@ Window { fillMode: Image.PreserveAspectCrop asynchronous: true Component.onCompleted: { - var geometry = FluTools.desktopAvailableGeometry(window) - width = geometry.width - height = geometry.height - sourceSize = Qt.size(width,height) + img_back.updateLayout() source = FluTools.getUrlByFilePath(FluTheme.desktopImagePath) } + Connections{ + target: window + function onScreenChanged(){ + img_back.updateLayout() + } + } + function updateLayout(){ + var geometry = FluTools.desktopAvailableGeometry(window) + img_back.width = geometry.width + img_back.height = geometry.height + img_back.sourceSize = Qt.size(img_back.width,img_back.height) + } Connections{ target: FluTheme function onDesktopImagePathChanged(){ @@ -156,7 +165,7 @@ Window { blurRadius: 64 visible: window.active && FluTheme.blurBehindWindowEnabled tintColor: FluTheme.dark ? Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1) - targetRect: Qt.rect(window.x,window.y,window.width,window.height) + targetRect: Qt.rect(window.x-window.screen.virtualX,window.y-window.screen.virtualY,window.width,window.height) } } }