修复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;
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)

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 (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<QTabWidget*>(widget)) {