Пример #1
0
    def paint(self, painter, option, widget):
        """Draws the collapsed group"""
        del option      # unused argument
        del widget      # unused argument

        settings = self.canvas.settings

        # Group rectangle
        if self.isSelected():
            selectPen = QPen(settings.selectColor)
            selectPen.setWidth(settings.selectPenWidth)
            selectPen.setJoinStyle(Qt.RoundJoin)
            painter.setPen(selectPen)
        else:
            pen = QPen(self.__borderColor)
            if self.highlight:
                pen.setStyle(Qt.SolidLine)
            else:
                pen.setStyle(Qt.DotLine)
            pen.setWidth(1)
            painter.setPen(pen)
        brush = QBrush(self.__bgColor)
        painter.setBrush(brush)

        fullWidth = self.groupWidth + 2 * settings.openGroupHSpacer
        fullHeight = self.groupHeight + 2 * settings.openGroupVSpacer
        painter.drawRoundedRect(self.baseX + settings.openGroupHSpacer,
                                self.baseY + settings.openGroupVSpacer,
                                fullWidth, fullHeight,
                                settings.openGroupVSpacer,
                                settings.openGroupVSpacer)
    def paint(self, painter, option, widget):
        """Draws a curve and then adds an arrow"""
        pen = QPen(QColor(0, 0, 0))
        pen.setWidth(2)
        pen.setStyle(Qt.DotLine)
        self.setPen(pen)

        QGraphicsPathItem.paint(self, painter, option, widget)
Пример #3
0
    def paint(self, painter, option, widget):
        """Draws the collapsed group"""
        del option      # unused argument
        del widget      # unused argument

        settings = self.canvas.settings

        # Outer rectangle
        rectWidth = self.minWidth - 2 * settings.hCellPadding
        rectHeight = self.minHeight - 2 * settings.vCellPadding

        if self.isSelected():
            selectPen = QPen(settings.selectColor)
            selectPen.setWidth(settings.selectPenWidth)
            selectPen.setJoinStyle(Qt.RoundJoin)
            painter.setPen(selectPen)
        else:
            pen = QPen(self.__borderColor)
            pen.setStyle(Qt.DashLine)
            pen.setWidth(1)
            painter.setPen(pen)
        brush = QBrush(self.__bgColor)
        painter.setBrush(brush)
        painter.drawRect(self.baseX + settings.hCellPadding,
                         self.baseY + settings.vCellPadding,
                         rectWidth, rectHeight)

        # Inner rectangle
        rectWidth -= 2 * settings.collapsedOutlineWidth
        rectHeight -= 2 * settings.collapsedOutlineWidth
        pen = QPen(self.__borderColor)
        pen.setStyle(Qt.DashLine)
        pen.setWidth(1)
        painter.setPen(pen)
        painter.drawRect(self.baseX + settings.hCellPadding +
                         settings.collapsedOutlineWidth,
                         self.baseY + settings.vCellPadding +
                         settings.collapsedOutlineWidth,
                         rectWidth, rectHeight)

        # Draw the text in the rectangle
        pen = QPen(self.__fgColor)
        painter.setFont(settings.monoFont)
        painter.setPen(pen)

        textWidth = self.__textRect.width() + 2 * settings.hTextPadding
        textShift = (rectWidth - textWidth) / 2
        painter.drawText(
            self.baseX + settings.hCellPadding +
            settings.hTextPadding + settings.collapsedOutlineWidth +
            textShift,
            self.baseY + settings.vCellPadding + settings.vTextPadding +
            settings.collapsedOutlineWidth,
            self.__textRect.width(), self.__textRect.height(),
            Qt.AlignLeft, self._getText())
Пример #4
0
    def paint(self, painter, option, widget):
        """Paints the control"""
        settings = self.ref.canvas.settings

        pen = QPen(settings.groupControlBorderColor)
        pen.setStyle(Qt.SolidLine)
        pen.setWidth(1)
        painter.setPen(pen)

        brush = QBrush(settings.groupControlBGColor)
        painter.setBrush(brush)

        painter.drawRoundedRect(self.x(), self.y(), self.__width,
                                self.__height, 1, 1)
Пример #5
0
    def paint(self, painter, option, widget):
        """Paints the connector"""
        color = self.__settings.lineColor
        if self.penColor:
            color = self.penColor
        width = self.__settings.lineWidth
        if self.penWidth:
            width = self.penWidth

        pen = QPen(color)
        pen.setWidth(width)
        pen.setCapStyle(Qt.FlatCap)
        pen.setJoinStyle(Qt.RoundJoin)
        if self.penStyle:
            pen.setStyle(self.penStyle)
        self.setPen(pen)
        QGraphicsPathItem.paint(self, painter, option, widget)
Пример #6
0
    def paint(self, painter, option, widget):
        """Paints the line item"""
        color = self.canvas.settings.cfLineColor
        if self.penColor:
            color = self.penColor
        width = self.canvas.settings.cfLineWidth
        if self.penWidth:
            width = self.penWidth

        pen = QPen(color)
        pen.setWidth(width)
        pen.setCapStyle(Qt.FlatCap)
        pen.setJoinStyle(Qt.RoundJoin)
        if self.penStyle:
            pen.setStyle(self.penStyle)
        self.setPen(pen)

        QGraphicsLineItem.paint(self, painter, option, widget)