forked from openkylin/qt5-ukui-platformtheme
menu tooltip响应控制面板的透明度设置
This commit is contained in:
parent
b6b68dafd9
commit
f77d6bbc77
|
@ -281,7 +281,10 @@ void BlurHelper::delayUpdate(QWidget *w, bool updateBlurRegionOnly)
|
|||
break;
|
||||
}
|
||||
QPainterPath path;
|
||||
path.addRoundedRect(widget->rect().adjusted(+2,+8,-2,-8), 8, 8);
|
||||
int radius = 8;
|
||||
if(widget->property("maxRadius").isValid())
|
||||
radius = widget->property("maxRadius").toInt();
|
||||
path.addRoundedRect(widget->rect(), radius, radius);
|
||||
KWindowEffects::enableBlurBehind(widget->winId(), true, path.toFillPolygon().toPolygon());
|
||||
if (!updateBlurRegionOnly)
|
||||
widget->update();
|
||||
|
@ -290,7 +293,10 @@ void BlurHelper::delayUpdate(QWidget *w, bool updateBlurRegionOnly)
|
|||
|
||||
if (widget->inherits("QTipLabel")) {
|
||||
QPainterPath path;
|
||||
path.addRoundedRect(widget->rect().adjusted(+4,+4,-4,-4), 6, 6);
|
||||
int radius = 8;
|
||||
if(widget->property("normalRadius").isValid())
|
||||
radius = widget->property("normalRadius").toInt();
|
||||
path.addRoundedRect(widget->rect().adjusted(+4,+4,-4,-4), radius, radius);
|
||||
KWindowEffects::enableBlurBehind(widget->winId(), true, path.toFillPolygon().toPolygon());
|
||||
if (!updateBlurRegionOnly)
|
||||
widget->update();
|
||||
|
|
|
@ -3504,11 +3504,31 @@ void UKUIConfigStyleParameters::initConfigScrollBarParameters(bool isDark, const
|
|||
void UKUIConfigStyleParameters::initConfigToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget)
|
||||
{
|
||||
UKUIColorTheme::ToolTipColorCfg tooltipColorCfg = readCfg()->toolTipColorCfg(option->palette, C_ToolTip_Default);
|
||||
QBrush backgroundBrush = tooltipColorCfg.backgroundBrush;
|
||||
|
||||
QPen backgroundPen = QPen(tooltipColorCfg.backgroundPen, (tooltipColorCfg.backgroundPen.alpha() == 0 || tooltipColorCfg.backgroundPen == Qt::NoPen ) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
|
||||
//background
|
||||
backgroundBrush = option->palette.color(QPalette::Active, QPalette::ToolTipBase);
|
||||
auto color = tooltipColorCfg.backgroundBrush;
|
||||
if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) {
|
||||
auto opacity = UKUIStyleSettings::globalInstance()->get("menuTransparency").toInt()/100.0;
|
||||
color.setAlphaF(opacity);
|
||||
}
|
||||
if (qApp->property("blurEnable").isValid()) {
|
||||
bool blurEnable = qApp->property("blurEnable").toBool();
|
||||
if (!blurEnable) {
|
||||
color.setAlphaF(1);
|
||||
}
|
||||
}
|
||||
if (widget) {
|
||||
if (widget->property("useSystemStyleBlur").isValid() && !widget->property("useSystemStyleBlur").toBool()) {
|
||||
color.setAlphaF(1);
|
||||
}
|
||||
}
|
||||
//if blur effect is not supported, do not use transparent color.
|
||||
if (!KWindowEffects::isEffectAvailable(KWindowEffects::BlurBehind) || blackAppListWithBlurHelper().contains(qAppName())) {
|
||||
color.setAlphaF(1);
|
||||
}
|
||||
QBrush backgroundBrush = color;
|
||||
|
||||
int radius = m_radiusStruct.normalRadius;
|
||||
|
||||
|
@ -3653,7 +3673,6 @@ void UKUIConfigStyleParameters::initConfigMenuParameters(bool isDark, const QSty
|
|||
// QPixmap framePixmap(option->rect.size());
|
||||
UKUIColorTheme::MenuColorCfg menuColorCfg = readCfg()->menuColorCfg(C_Menu_Default);
|
||||
|
||||
QBrush menuBackgroundBrush = menuColorCfg.menuBackgroundBrush;
|
||||
QPen menuBackgroundPen = QPen(menuColorCfg.menuBackgroundPen, (menuColorCfg.menuBackgroundPen.alpha() == 0 || menuColorCfg.menuBackgroundPen == Qt::NoPen ) ?
|
||||
0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
QBrush itemSelectBrush = menuColorCfg.menuItemSelectBrush;
|
||||
|
@ -3672,6 +3691,29 @@ void UKUIConfigStyleParameters::initConfigMenuParameters(bool isDark, const QSty
|
|||
break;
|
||||
}
|
||||
|
||||
auto color = menuColorCfg.menuBackgroundBrush;
|
||||
if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) {
|
||||
auto opacity = UKUIStyleSettings::globalInstance()->get("menuTransparency").toInt()/100.0;
|
||||
color.setAlphaF(opacity);
|
||||
}
|
||||
if (qApp->property("blurEnable").isValid()) {
|
||||
bool blurEnable = qApp->property("blurEnable").toBool();
|
||||
if (!blurEnable) {
|
||||
color.setAlphaF(1);
|
||||
}
|
||||
}
|
||||
if (widget) {
|
||||
if (widget->property("useSystemStyleBlur").isValid() && !widget->property("useSystemStyleBlur").toBool()) {
|
||||
color.setAlphaF(1);
|
||||
}
|
||||
}
|
||||
//if blur effect is not supported, do not use transparent color.
|
||||
if (!KWindowEffects::isEffectAvailable(KWindowEffects::BlurBehind) || blackAppListWithBlurHelper().contains(qAppName())) {
|
||||
color.setAlphaF(1);
|
||||
}
|
||||
QBrush menuBackgroundBrush = color;
|
||||
|
||||
|
||||
if(widget){
|
||||
if (widget->property("setFrameRadius").isValid() && widget->property("setFrameRadius").canConvert<int>()) {
|
||||
frameradius = widget->property("setFrameRadius").value<int>();
|
||||
|
|
Loading…
Reference in New Issue