本文整理匯總了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
示例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()
示例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
示例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)
示例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)