From 9eb0d043bd68603d23af7366f1126a09b0740a6d Mon Sep 17 00:00:00 2001 From: tanjing Date: Fri, 2 Feb 2024 10:57:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtooltip=E6=97=A0=E6=AF=9B?= =?UTF-8?q?=E7=8E=BB=E7=92=83=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ukui-styles/blur-helper.cpp | 14 ++++++++++---- .../qt5-config-style-ukui/ukui-config-style.cpp | 9 +++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ukui-styles/blur-helper.cpp b/ukui-styles/blur-helper.cpp index 6e4249a..fd1384b 100644 --- a/ukui-styles/blur-helper.cpp +++ b/ukui-styles/blur-helper.cpp @@ -282,8 +282,11 @@ void BlurHelper::delayUpdate(QWidget *w, bool updateBlurRegionOnly) } QPainterPath path; int radius = 8; - if(widget->property("maxRadius").isValid()) - radius = widget->property("maxRadius").toInt(); + if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) { + auto settings = UKUIStyleSettings::globalInstance(); + if(settings->keys().contains("windowRadius")) + radius = settings->get("windowRadius").toInt(); + } path.addRoundedRect(widget->rect(), radius, radius); KWindowEffects::enableBlurBehind(widget->winId(), true, path.toFillPolygon().toPolygon()); if (!updateBlurRegionOnly) @@ -294,8 +297,11 @@ void BlurHelper::delayUpdate(QWidget *w, bool updateBlurRegionOnly) if (widget->inherits("QTipLabel")) { QPainterPath path; int radius = 8; - if(widget->property("normalRadius").isValid()) - radius = widget->property("normalRadius").toInt(); + if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) { + auto settings = UKUIStyleSettings::globalInstance(); + if(settings->keys().contains("windowRadius")) + radius = settings->get("windowRadius").toInt(); + } path.addRoundedRect(widget->rect().adjusted(+4,+4,-4,-4), radius, radius); KWindowEffects::enableBlurBehind(widget->winId(), true, path.toFillPolygon().toPolygon()); if (!updateBlurRegionOnly) diff --git a/ukui-styles/qt5-config-style-ukui/ukui-config-style.cpp b/ukui-styles/qt5-config-style-ukui/ukui-config-style.cpp index 316548a..6ce9da5 100644 --- a/ukui-styles/qt5-config-style-ukui/ukui-config-style.cpp +++ b/ukui-styles/qt5-config-style-ukui/ukui-config-style.cpp @@ -947,6 +947,11 @@ void UKUIConfigStyle::polish(QWidget *widget) } } + if(!widget) + return; + + realSetWindowSurfaceFormatAlpha(widget); + if (qAppName() != "ukui-menu" || (qAppName() == "ukui-menu" && widget && widget->inherits("QMenu"))) { if (widget && widget->testAttribute(Qt::WA_TranslucentBackground) && widget->isTopLevel()) { //FIXME: @@ -976,16 +981,12 @@ void UKUIConfigStyle::polish(QWidget *widget) } } - if(!widget) - return; widget->setProperty("maxRadius", sp->radiusProperty().maxRadius); widget->setProperty("normalRadius", sp->radiusProperty().normalRadius); widget->setProperty("minRadius", sp->radiusProperty().minRadius); Style::polish(widget); - realSetWindowSurfaceFormatAlpha(widget); - m_shadow_helper->registerWidget(widget); if (qobject_cast(widget)) {