From 72cd28c7278b9305a40b43462d516430014961ae Mon Sep 17 00:00:00 2001 From: ck Date: Mon, 22 Jan 2024 13:34:46 +0800 Subject: [PATCH] chore: check platformtheme is valid when set menu windowradius if theme is not valid the windowradius is invalid too --- styleplugins/chameleon/chameleonstyle.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/styleplugins/chameleon/chameleonstyle.cpp b/styleplugins/chameleon/chameleonstyle.cpp index 6814613a..8339585e 100644 --- a/styleplugins/chameleon/chameleonstyle.cpp +++ b/styleplugins/chameleon/chameleonstyle.cpp @@ -4354,11 +4354,13 @@ void ChameleonStyle::polish(QWidget *w) handle.setEnableBlurWindow(true); DPlatformTheme *theme = DGuiApplicationHelper::instance()->applicationTheme(); - setWindowRadius(w, qMax(0, qMin(theme->windowRadius(), 18))); + if (theme->isValid()) { + setWindowRadius(w, qMax(0, qMin(theme->windowRadius(), 18))); + connect(theme, &DPlatformTheme::windowRadiusChanged, w, [w](int r){ + setWindowRadius(w, qMax(0, qMin(r, 18))); + }); + } - connect(theme, &DPlatformTheme::windowRadiusChanged, w, [w](int r){ - setWindowRadius(w, qMax(0, qMin(r, 18))); - }); w->setAttribute(Qt::WA_TranslucentBackground); connect(DWindowManagerHelper::instance(), SIGNAL(hasCompositeChanged()), w, SLOT(update())); }