Python PySide2.QtGui.QPainterPath() Examples

The following are 12 code examples of PySide2.QtGui.QPainterPath(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PySide2.QtGui , or try the search function .
Example #1
Source File: GraphicsItemsCollection.py    From PyAero with MIT License 6 votes vote down vote up
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 = [] 
Example #2
Source File: qgraph_arrow.py    From angr-management with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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 
Example #3
Source File: canvas.py    From spore with MIT License 5 votes vote down vote up
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() 
Example #4
Source File: painting.py    From hotbox_designer with BSD 3-Clause Clear License 5 votes vote down vote up
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 
Example #5
Source File: painting.py    From hotbox_designer with BSD 3-Clause Clear License 5 votes vote down vote up
def get_hovered_path(rect):
    path = QtGui.QPainterPath()
    path.addRect(rect)
    path.addRect(grow_rect(rect, MANIPULATOR_BORDER))
    return path 
Example #6
Source File: qgraph_arrow.py    From angr-management with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def _make_path(self):
        path = QPainterPath(self.coords[0])
        for c in self.coords[1:]:
            path.lineTo(c)
        return path 
Example #7
Source File: qblock.py    From angr-management with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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
    # 
Example #8
Source File: qblock.py    From angr-management with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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) 
Example #9
Source File: display.py    From pylash_engine with MIT License 5 votes vote down vote up
def _hasMask(self):
		return isinstance(self.mask, DisplayObject) and hasattr(self.mask, "_clipPath") and isinstance(self.mask._clipPath, QtGui.QPainterPath) 
Example #10
Source File: display.py    From pylash_engine with MIT License 5 votes vote down vote up
def __init__(self):
		super(Graphics, self).__init__()
		
		self.__drawingList = []
		self.__dataList = []
		self.__currentGraphics = None
		self._clipPath = QtGui.QPainterPath() 
Example #11
Source File: display.py    From pylash_engine with MIT License 5 votes vote down vote up
def clear(self):
		self.__drawingList = []
		self.__dataList = []
		self.__currentGraphics = None
		del self._clipPath
		self._clipPath = QtGui.QPainterPath() 
Example #12
Source File: display.py    From pylash_engine with MIT License 5 votes vote down vote up
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
		}