当前位置: 首页>>代码示例>>Python>>正文


Python QPen.setJoinStyle方法代码示例

本文整理汇总了Python中PySide.QtGui.QPen.setJoinStyle方法的典型用法代码示例。如果您正苦于以下问题:Python QPen.setJoinStyle方法的具体用法?Python QPen.setJoinStyle怎么用?Python QPen.setJoinStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide.QtGui.QPen的用法示例。


在下文中一共展示了QPen.setJoinStyle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: paint

# 需要导入模块: from PySide.QtGui import QPen [as 别名]
# 或者: from PySide.QtGui.QPen import setJoinStyle [as 别名]
    def paint(self, canvas, is_secondary_color=False, additional_flag=False):
        pen = QPen()

        if is_secondary_color:
            pen.setColor(self.data_singleton.secondary_color)
        else:
            pen.setColor(self.data_singleton.primary_color)

        painter = QPainter(canvas.image)
        painter.setRenderHint(QPainter.Antialiasing)
        pen.setWidth(self.data_singleton.pen_size)
        pen.setStyle(Qt.SolidLine)
        pen.setCapStyle(Qt.RoundCap)
        pen.setJoinStyle(Qt.RoundJoin)

        painter.setPen(pen)

        if is_secondary_color:
            painter.setBrush(self.data_singleton.primary_color)
        else:
            painter.setBrush(self.data_singleton.secondary_color)

        if self._start_point != self._end_point:
            painter.drawRect(QRect(self._start_point, self._end_point))

        painter.end()

        canvas.edited = True
        canvas.update()
开发者ID:gil9red,项目名称:fake-painter,代码行数:31,代码来源:rectangleinstrument.py

示例2: default_roi_pen

# 需要导入模块: from PySide.QtGui import QPen [as 别名]
# 或者: from PySide.QtGui.QPen import setJoinStyle [as 别名]
def default_roi_pen(dashed=True,color=Qt.green):
    pen = QPen()
    if dashed:
        pen.setStyle(Qt.DashLine)
    pen.setBrush(color)
    pen.setCapStyle(Qt.RoundCap)
    pen.setJoinStyle(Qt.RoundJoin)
    return pen
开发者ID:jthacker,项目名称:arrview,代码行数:10,代码来源:settings.py

示例3: BaseObject

# 需要导入模块: from PySide.QtGui import QPen [as 别名]
# 或者: from PySide.QtGui.QPen import setJoinStyle [as 别名]
class BaseObject(QGraphicsPathItem):
    """
    Subclass of `QGraphicsPathItem`_

    TOWRITE

    """

    Type = OBJ_TYPE_BASE

    def __init__(self, parent=None):
        """
        Default class constructor.

        :param `parent`: Pointer to a parent widget instance.
        :type `parent`: `QGraphicsItem`_
        """
        super(BaseObject, self).__init__(parent)

        qDebug("BaseObject Constructor()")

        self.objPen = QPen()        # QPen objPen;
        self.lwtPen = QPen()        # QPen lwtPen;
        self.objLine = QLineF()     # QLineF objLine;
        self.objRubberMode = int()  # int objRubberMode;
        self.objRubberPoints = {}   # QHash<QString, QPointF> objRubberPoints;
        self.objRubberTexts = {}    # QHash<QString, QString> objRubberTexts;
        self.objID = int()          # qint64 objID;

        self.objPen.setCapStyle(Qt.RoundCap)
        self.objPen.setJoinStyle(Qt.RoundJoin)
        self.lwtPen.setCapStyle(Qt.RoundCap)
        self.lwtPen.setJoinStyle(Qt.RoundJoin)

        self.objID = QDateTime.currentMSecsSinceEpoch()


    def __del__(self):
        """Class destructor."""
        qDebug("BaseObject Destructor()")

    def type(self):
        """
        TOWRITE

        :return: TOWRITE
        :rtype: int
        """
        return self.Type

    def setObjectColor(self, color):
        """
        TOWRITE

        :param `color`: TOWRITE
        :type `color`: `QColor`_
        """
        self.objPen.setColor(color)
        self.lwtPen.setColor(color)

    def setObjectColorRGB(self, rgb):
        """
        TOWRITE

        :param `rgb`: TOWRITE
        :type `rgb`: `QRgb`_
        """
        self.objPen.setColor(QColor(rgb))
        self.lwtPen.setColor(QColor(rgb))

    def setObjectLineType(self, lineType):
        """
        TOWRITE

        :param `rgb`: TOWRITE
        :type `rgb`: Qt.PenStyle
        """
        self.objPen.setStyle(lineType)
        self.lwtPen.setStyle(lineType)

    def setObjectLineWeight(self, lineWeight):
        """
        TOWRITE

        :param `lineWeight`: TOWRITE
        :type `lineWeight`: qreal
        """
        self.objPen.setWidthF(0)  # NOTE: The objPen will always be cosmetic

        if lineWeight < 0:
            if lineWeight == OBJ_LWT_BYLAYER:
                self.lwtPen.setWidthF(0.35)  # TODO: getLayerLineWeight
            elif lineWeight == OBJ_LWT_BYBLOCK:
                self.lwtPen.setWidthF(0.35)  # TODO: getBlockLineWeight
            else:
                QMessageBox.warning(0, QObject.tr("Error - Negative Lineweight"),
                                       QObject.tr("Lineweight: %f" % lineWeight))
                qDebug("Lineweight cannot be negative! Inverting sign.")
                self.lwtPen.setWidthF(-lineWeight)
        else:
#.........这里部分代码省略.........
开发者ID:Metallicow,项目名称:Embroidermodder,代码行数:103,代码来源:object_base.py

示例4: loadFile

# 需要导入模块: from PySide.QtGui import QPen [as 别名]
# 或者: from PySide.QtGui.QPen import setJoinStyle [as 别名]

#.........这里部分代码省略.........
                    self.mainWin.nativeAddEllipse(embEllipse_centerX(e), embEllipse_centerY(e), embEllipse_width(e), embEllipse_height(e), 0, False, OBJ_RUBBER_OFF)  # TODO: rotation and fill
                    curEllipseObj = curEllipseObj.next

            if p.lineObjList:
                curLineObj = p.lineObjList  # EmbLineObjectList*
                while curLineObj:
                    li = curLineObj.lineObj.line  # EmbLine
                    thisColor = curLineObj.lineObj.color  # EmbColor
                    self.setCurrentColor(qRgb(thisColor.r, thisColor.g, thisColor.b))
                    # NOTE: With natives, the Y+ is up and libembroidery Y+ is up, so inverting the Y is NOT needed.
                    self.mainWin.nativeAddLine(embLine_x1(li), embLine_y1(li), embLine_x2(li), embLine_y2(li), 0, OBJ_RUBBER_OFF)  # TODO: rotation
                    curLineObj = curLineObj.next

            if p.pathObjList:
                # TODO: This is unfinished. It needs more work
                curPathObjList = p.pathObjList  # EmbPathObjectList*
                while curPathObjList:
                    pathPath = QPainterPath()
                    curPointList = curPathObjList.pathObj.pointList  # EmbPointList*
                    thisColor = curPathObjList.pathObj.color  # EmbColor
                    if curPointList:
                        pp = curPointList.point  # EmbPoint
                        pathPath.moveTo(embPoint_x(pp), -embPoint_y(pp))  # NOTE: Qt Y+ is down and libembroidery Y+ is up, so inverting the Y is needed.
                        curPointList = curPointList.next

                    while curPointList:
                        pp = curPointList.point  # EmbPoint
                        pathPath.lineTo(embPoint_x(pp), -embPoint_y(pp))  # NOTE: Qt Y+ is down and libembroidery Y+ is up, so inverting the Y is needed.
                        curPointList = curPointList.next

                    loadPen = QPen(qRgb(thisColor.r, thisColor.g, thisColor.b))
                    loadPen.setWidthF(0.35)
                    loadPen.setCapStyle(Qt.RoundCap)
                    loadPen.setJoinStyle(Qt.RoundJoin)

                    obj = PathObject(0, 0, pathPath, loadPen.color().rgb())  # PathObject*
                    obj.setObjectRubberMode(OBJ_RUBBER_OFF)
                    self.gscene.addItem(obj)

                    curPathObjList = curPathObjList.next

            if p.pointObjList:
                curPointObj = p.pointObjList  # EmbPointObjectList*
                while curPointObj:
                    po = curPointObj.pointObj.point  # EmbPoint
                    thisColor = curPointObj.pointObj.color  # EmbColor
                    self.setCurrentColor(qRgb(thisColor.r, thisColor.g, thisColor.b))
                    # NOTE: With natives, the Y+ is up and libembroidery Y+ is up, so inverting the Y is NOT needed.
                    self.mainWin.nativeAddPoint(embPoint_x(po), embPoint_y(po))
                    curPointObj = curPointObj.next

            if p.polygonObjList:
                curPolygonObjList = p.polygonObjList  # EmbPolygonObjectList*
                while curPolygonObjList:
                    polygonPath = QPainterPath()
                    firstPoint = False  # bool
                    startX = 0; startY = 0  # qreal
                    x = 0; y = 0  # qreal
                    curPointList = curPolygonObjList.polygonObj.pointList  # EmbPointList*
                    thisColor = curPolygonObjList.polygonObj.color  # EmbColor
                    self.setCurrentColor(qRgb(thisColor.r, thisColor.g, thisColor.b))
                    while curPointList:
                        pp = curPointList.point  # EmbPoint
                        x = embPoint_x(pp)
                        y = -embPoint_y(pp)  # NOTE: Qt Y+ is down and libembroidery Y+ is up, so inverting the Y is needed.
开发者ID:Allen76,项目名称:Embroidermodder,代码行数:69,代码来源:mdiwindow.py


注:本文中的PySide.QtGui.QPen.setJoinStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。