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


Python QtGui.QPen方法代碼示例

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


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

示例1: paintEvent

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPen [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() 
開發者ID:wiremas,項目名稱:spore,代碼行數:26,代碼來源:canvas.py

示例2: draw_editor

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPen [as 別名]
def draw_editor(painter, rect, snap=None):
    # draw border
    pen = QtGui.QPen(QtGui.QColor('#333333'))
    pen.setStyle(QtCore.Qt.DashDotLine)
    pen.setWidth(3)
    brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 25))
    painter.setPen(pen)
    painter.setBrush(brush)
    painter.drawRect(rect)

    if snap is None:
        return
    # draw snap grid
    pen = QtGui.QPen(QtGui.QColor('red'))
    painter.setPen(pen)
    x = 0
    y = 0
    while y < rect.bottom():
        painter.drawPoint(x, y)
        x += snap[0]
        if x > rect.right():
            x = 0
            y += snap[1] 
開發者ID:luckylyk,項目名稱:hotbox_designer,代碼行數:25,代碼來源:painting.py

示例3: __init__

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPen [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 = [] 
開發者ID:chiefenne,項目名稱:PyAero,代碼行數:22,代碼來源:GraphicsItemsCollection.py

示例4: __init__

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPen [as 別名]
def __init__(self, *args, **kwargs):

        super().__init__(*args, **kwargs)

        self.view = args[1]

        # set pen and brush (filling)
        self.pen = QtGui.QPen()
        self.pen.setStyle(QtCore.Qt.DotLine)
        self.pen.setColor(QtGui.QColor(80, 80, 100))
        self.brush = QtGui.QBrush()
        color = QtGui.QColor(20, 20, 80, 30)
        self.brush.setColor(color)
        # self.brush.setStyle(QtCore.Qt.NoBrush)
        self.brush.setStyle(QtCore.Qt.SolidPattern)

        # set style selectively for the rubberband like that
        # see: http://stackoverflow.com/questions/25642618
        # required as opacity might not work
        # NOTE: opacity removed here
        self.setStyle(QtWidgets.QStyleFactory.create('windowsvista'))

        # set boolean for allowing zoom
        self.allow_zoom = False 
開發者ID:chiefenne,項目名稱:PyAero,代碼行數:26,代碼來源:GraphicsView.py

示例5: paint

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPen [as 別名]
def paint(self, painter, option, widget):
        lod = option.levelOfDetailFromTransform(painter.worldTransform())
        should_highlight = self._should_highlight()

        if should_highlight:
            pen = QPen(QColor(0, 0xfe, 0xfe), 2, self.style)
        else:
            pen = QPen(self.color, 2, self.style)
        painter.setPen(pen)

        painter.drawPath(self.path)

        # arrow
        if lod < 0.3:
            return

        # arrow
        if should_highlight:
            brush = QBrush(QColor(0, 0xfe, 0xfe))
        else:
            brush = QBrush(self.color)
        painter.setBrush(brush)
        painter.drawPolygon(self.arrow) 
開發者ID:angr,項目名稱:angr-management,代碼行數:25,代碼來源:qgraph_arrow.py

示例6: paint

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPen [as 別名]
def paint(self, painter, option, widget):  # pylint: disable=unused-argument
        lod = option.levelOfDetailFromTransform(painter.worldTransform())
        should_omit_text = lod < QGraphBlock.MINIMUM_DETAIL_LEVEL

        # background of the node
        painter.setBrush(self._calc_backcolor(should_omit_text))
        if self.infodock.is_block_selected(self.addr):
            painter.setPen(QPen(self._config.disasm_view_selected_node_border_color, 2.5))
        else:
            painter.setPen(QPen(self._config.disasm_view_node_border_color, 1.5))
        self._block_item_obj = painter.drawPath(self._block_item)

        # content drawing is handled by qt since children are actual child widgets

        # if we are too far zoomed out, do not draw the text
        if self._objects_are_hidden != should_omit_text:
            for obj in self.objects:
                obj.setVisible(not should_omit_text)
                obj.setEnabled(not should_omit_text)
            self._objects_are_hidden = should_omit_text

        # extra content
        self.workspace.plugins.draw_block(self, painter) 
開發者ID:angr,項目名稱:angr-management,代碼行數:25,代碼來源:qblock.py

示例7: _show_trace_func

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPen [as 別名]
def _show_trace_func(self, show_func_tag):
        x = self.TRACE_FUNC_X
        y = self.TRACE_FUNC_Y
        prev_name = None
        for position in self.trace.trace_func:
            bbl_addr = position.bbl_addr
            func_name = position.func_name
            l.debug('Draw function %x, %s', bbl_addr, func_name)
            color = self.trace.get_func_color(func_name)
            self.trace_func.addToGroup(self.scene.addRect(x, y,
                                                          self.TRACE_FUNC_WIDTH, self.trace_func_unit_height,
                                                          QPen(color), QBrush(color)))
            if show_func_tag is True and func_name != prev_name:
                tag = self.scene.addText(func_name, QFont("Source Code Pro", 7))
                tag.setPos(x + self.TRACE_FUNC_WIDTH +
                           self.TAG_SPACING, y -
                           tag.boundingRect().height() // 2)
                self.trace_func.addToGroup(tag)
                anchor = self.scene.addLine(
                    self.TRACE_FUNC_X + self.TRACE_FUNC_WIDTH, y,
                    x + self.TRACE_FUNC_WIDTH + self.TAG_SPACING, y)
                self.trace_func.addToGroup(anchor)
                prev_name = func_name
            y += self.trace_func_unit_height 
開發者ID:angr,項目名稱:angr-management,代碼行數:26,代碼來源:qtrace_viewer.py

示例8: _loopDraw

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPen [as 別名]
def _loopDraw(self, c):
		font = self.__getFont()
		flags = QtCore.Qt.AlignCenter
		startX = self.__getTextStartX()
		startY = self.__getTextStartY()
		width = self._getOriginalWidth()
		height = self._getOriginalHeight()

		pen = QtGui.QPen()
		pen.setBrush(QtGui.QBrush(getColor(self.textColor)))

		if self.backgroundColor:
			brush = QtGui.QBrush()
			brush.setColor(getColor(self.backgroundColor))
			brush.setStyle(QtCore.Qt.SolidPattern)
			c.setBrush(brush)

			c.setPen(getColor("transparent"))

			c.drawRect(startX, startY, width, height)

		c.setFont(font)
		c.setPen(pen)
		c.drawText(startX, startY, width, height, flags, str(self.text)) 
開發者ID:yuehaowang,項目名稱:pylash_engine,代碼行數:26,代碼來源:display.py

示例9: paintEvent

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPen [as 別名]
def paintEvent(self, event):
        painter = QPainter()
        painter.setRenderHint(painter.Antialiasing)
        #  painter.setRenderHint(painter.HighQualityAnti)

        painter.begin(self)

        print 'paint something', event
        #  path = QPainterPath()
        painter.setPen(QPen(Qt.yellow, 5))
        painter.drawEllipse(50, 50, 50, 50)



        painter.end() 
開發者ID:wiremas,項目名稱:spore,代碼行數:17,代碼來源:draw_override.py

示例10: __init__

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPen [as 別名]
def __init__(self, start_node, end_node, parent=None, scene=None):
        super().__init__(parent, scene)
        self.start_node = start_node
        self.start_node.connect_arrow(self)
        self.end_node = end_node
        self.end_node.connect_arrow(self)
        self.arrow_head = QtGui.QPolygonF()
        self.setFlag(QtWidgets.QGraphicsItem.ItemIsSelectable, True)
        self.setZValue(-1000.0)
        self.arrow_color = QtCore.Qt.black
        self.setPen(QtGui.QPen(
            self.arrow_color, 2, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin
        )) 
開發者ID:lbryio,項目名稱:torba,代碼行數:15,代碼來源:application.py

示例11: paint

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPen [as 別名]
def paint(self, painter):
        painter.setRenderHint(QtGui.QPainter.Antialiasing)

        pen = QtGui.QPen(QtGui.QColor(0, 0, 0, 0))
        pen.setWidth(0)
        pen.setJoinStyle(QtCore.Qt.MiterJoin)

        painter.setBrush(self._conicalGradient)
        painter.setPen(pen)
        painter.drawRoundedRect(
            6, 6, (self.width() - 12), (self.height() - 12),
            self.width(), self.height())

        painter.setBrush(self.palette().color(QtGui.QPalette.Background))
        painter.drawRoundedRect(
            12.5, 12.5, (self.width() - 25), (self.height() - 25),
            self.width(), self.height())

        self._horizontal_gradient.setColorAt(
            1.0, self._get_current_wheel_color())
        painter.setBrush(self._horizontal_gradient)
        painter.drawRect(self._rect)

        painter.setBrush(self._vertical_gradient)
        painter.drawRect(self._rect)

        pen.setColor(QtGui.QColor(BLACK))
        pen.setWidth(3)
        painter.setPen(pen)

        angle = math.radians(self._angle)
        painter.drawLine(
            get_point_on_line(angle, 37),
            get_point_on_line(angle, 46))

        pen.setWidth(5)
        pen.setCapStyle(QtCore.Qt.RoundCap)
        painter.setPen(pen)
        painter.drawPoint(self._color_point) 
開發者ID:luckylyk,項目名稱:hotbox_designer,代碼行數:41,代碼來源:colorwheel.py

示例12: draw_editor_center

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPen [as 別名]
def draw_editor_center(painter, rect, point):
    color = QtGui.QColor(200, 200, 200, 125)
    painter.setPen(QtGui.QPen(color))
    painter.setBrush(QtGui.QBrush(color))
    painter.drawRect(rect)

    path = get_center_path(QtCore.QPoint(*point))
    pen = QtGui.QPen(QtGui.QColor(50, 125, 255))
    pen.setWidth(2)
    painter.setPen(pen)
    painter.drawPath(path) 
開發者ID:luckylyk,項目名稱:hotbox_designer,代碼行數:13,代碼來源:painting.py

示例13: draw_selection_square

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPen [as 別名]
def draw_selection_square(painter, rect):
    bordercolor = QtGui.QColor(SELECTION_COLOR)
    backgroundcolor = QtGui.QColor(SELECTION_COLOR)
    backgroundcolor.setAlpha(85)
    painter.setPen(QtGui.QPen(bordercolor))
    painter.setBrush(QtGui.QBrush(backgroundcolor))
    painter.drawRect(rect) 
開發者ID:luckylyk,項目名稱:hotbox_designer,代碼行數:9,代碼來源:painting.py

示例14: draw_aiming_background

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPen [as 別名]
def draw_aiming_background(painter, rect):
    pen = QtGui.QPen(QtGui.QColor(0, 0, 0, 0))
    brush = QtGui.QBrush(QtGui.QColor(0, 0, 0, 1))
    painter.setPen(pen)
    painter.setBrush(brush)
    painter.drawRect(rect) 
開發者ID:luckylyk,項目名稱:hotbox_designer,代碼行數:8,代碼來源:painting.py

示例15: draw_aiming

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPen [as 別名]
def draw_aiming(painter, center, target):
    pen = QtGui.QPen(QtGui.QColor(35, 35, 35))
    pen.setWidth(3)
    painter.setPen(pen)
    painter.setBrush(QtGui.QColor(0, 0, 0, 0))
    painter.drawLine(center, target) 
開發者ID:luckylyk,項目名稱:hotbox_designer,代碼行數:8,代碼來源:painting.py


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