修复tooltip无毛玻璃的问题

This commit is contained in:
tanjing 2024-02-02 10:57:05 +08:00
parent c61ccd054b
commit 9eb0d043bd
2 changed files with 15 additions and 8 deletions

View File

@ -282,8 +282,11 @@ void BlurHelper::delayUpdate(QWidget *w, bool updateBlurRegionOnly)
} }
QPainterPath path; QPainterPath path;
int radius = 8; int radius = 8;
if(widget->property("maxRadius").isValid()) if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) {
radius = widget->property("maxRadius").toInt(); auto settings = UKUIStyleSettings::globalInstance();
if(settings->keys().contains("windowRadius"))
radius = settings->get("windowRadius").toInt();
}
path.addRoundedRect(widget->rect(), radius, radius); path.addRoundedRect(widget->rect(), radius, radius);
KWindowEffects::enableBlurBehind(widget->winId(), true, path.toFillPolygon().toPolygon()); KWindowEffects::enableBlurBehind(widget->winId(), true, path.toFillPolygon().toPolygon());
if (!updateBlurRegionOnly) if (!updateBlurRegionOnly)
@ -294,8 +297,11 @@ void BlurHelper::delayUpdate(QWidget *w, bool updateBlurRegionOnly)
if (widget->inherits("QTipLabel")) { if (widget->inherits("QTipLabel")) {
QPainterPath path; QPainterPath path;
int radius = 8; int radius = 8;
if(widget->property("normalRadius").isValid()) if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) {
radius = widget->property("normalRadius").toInt(); 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); path.addRoundedRect(widget->rect().adjusted(+4,+4,-4,-4), radius, radius);
KWindowEffects::enableBlurBehind(widget->winId(), true, path.toFillPolygon().toPolygon()); KWindowEffects::enableBlurBehind(widget->winId(), true, path.toFillPolygon().toPolygon());
if (!updateBlurRegionOnly) if (!updateBlurRegionOnly)

View File

@ -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 (qAppName() != "ukui-menu" || (qAppName() == "ukui-menu" && widget && widget->inherits("QMenu"))) {
if (widget && widget->testAttribute(Qt::WA_TranslucentBackground) && widget->isTopLevel()) { if (widget && widget->testAttribute(Qt::WA_TranslucentBackground) && widget->isTopLevel()) {
//FIXME: //FIXME:
@ -976,16 +981,12 @@ void UKUIConfigStyle::polish(QWidget *widget)
} }
} }
if(!widget)
return;
widget->setProperty("maxRadius", sp->radiusProperty().maxRadius); widget->setProperty("maxRadius", sp->radiusProperty().maxRadius);
widget->setProperty("normalRadius", sp->radiusProperty().normalRadius); widget->setProperty("normalRadius", sp->radiusProperty().normalRadius);
widget->setProperty("minRadius", sp->radiusProperty().minRadius); widget->setProperty("minRadius", sp->radiusProperty().minRadius);
Style::polish(widget); Style::polish(widget);
realSetWindowSurfaceFormatAlpha(widget);
m_shadow_helper->registerWidget(widget); m_shadow_helper->registerWidget(widget);
if (qobject_cast<QTabWidget*>(widget)) { if (qobject_cast<QTabWidget*>(widget)) {