From b3f4ae60f6cff8b14a07fae376fdcf185fa2b942 Mon Sep 17 00:00:00 2001 From: Nikita Zlobin Date: Tue, 15 Aug 2017 00:06:45 +0500 Subject: [PATCH] Fine-tuned box coordinates, depending on line width Necessary for classic theme. Now it will look like in latest patchage/ingen series. --- src/patchcanvas.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/patchcanvas.py b/src/patchcanvas.py index f3bbdf3..61431c0 100644 --- a/src/patchcanvas.py +++ b/src/patchcanvas.py @@ -2454,6 +2454,7 @@ class CanvasBox(QGraphicsItem): def paint(self, painter, option, widget): painter.save() + line_width = canvas.theme.box_pen.widthF() # Draw rectangle if self.isSelected(): @@ -2469,22 +2470,22 @@ class CanvasBox(QGraphicsItem): else: painter.setBrush(canvas.theme.box_bg_1) - painter.drawRoundedRect(QRectF(0.5, 0.5, self.p_width-1, self.p_height-1), canvas.theme.box_rounding, canvas.theme.box_rounding) + painter.drawRoundedRect(QRectF(line_width/2, line_width/2, self.p_width-line_width, self.p_height-line_width), canvas.theme.box_rounding, canvas.theme.box_rounding) # Draw pixmap header if canvas.theme.box_header_pixmap: painter.setPen(Qt.NoPen) painter.setBrush(canvas.theme.box_bg_2) - painter.drawRoundedRect(QRectF(1, 1, self.p_width-2, canvas.theme.box_header_height), canvas.theme.box_rounding-0.5, canvas.theme.box_rounding-0.5) + painter.drawRoundedRect(QRectF(line_width, line_width, self.p_width-line_width*2, canvas.theme.box_header_height), canvas.theme.box_rounding-0.5, canvas.theme.box_rounding-0.5) # Including pixmap clip path clipPath = QPainterPath() - clipPath.addRoundedRect(QRectF(1+1, 1+1, self.p_width-2-2, canvas.theme.box_header_height-2), canvas.theme.box_rounding-1.5, canvas.theme.box_rounding-1.5) + clipPath.addRoundedRect(QRectF(line_width+1, line_width+1, self.p_width-2-line_width*2, canvas.theme.box_header_height-2), canvas.theme.box_rounding-1.5, canvas.theme.box_rounding-1.5) painter.setClipPath(clipPath) painter.setClipping(True) headerPos = QPointF(1, 1) - headerRect = QRectF(2, 2, self.p_width-4, canvas.theme.box_header_height-3) + headerRect = QRectF(line_width+1, line_width+1, self.p_width-2-line_width*2, canvas.theme.box_header_height-2-line_width) painter.drawTiledPixmap(headerRect, canvas.theme.box_header_pixmap, headerPos) painter.setClipping(False)