當前位置: 首頁>>代碼示例>>Python>>正文


Python QPen.setBrush方法代碼示例

本文整理匯總了Python中PySide.QtGui.QPen.setBrush方法的典型用法代碼示例。如果您正苦於以下問題:Python QPen.setBrush方法的具體用法?Python QPen.setBrush怎麽用?Python QPen.setBrush使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PySide.QtGui.QPen的用法示例。


在下文中一共展示了QPen.setBrush方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: p

# 需要導入模塊: from PySide.QtGui import QPen [as 別名]
# 或者: from PySide.QtGui.QPen import setBrush [as 別名]
        def p(painter, color):
            device = painter.device()
            width, height = device.width(), device.height()
            painter.setRenderHint(QPainter.Antialiasing)
            pen = QPen()
            pen.setWidth(thickness)
            if random:
                pen.setBrush(noise_brush)
            painter.setPen(pen)
            painter.setOpacity(opacity/100)

            def getpoints(x, y):
                if angle in [0, 180]:
                    return (0, y), (width, y)
                if angle in [90, 270]:
                    return (x, 0), (x, height)
                derp = max(height, width)
                deg = math.radians(angle)
                p1 = (x - derp*math.cos(deg), y + derp * math.sin(deg))
                p2 = (x+derp*math.cos(deg), y - derp * math.sin(deg))
                return p1, p2


            for pos in range(spacing+thickness, max(height, width), spacing+thickness):
                x = pos if angle < 90 else width-pos
                y = pos
                (x1, y1), (x2, y2) = getpoints(x, y)
                painter.drawLine(x1, y1, x2, y2)
            return
開發者ID:d42,項目名稱:Fourierism,代碼行數:31,代碼來源:noise_dialog.py

示例2: paint

# 需要導入模塊: from PySide.QtGui import QPen [as 別名]
# 或者: from PySide.QtGui.QPen import setBrush [as 別名]
    def paint(self, canvas, is_secondary_color=False, additional_flag=False):
        pen = QPen()
        pen.setWidth(self.data_singleton.pen_size)
        pen.setStyle(Qt.SolidLine)
        pen.setCapStyle(Qt.RoundCap)
        pen.setJoinStyle(Qt.RoundJoin)

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

        painter = QPainter(canvas.image)
        painter.setPen(pen)

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

        if self._start_point == self._end_point:
            painter.drawPoint(self._start_point)

        painter.end()

        canvas.edited = True
        canvas.update()
開發者ID:gil9red,項目名稱:fake-painter,代碼行數:27,代碼來源:pencilinstrument.py

示例3: default_roi_pen

# 需要導入模塊: from PySide.QtGui import QPen [as 別名]
# 或者: from PySide.QtGui.QPen import setBrush [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

示例4: drawWidget

# 需要導入模塊: from PySide.QtGui import QPen [as 別名]
# 或者: from PySide.QtGui.QPen import setBrush [as 別名]
    def drawWidget(self, qp):
        size = self.size()
        radx = size.width()
        rady = size.height()
        dot = min(radx, rady) / 2

        pen = QPen()
        pen.setWidth(dot)
        # pen.setStyle(Qt.SolidLine)
        pen.setBrush(self.color)
        # pen.setCapStyle(Qt.RoundCap)
        # pen.setJoinStyle(Qt.RoundJoin)
        qp.setPen(pen)

        qp.drawLine(dot, dot, dot, dot)
開發者ID:FredericLanglois,項目名稱:SeaGoatVision,代碼行數:17,代碼來源:WinViewer.py

示例5: draw_uvs

# 需要導入模塊: from PySide.QtGui import QPen [as 別名]
# 或者: from PySide.QtGui.QPen import setBrush [as 別名]
 def draw_uvs(self):
     self.img = QPixmap(QSize(self.w, self.h))
     pen = QPen()
     pen.setWidth(int(self.pen_w.text()))
     pen.setBrush(QBrush(Qt.white))
     pen.setColor(QColor('white'))
     painter = QPainter()
     painter.begin(self.img)
     painter.setPen(pen)
     coords = self.get_coords()
     for face in coords:
         for n in xrange(len(face) - 1):
             print face[n][0], face[n][1], face[n + 1][0], face[n + 1][1]
             painter.drawLine(face[n][0], face[n][1], face[n + 1][0], face[n + 1][1])
     painter.end()
     self.view.scene().addPixmap(self.img)
開發者ID:Schlechtwetterfront,項目名稱:mshsuite,代碼行數:18,代碼來源:model_dialogs.py


注:本文中的PySide.QtGui.QPen.setBrush方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。