From 2c4cf82f63526148ad793b6369ee83cb59bf8924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Sat, 13 Apr 2024 22:00:15 +0800 Subject: [PATCH] update --- example/qml/page/T_Theme.qml | 2 +- src/FluTheme.cpp | 10 ++++++---- src/FluTheme.h | 2 +- src/Qt5/imports/FluentUI/Controls/FluWindow.qml | 2 ++ src/Qt6/imports/FluentUI/Controls/FluWindow.qml | 2 ++ 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/example/qml/page/T_Theme.qml b/example/qml/page/T_Theme.qml index fbd255e6..c1e5f280 100644 --- a/example/qml/page/T_Theme.qml +++ b/example/qml/page/T_Theme.qml @@ -13,7 +13,7 @@ FluScrollablePage{ FluFrame{ Layout.fillWidth: true - Layout.preferredHeight: 420 + Layout.preferredHeight: 408 padding: 10 ColumnLayout{ diff --git a/src/FluTheme.cpp b/src/FluTheme.cpp index d28b7e90..84e13c57 100644 --- a/src/FluTheme.cpp +++ b/src/FluTheme.cpp @@ -25,7 +25,7 @@ FluTheme::FluTheme(QObject *parent) : QObject{parent} { _blurBehindWindowEnabled = false; QGuiApplication::instance()->installEventFilter(this); refreshColors(); - updateDesktopImage(); + checkUpdateDesktopImage(); connect(this, &FluTheme::darkModeChanged, this, [=] { Q_EMIT darkChanged(); }); @@ -49,7 +49,7 @@ void FluTheme::refreshColors() { fontTertiaryColor(isDark ? QColor(200, 200, 200, 255) : QColor(153, 153, 153, 255)); itemNormalColor(isDark ? QColor(255, 255, 255, 0) : QColor(0, 0, 0, 0)); frameColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.12)) : QColor(0, 0, 0, qRound(255 * 0.09))); - frameActiveColor(isDark ? QColor(32, 32, 32, qRound(255 * 0.8)) : QColor(255, 255, 255, qRound(255 * 0.6))); + frameActiveColor(isDark ? QColor(48, 48, 48, qRound(255 * 0.8)) : QColor(255, 255, 255, qRound(255 * 0.6))); itemHoverColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.06)) : QColor(0, 0, 0, qRound(255 * 0.03))); itemPressColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.09)) : QColor(0, 0, 0, qRound(255 * 0.06))); itemCheckColor(isDark ? QColor(255, 255, 255, qRound(255 * 0.12)) : QColor(0, 0, 0, qRound(255 * 0.09))); @@ -91,7 +91,7 @@ bool FluTheme::dark() const { } } -void FluTheme::updateDesktopImage(){ +void FluTheme::checkUpdateDesktopImage(){ QThreadPool::globalInstance()->start([=]() { _mutex.lock(); auto path = FluTools::getInstance()->getWallpaperFilePath(); @@ -108,5 +108,7 @@ void FluTheme::updateDesktopImage(){ void FluTheme::timerEvent(QTimerEvent *event) { - updateDesktopImage(); + if(_blurBehindWindowEnabled){ + checkUpdateDesktopImage(); + } } diff --git a/src/FluTheme.h b/src/FluTheme.h index a0f98814..2c6fb1a5 100644 --- a/src/FluTheme.h +++ b/src/FluTheme.h @@ -55,7 +55,7 @@ protected: void timerEvent(QTimerEvent *event) override; - void updateDesktopImage(); + void checkUpdateDesktopImage(); public: SINGLETON(FluTheme) diff --git a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml index 3be637de..a56fec54 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml @@ -118,6 +118,8 @@ Window { id:img_back visible: false cache: false + fillMode: Image.PreserveAspectCrop + asynchronous: true Component.onCompleted: { var geometry = FluTools.desktopAvailableGeometry(window) width = geometry.width diff --git a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml index 4474285a..a9b6cc2a 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml @@ -117,6 +117,8 @@ Window { id:img_back visible: false cache: false + fillMode: Image.PreserveAspectCrop + asynchronous: true Component.onCompleted: { var geometry = FluTools.desktopAvailableGeometry(window) width = geometry.width