本文整理匯總了Python中PySide2.QtGui.QPainterPath方法的典型用法代碼示例。如果您正苦於以下問題:Python QtGui.QPainterPath方法的具體用法?Python QtGui.QPainterPath怎麽用?Python QtGui.QPainterPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PySide2.QtGui
的用法示例。
在下文中一共展示了QtGui.QPainterPath方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: paintEvent
# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPainterPath [as 別名]
def paintEvent(self, event):
super(CircularBrush, self).paintEvent(event)
# draw brush
if hasattr(self, 'brush_state') and self.brush_state.draw:
painter = QPainter()
shapes = self.create_brush_shape()
for shape in shapes:
shape = [QPointF(point[0], point[1]) for point in shape]
path = QPainterPath()
start_pos = shape.pop(0)
path.moveTo(start_pos)
[path.lineTo(point) for point in shape]
painter.setRenderHint(painter.Antialiasing)
# painter.setRenderHint(painter.HighQualityAnti)
painter.begin(self)
painter.setPen(QPen(Qt.red, 1))
painter.drawPath(path)
painter.end()
示例2: __init__
# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPainterPath [as 別名]
def __init__(self, name=None):
pen = QtGui.QPen(QtCore.Qt.SolidLine)
pen.setColor(QtGui.QColor(0, 0, 0, 255))
pen.setWidthF(0.2)
pen.setJoinStyle(QtCore.Qt.MiterJoin)
self.pen = pen
self.brush = QtGui.QBrush(QtGui.QColor(255, 255, 0, 255))
self.font = QtGui.QFont('Decorative', 12)
self.rect = QtCore.QRectF()
self.shape = QtGui.QPainterPath()
self.path = QtGui.QPainterPath()
self.scale = (1, 1)
self.tooltip = ''
self.method = ''
self.args = []
示例3: _make_path
# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPainterPath [as 別名]
def _make_path(self):
if len(self.coords) < 3:
return super()._make_path()
# raise ValueError("At least 3 coordinates are required.") # programming error - don't use this class for a simple segment!
path = QPainterPath(self.coords[0])
for i in range(len(self.coords) - 1):
pt0 = self._get_line_start(i)
if i == 0:
path.lineTo(pt0)
else:
path.quadTo(self.coords[i], pt0)
pt1 = self._get_line_end(i)
path.lineTo(pt1)
path.lineTo(self.coords[-1])
return path
示例4: get_center_path
# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPainterPath [as 別名]
def get_center_path(point):
ext = 12
int_ = 5
path = QtGui.QPainterPath(point)
path.moveTo(QtCore.QPoint(point.x() - ext, point.y()))
path.lineTo(QtCore.QPoint(point.x() - int_, point.y()))
path.moveTo(QtCore.QPoint(point.x() + int_, point.y()))
path.lineTo(QtCore.QPoint(point.x() + ext, point.y()))
path.moveTo(QtCore.QPoint(point.x(), point.y() - ext))
path.lineTo(QtCore.QPoint(point.x(), point.y() - int_))
path.moveTo(QtCore.QPoint(point.x(), point.y() + int_))
path.lineTo(QtCore.QPoint(point.x(), point.y() + ext))
path.addEllipse(point, 1, 1)
return path
示例5: get_hovered_path
# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPainterPath [as 別名]
def get_hovered_path(rect):
path = QtGui.QPainterPath()
path.addRect(rect)
path.addRect(grow_rect(rect, MANIPULATOR_BORDER))
return path
示例6: __init__
# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPainterPath [as 別名]
def __init__(self, workspace, func_addr, disasm_view, disasm, infodock, addr, cfg_nodes, out_branches, scene,
parent=None, container=None):
super().__init__(parent=parent, container=container)
# initialization
self.workspace = workspace
self.func_addr = func_addr
self.disasm_view = disasm_view
self.disasm = disasm
self.infodock = infodock
self.variable_manager = infodock.variable_manager
self.addr = addr
self.cfg_nodes = cfg_nodes
self.out_branches = out_branches
self.scene = scene
self._config = Conf
self.objects = [ ] # instructions and labels
self._block_item = None # type: QPainterPath
self._block_item_obj = None # type: QGraphicsPathItem
self.addr_to_insns = { }
self.addr_to_labels = { }
self._init_widgets()
self._objects_are_hidden = False
self._create_block_item()
self.setAcceptHoverEvents(True)
#
# Properties
#
示例7: _create_block_item
# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPainterPath [as 別名]
def _create_block_item(self):
"""
Create the block background and border.
"""
if self._block_item_obj is not None and self.scene is not None:
self.scene.removeItem(self._block_item_obj)
self._block_item = None
self._block_item_obj = None
self._block_item = QPainterPath()
self._block_item.addRect(0, 0, self.width, self.height)
示例8: _hasMask
# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPainterPath [as 別名]
def _hasMask(self):
return isinstance(self.mask, DisplayObject) and hasattr(self.mask, "_clipPath") and isinstance(self.mask._clipPath, QtGui.QPainterPath)
示例9: __init__
# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPainterPath [as 別名]
def __init__(self):
super(Graphics, self).__init__()
self.__drawingList = []
self.__dataList = []
self.__currentGraphics = None
self._clipPath = QtGui.QPainterPath()
示例10: clear
# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPainterPath [as 別名]
def clear(self):
self.__drawingList = []
self.__dataList = []
self.__currentGraphics = None
del self._clipPath
self._clipPath = QtGui.QPainterPath()
示例11: beginFill
# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPainterPath [as 別名]
def beginFill(self, color = "transparent", alpha = 1):
if color == "transparent":
alpha = 0
self.__currentGraphics = {
"path" : QtGui.QPainterPath(),
"lineAlpha" : 255,
"lineWidth" : None,
"lineColor" : None,
"fillColor" : color,
"fillAlpha" : 255 * alpha,
"joins" : None,
"caps" : None,
"miterLimit" : None
}