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


Python QRectF.adjusted方法代码示例

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


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

示例1: setupGraphics

# 需要导入模块: from AnyQt.QtCore import QRectF [as 别名]
# 或者: from AnyQt.QtCore.QRectF import adjusted [as 别名]
    def setupGraphics(self):
        """
        Set up the graphics.
        """
        shape_rect = QRectF(-24, -24, 48, 48)

        self.shapeItem = NodeBodyItem(self)
        self.shapeItem.setShapeRect(shape_rect)
        self.shapeItem.setAnimationEnabled(self.__animationEnabled)

        # Rect for widget's 'ears'.
        anchor_rect = QRectF(-31, -31, 62, 62)
        self.inputAnchorItem = SinkAnchorItem(self)
        input_path = QPainterPath()
        start_angle = 180 - self.ANCHOR_SPAN_ANGLE / 2
        input_path.arcMoveTo(anchor_rect, start_angle)
        input_path.arcTo(anchor_rect, start_angle, self.ANCHOR_SPAN_ANGLE)
        self.inputAnchorItem.setAnchorPath(input_path)

        self.outputAnchorItem = SourceAnchorItem(self)
        output_path = QPainterPath()
        start_angle = self.ANCHOR_SPAN_ANGLE / 2
        output_path.arcMoveTo(anchor_rect, start_angle)
        output_path.arcTo(anchor_rect, start_angle, - self.ANCHOR_SPAN_ANGLE)
        self.outputAnchorItem.setAnchorPath(output_path)

        self.inputAnchorItem.hide()
        self.outputAnchorItem.hide()

        # Title caption item
        self.captionTextItem = NameTextItem(self)

        self.captionTextItem.setPlainText("")
        self.captionTextItem.setPos(0, 33)

        def iconItem(standard_pixmap):
            item = GraphicsIconItem(self, icon=standard_icon(standard_pixmap),
                                    iconSize=QSize(16, 16))
            item.hide()
            return item

        self.errorItem = iconItem(QStyle.SP_MessageBoxCritical)
        self.warningItem = iconItem(QStyle.SP_MessageBoxWarning)
        self.infoItem = iconItem(QStyle.SP_MessageBoxInformation)

        self.backgroundItem = QGraphicsPathItem(self)
        backgroundrect = QPainterPath()
        backgroundrect.addRoundedRect(anchor_rect.adjusted(-4, -2, 4, 2),
                                      5, 5, mode=Qt.AbsoluteSize)
        self.backgroundItem.setPen(QPen(Qt.NoPen))
        self.backgroundItem.setBrush(self.palette().brush(QPalette.Highlight))
        self.backgroundItem.setOpacity(0.5)
        self.backgroundItem.setPath(backgroundrect)
        self.backgroundItem.setZValue(-10)
        self.backgroundItem.setVisible(self.isSelected())

        self.prepareGeometryChange()
        self.__boundingRect = None
开发者ID:ales-erjavec,项目名称:orange-canvas,代码行数:60,代码来源:nodeitem.py

示例2: paintEvent

# 需要导入模块: from AnyQt.QtCore import QRectF [as 别名]
# 或者: from AnyQt.QtCore.QRectF import adjusted [as 别名]
 def paintEvent(self, event):
     pixmap = self._shadowPixmap
     widget_rect = QRectF(QPointF(0.0, 0.0), QSizeF(self.size()))
     frame_rect = QRectF(self.contentsRect())
     left, top, right, bottom = self.getContentsMargins()
     pixmap_rect = QRectF(QPointF(0, 0), QSizeF(pixmap.size()))
     # Shadow casting rectangle.
     pixmap_shadow_rect = pixmap_rect.adjusted(left, top, -right, -bottom)
     source_rects = self._shadowPixmapFragments(pixmap_rect,
                                                pixmap_shadow_rect)
     target_rects = self._shadowPixmapFragments(widget_rect, frame_rect)
     painter = QPainter(self)
     for source, target in zip(source_rects, target_rects):
         painter.drawPixmap(target, pixmap, source)
     painter.end()
开发者ID:astaric,项目名称:orange3,代码行数:17,代码来源:dropshadow.py


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