Details
-
Bug
-
Resolution: Done
-
P4: Low
-
5.9.0 Alpha, 5.9
-
all, DPR > 1
-
b6d5026b1f8d7ed6424f9a395d47fc4c62d4751b (qtbase/5.9, 7.7.2017, 5.9.2.)
Description
QFrame with FusionStyle, WindowsStyle (and other styles), or anything that calls qDrawPlainRect() has painting artifacts in the left and top, when in scaled/HighDpi mode.
The lines are too thin, perhaps clipped. The reason seems to be the typical off-by-one of code that was written for normal resolution usinf the integer QPainter-API.
Some adjustments like the following one fix the issue. However, that needs to be thoroughly tested, especially to prevent regressions in the unscaled mode.
--- a/src/widgets/styles/qdrawutil.cpp +++ b/src/widgets/styles/qdrawutil.cpp @@ -520,10 +520,12 @@ void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &c, } QPen oldPen = p->pen(); QBrush oldBrush = p->brush(); - p->setPen(c); + QPen newPen(c); + newPen.setJoinStyle(Qt::MiterJoin); + p->setPen(newPen); p->setBrush(Qt::NoBrush); for (int i=0; i<lineWidth; i++) - p->drawRect(x+i, y+i, w-i*2 - 1, h-i*2 - 1); + p->drawRect(QRectF(x+i + 0.5, y+i + 0.5, w-i*2 - 1, h-i*2 - 1)); if (fill) { // fill with fill color p->setPen(Qt::NoPen); p->setBrush(*fill); --
Attachments
Issue Links
- relates to
-
QTBUG-58611 Qt 6: Use qreal in QtWidgets drawing/styles code
- Reported
- resulted in
-
QTBUG-61845 HighDpi: Artifacts in menus when using FusionStyle
- Closed
-
QTBUG-61849 HighDpi: Artifacts in Tooltips
- Closed