From 070c58397ffd63869ea4c61d553a14c0b7e6072a Mon Sep 17 00:00:00 2001 From: Nikita Zlobin Date: Sun, 3 Jun 2018 01:58:14 +0500 Subject: [PATCH] Align box border to pixel grid (antialiasing fix) Make border's outer edge aligned to pixel margin --- source/patchcanvas.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/patchcanvas.py b/source/patchcanvas.py index 53747e0a1..858ead268 100644 --- a/source/patchcanvas.py +++ b/source/patchcanvas.py @@ -2791,7 +2791,7 @@ class CanvasBox(QGraphicsItem): def paint(self, painter, option, widget): painter.save() - painter.setRenderHint(QPainter.Antialiasing, False) + painter.setRenderHint(QPainter.Antialiasing, bool(options.antialiasing == ANTIALIASING_FULL)) # Draw rectangle if self.isSelected(): @@ -2807,7 +2807,8 @@ class CanvasBox(QGraphicsItem): else: painter.setBrush(canvas.theme.box_bg_1) - painter.drawRect(0, 0, self.p_width, self.p_height) + lineHinting = painter.pen().widthF() / 2 + painter.drawRect(QRectF(lineHinting, lineHinting, self.p_width - lineHinting*2, self.p_height - lineHinting*2)) # Draw pixmap header if canvas.theme.box_header_pixmap: