QGraphicsRectItem Class Reference

[QtGui module]

该QGraphicsRectItem类提供了一个长方形项目,你可以添加到QGraphicsSceneMore…

继承QAbstractGraphicsShapeItem

Methods

  • __init__ (self, QGraphicsItem parent = None, QGraphicsScene scene = None)
  • __init__ (self, QRectF rect, QGraphicsItem parent = None, QGraphicsScene scene = None)
  • __init__ (self, float x, float y, float w, float h, QGraphicsItem parent = None, QGraphicsScene scene = None)
  • QRectF boundingRect (self)
  • bool contains (self, QPointF point)
  • bool isObscuredBy (self, QGraphicsItem item)
  • QPainterPath opaqueArea (self)
  • paint (self, QPainter painter, QStyleOptionGraphicsItem option, QWidget widget = None)
  • QRectF rect (self)
  • setRect (self, QRectF rect)
  • setRect (self, float ax, float ay, float w, float h)
  • QPainterPath shape (self)
  • int type (self)

Detailed Description

该QGraphicsRectItem类提供了一个长方形项目,你可以添加到QGraphicsScene

要设置项目的矩形,通过一个QRectF到QGraphicsRectItem的构造函数,或致电setRect()函数。该rect( )函数返回当前矩形。

QGraphicsRectItem Class Reference - 图1

QGraphicsRectItem使用矩形和钢笔的宽度,以提供合理的实施boundingRect( )shape()和contains( ) 。该paint( )函数绘制使用该项目的相关笔触的矩形,它可以通过调用设置setPen()和setBrush()函数。

Note:无效矩形的绘制,如那些具有负宽度或高度,是不确定的。如果你不能确定你使用的是有效的矩形(例如,如果您正在使用的数据来自不可靠的源创建矩形),那么你应该使用QRectF.normalized()来创建正规化矩形,并使用这些来代替。


Method Documentation

  1. QGraphicsRectItem.__init__ (self, QGraphicsItem parent = None, QGraphicsScene scene = None)

parent的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。

scene的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。

构造一个QGraphicsRectItemparent被传递给QAbstractGraphicsShapeItem的构造。

See also QGraphicsScene.addItem( ) 。

  1. QGraphicsRectItem.__init__ (self, QRectF rect, QGraphicsItem parent = None, QGraphicsScene scene = None)

parent的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。

scene的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。

构造一个QGraphicsRectItem,使用rect作为默认的矩形。parent被传递给QAbstractGraphicsShapeItem的构造。

See also QGraphicsScene.addItem( ) 。

  1. QGraphicsRectItem.__init__ (self, float x, float y, float w, float h, QGraphicsItem parent = None, QGraphicsScene scene = None)

parent的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。

scene的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。

构造一个QGraphicsRectItem由(定义了默认的矩形xy)和给定的widthheight

parent被传递给QAbstractGraphicsShapeItem的构造。

See also QGraphicsScene.addItem( ) 。

  1. QRectF QGraphicsRectItem.boundingRect (self)

从重新实现QGraphicsItem.boundingRect( ) 。

  1. bool QGraphicsRectItem.contains (self, QPointF point)

从重新实现QGraphicsItem.contains( ) 。

  1. bool QGraphicsRectItem.isObscuredBy (self, QGraphicsItem item)

从重新实现QGraphicsItem.isObscuredBy( ) 。

  1. QPainterPath QGraphicsRectItem.opaqueArea (self)

从重新实现QGraphicsItem.opaqueArea( ) 。

  1. QGraphicsRectItem.paint (self, QPainter painter, QStyleOptionGraphicsItem option, QWidget widget = None)

从重新实现QGraphicsItem.paint( ) 。

  1. QRectF QGraphicsRectItem.rect (self)

[

返回该项目的矩形。

]($docs-qrectf.html)

See also setRect( ) 。

  1. QGraphicsRectItem.setRect (self, QRectF rect)

设置项的矩形也可以在给定rectangle

See also rect( ) 。

  1. QGraphicsRectItem.setRect (self, float ax, float ay, float w, float h)

设置项的矩形,由(定义的矩形xy)和给定的widthheight

这个方便的功能等同于调用setRect(QRectF(x, y, width, height))

See also rect( ) 。

  1. QPainterPath QGraphicsRectItem.shape (self)

从重新实现QGraphicsItem.shape( ) 。

  1. int QGraphicsRectItem.type (self)

从重新实现QGraphicsItem.type( ) 。