本文整理汇总了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
示例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()