This commit is contained in:
朱子楚\zhuzi 2024-04-13 22:00:15 +08:00
parent e8c47e0fd8
commit 2c4cf82f63
5 changed files with 12 additions and 6 deletions

View File

@ -13,7 +13,7 @@ FluScrollablePage{
FluFrame{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 420 Layout.preferredHeight: 408
padding: 10 padding: 10
ColumnLayout{ ColumnLayout{

View File

@ -25,7 +25,7 @@ FluTheme::FluTheme(QObject *parent) : QObject{parent} {
_blurBehindWindowEnabled = false; _blurBehindWindowEnabled = false;
QGuiApplication::instance()->installEventFilter(this); QGuiApplication::instance()->installEventFilter(this);
refreshColors(); refreshColors();
updateDesktopImage(); checkUpdateDesktopImage();
connect(this, &FluTheme::darkModeChanged, this, [=] { connect(this, &FluTheme::darkModeChanged, this, [=] {
Q_EMIT darkChanged(); Q_EMIT darkChanged();
}); });
@ -49,7 +49,7 @@ void FluTheme::refreshColors() {
fontTertiaryColor(isDark ? QColor(200, 200, 200, 255) : QColor(153, 153, 153, 255)); fontTertiaryColor(isDark ? QColor(200, 200, 200, 255) : QColor(153, 153, 153, 255));
itemNormalColor(isDark ? QColor(255, 255, 255, 0) : QColor(0, 0, 0, 0)); 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))); 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))); 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))); 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))); 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([=]() { QThreadPool::globalInstance()->start([=]() {
_mutex.lock(); _mutex.lock();
auto path = FluTools::getInstance()->getWallpaperFilePath(); auto path = FluTools::getInstance()->getWallpaperFilePath();
@ -108,5 +108,7 @@ void FluTheme::updateDesktopImage(){
void FluTheme::timerEvent(QTimerEvent *event) void FluTheme::timerEvent(QTimerEvent *event)
{ {
updateDesktopImage(); if(_blurBehindWindowEnabled){
checkUpdateDesktopImage();
}
} }

View File

@ -55,7 +55,7 @@ protected:
void timerEvent(QTimerEvent *event) override; void timerEvent(QTimerEvent *event) override;
void updateDesktopImage(); void checkUpdateDesktopImage();
public: public:
SINGLETON(FluTheme) SINGLETON(FluTheme)

View File

@ -118,6 +118,8 @@ Window {
id:img_back id:img_back
visible: false visible: false
cache: false cache: false
fillMode: Image.PreserveAspectCrop
asynchronous: true
Component.onCompleted: { Component.onCompleted: {
var geometry = FluTools.desktopAvailableGeometry(window) var geometry = FluTools.desktopAvailableGeometry(window)
width = geometry.width width = geometry.width

View File

@ -117,6 +117,8 @@ Window {
id:img_back id:img_back
visible: false visible: false
cache: false cache: false
fillMode: Image.PreserveAspectCrop
asynchronous: true
Component.onCompleted: { Component.onCompleted: {
var geometry = FluTools.desktopAvailableGeometry(window) var geometry = FluTools.desktopAvailableGeometry(window)
width = geometry.width width = geometry.width