当前位置: 首页>>代码示例>>Python>>正文


Python QPen.setWidthF方法代码示例

本文整理汇总了Python中AnyQt.QtGui.QPen.setWidthF方法的典型用法代码示例。如果您正苦于以下问题:Python QPen.setWidthF方法的具体用法?Python QPen.setWidthF怎么用?Python QPen.setWidthF使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AnyQt.QtGui.QPen的用法示例。


在下文中一共展示了QPen.setWidthF方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from AnyQt.QtGui import QPen [as 别名]
# 或者: from AnyQt.QtGui.QPen import setWidthF [as 别名]
    def __init__(self, tree_node, parent=None, **kwargs):
        self.tree_node = tree_node
        super().__init__(self._get_rect_attributes(), parent)
        self.tree_node.graphics_item = self

        self.setTransformOriginPoint(self.boundingRect().center())
        self.setRotation(degrees(self.tree_node.square.angle))

        self.setBrush(kwargs.get('brush', QColor('#297A1F')))
        # The border should be invariant to scaling
        pen = QPen(QColor(Qt.black))
        pen.setWidthF(0.75)
        pen.setCosmetic(True)
        self.setPen(pen)

        self.setAcceptHoverEvents(True)
        self.setZValue(kwargs.get('zvalue', 0))
        self.z_step = Z_STEP

        # calculate the correct z values based on the parent
        if self.tree_node.parent != TreeAdapter.ROOT_PARENT:
            p = self.tree_node.parent
            # override root z step
            num_children = len(p.children)
            own_index = [1 if c.label == self.tree_node.label else 0
                         for c in p.children].index(1)

            self.z_step = int(p.graphics_item.z_step / num_children)
            base_z = p.graphics_item.zValue()

            self.setZValue(base_z + own_index * self.z_step)
开发者ID:benzei,项目名称:orange3,代码行数:33,代码来源:pythagorastreeviewer.py

示例2: shape

# 需要导入模块: from AnyQt.QtGui import QPen [as 别名]
# 或者: from AnyQt.QtGui.QPen import setWidthF [as 别名]
 def shape(self):
     if self.__shape is None:
         path = self.curvePath()
         pen = QPen(self.pen())
         pen.setWidthF(max(pen.widthF(), 7.0))
         pen.setStyle(Qt.SolidLine)
         self.__shape = stroke_path(path, pen)
     return self.__shape
开发者ID:ales-erjavec,项目名称:orange-canvas,代码行数:10,代码来源:linkitem.py

示例3: crosshairs

# 需要导入模块: from AnyQt.QtGui import QPen [as 别名]
# 或者: from AnyQt.QtGui.QPen import setWidthF [as 别名]
def crosshairs(color, radius=24, circle=False):
    radius = max(radius, 16)
    pixmap = QPixmap(radius, radius)
    pixmap.fill(Qt.transparent)
    painter = QPainter()
    painter.begin(pixmap)
    painter.setRenderHints(QPainter.Antialiasing)
    pen = QPen(QBrush(color), 1)
    pen.setWidthF(1.5)
    painter.setPen(pen)
    if circle:
        painter.drawEllipse(2, 2, radius - 2, radius - 2)
    painter.drawLine(radius / 2, 7, radius / 2, radius / 2 - 7)
    painter.drawLine(7, radius / 2, radius / 2 - 7, radius / 2)
    painter.end()
    return pixmap
开发者ID:RachitKansal,项目名称:orange3,代码行数:18,代码来源:owpaintdata.py

示例4: __updateStyleState

# 需要导入模块: from AnyQt.QtGui import QPen [as 别名]
# 或者: from AnyQt.QtGui.QPen import setWidthF [as 别名]
    def __updateStyleState(self):
        """
        Update the arrows' brush, pen, ... based on it's state
        """
        if self.isSelected():
            color = self.__color.darker(150)
            pen = QPen(QColor(96, 158, 215), Qt.DashDotLine)
            pen.setWidthF(1.25)
            pen.setCosmetic(True)
            self.__shadow.setColor(pen.color().darker(150))
        else:
            color = self.__color
            pen = QPen(Qt.NoPen)
            self.__shadow.setColor(QColor(63, 63, 63, 180))

        self.__arrowItem.setBrush(color)
        self.__arrowItem.setPen(pen)
开发者ID:ales-erjavec,项目名称:orange3,代码行数:19,代码来源:annotationitem.py

示例5: paint

# 需要导入模块: from AnyQt.QtGui import QPen [as 别名]
# 或者: from AnyQt.QtGui.QPen import setWidthF [as 别名]
 def paint(self, painter, option, widget=None):
     # Override the default selected appearance
     if self.isSelected():
         option.state ^= QStyle.State_Selected
         rect = self.rect()
         # this must render before overlay due to order in which it's drawn
         super().paint(painter, option, widget)
         painter.save()
         pen = QPen(QColor(Qt.black))
         pen.setWidthF(2)
         pen.setCosmetic(True)
         pen.setJoinStyle(Qt.MiterJoin)
         painter.setPen(pen)
         painter.drawRect(rect)
         painter.restore()
     else:
         super().paint(painter, option, widget)
开发者ID:benzei,项目名称:orange3,代码行数:19,代码来源:pythagorastreeviewer.py

示例6: hoverEnterEvent

# 需要导入模块: from AnyQt.QtGui import QPen [as 别名]
# 或者: from AnyQt.QtGui.QPen import setWidthF [as 别名]
 def hoverEnterEvent(self, event):
     pen = QPen(self.pen())
     pen.setWidthF(3)
     self.setPen(pen)
     return RugItem.hoverEnterEvent(self, event)
开发者ID:JakaKokosar,项目名称:orange-bio,代码行数:7,代码来源:OWQualityControl.py


注:本文中的AnyQt.QtGui.QPen.setWidthF方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。