Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
朱子楚\zhuzi committed Apr 13, 2024
1 parent e8c47e0 commit 2c4cf82
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion example/qml/page/T_Theme.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ FluScrollablePage{

FluFrame{
Layout.fillWidth: true
Layout.preferredHeight: 420
Layout.preferredHeight: 408
padding: 10

ColumnLayout{
Expand Down
10 changes: 6 additions & 4 deletions src/FluTheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand All @@ -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)));
Expand Down Expand Up @@ -91,7 +91,7 @@ bool FluTheme::dark() const {
}
}

void FluTheme::updateDesktopImage(){
void FluTheme::checkUpdateDesktopImage(){
QThreadPool::globalInstance()->start([=]() {
_mutex.lock();
auto path = FluTools::getInstance()->getWallpaperFilePath();
Expand All @@ -108,5 +108,7 @@ void FluTheme::updateDesktopImage(){

void FluTheme::timerEvent(QTimerEvent *event)
{
updateDesktopImage();
if(_blurBehindWindowEnabled){
checkUpdateDesktopImage();
}
}
2 changes: 1 addition & 1 deletion src/FluTheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Q_PROPERTY_AUTO(bool, blurBehindWindowEnabled);

void timerEvent(QTimerEvent *event) override;

void updateDesktopImage();
void checkUpdateDesktopImage();

public:
SINGLETON(FluTheme)
Expand Down
2 changes: 2 additions & 0 deletions src/Qt5/imports/FluentUI/Controls/FluWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/Qt6/imports/FluentUI/Controls/FluWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2c4cf82

Please sign in to comment.