Use Qt::MitterJoin when drawing rectangle

As it's not the default. Otherwise there's artifacts with hdpi scaling
This commit is contained in:
Sergio Martins
2020-09-29 13:38:44 +01:00
parent 991075d69e
commit c56f998292
2 changed files with 8 additions and 6 deletions

View File

@@ -80,15 +80,16 @@ void FrameWidget::paintEvent(QPaintEvent *)
const qreal halfPenWidth = penWidth / 2;
const QRectF rectf = QWidget::rect();
const QColor penColor = isOverlayed() ? QColor(0x666666)
: QColor(184, 184, 184, 184);
QPen pen(penColor);
pen.setWidthF(penWidth);
p.setPen(pen);
if (isOverlayed()) {
QPen pen(0x666666);
pen.setWidthF(penWidth);
p.setPen(pen);
pen.setJoinStyle(Qt::MiterJoin);
p.drawRect(rectf.adjusted(halfPenWidth, penWidth, -halfPenWidth, -halfPenWidth));
} else {
QPen pen(QColor(184, 184, 184, 184));
pen.setWidthF(penWidth);
p.setPen(pen);
p.drawRoundedRect(rectf.adjusted(halfPenWidth, halfPenWidth, -halfPenWidth, -halfPenWidth), 2, 2);
}
}