BUG163671,fix the drawing method of tooltips border

This commit is contained in:
xibowen 2023-05-04 16:15:24 +08:00
parent fa32b7659e
commit ad140868a0
2 changed files with 12 additions and 13 deletions

View File

@ -288,7 +288,7 @@ void BlurHelper::delayUpdate(QWidget *w, bool updateBlurRegionOnly)
if (widget->inherits("QTipLabel")) {
QPainterPath path;
path.addRoundedRect(widget->rect().adjusted(+3,+3,-3,-3), 6, 6);
path.addRoundedRect(widget->rect().adjusted(+4,+4,-4,-4), 6, 6);
KWindowEffects::enableBlurBehind(widget->winId(), true, path.toFillPolygon().toPolygon());
if (!updateBlurRegionOnly)
widget->update();

View File

@ -1043,9 +1043,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
pixmapPainter2.setPen(Qt::transparent);
pixmapPainter2.setBrush(Qt::transparent);
pixmapPainter2.drawPath(rectPath);
// Shadow rendering
painter->drawPixmap(option->rect, pixmap, pixmap.rect());
pixmapPainter2.end();
//This is the beginning of drawing the bottom of the prompt box
auto color = sp->toolTipParameters.toolTipBackgroundBrush.color();
@ -1066,14 +1064,6 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
color.setAlphaF(1);
}
opt.palette.setColor(QPalette::ToolTipBase, color);
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
QPen pen(opt.palette.toolTipBase().color().darker(150), 1);
pen.setCapStyle(Qt::RoundCap);
pen.setJoinStyle(Qt::RoundJoin);
painter->setPen(Qt::transparent);
painter->setBrush(color);
QPainterPath path;
auto region = widget->mask();
if (region.isEmpty()) {
@ -1082,7 +1072,16 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO
path.addRegion(region);
}
painter->drawPath(path);
//draw blur background
QPainter pixmapPainter3(&pixmap);
pixmapPainter3.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
pixmapPainter3.setPen(Qt::transparent);
pixmapPainter3.setBrush(color);
pixmapPainter3.drawPath(path);
pixmapPainter3.end();
painter->drawPixmap(option->rect, pixmap, pixmap.rect());
painter->restore();
return;
}