本文整理汇总了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)