Browse Source

Fine-tuned box coordinates, depending on line width

Necessary for classic theme. Now it will look like in latest patchage/ingen series.
pull/170/head
Nikita Zlobin 8 years ago
parent
commit
b3f4ae60f6
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      src/patchcanvas.py

+ 5
- 4
src/patchcanvas.py View File

@@ -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)


Loading…
Cancel
Save