QGraphicsRectItem Class Reference
[QtGui module]
该QGraphicsRectItem类提供了一个长方形项目,你可以添加到QGraphicsScene。More…
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使用矩形和钢笔的宽度,以提供合理的实施boundingRect( )shape()和contains( ) 。该paint( )函数绘制使用该项目的相关笔触的矩形,它可以通过调用设置setPen()和setBrush()函数。
Note:无效矩形的绘制,如那些具有负宽度或高度,是不确定的。如果你不能确定你使用的是有效的矩形(例如,如果您正在使用的数据来自不可靠的源创建矩形),那么你应该使用QRectF.normalized()来创建正规化矩形,并使用这些来代替。
Method Documentation
QGraphicsRectItem.__init__ (self, QGraphicsItem parent = None, QGraphicsScene scene = None)
该parent的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。
该scene的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。
构造一个QGraphicsRectItem。parent被传递给QAbstractGraphicsShapeItem的构造。
See also QGraphicsScene.addItem( ) 。
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( ) 。
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由(定义了默认的矩形x,y)和给定的width和height。
parent被传递给QAbstractGraphicsShapeItem的构造。
See also QGraphicsScene.addItem( ) 。
QRectF QGraphicsRectItem.boundingRect (self)
从重新实现QGraphicsItem.boundingRect( ) 。
bool QGraphicsRectItem.contains (self, QPointF point)
从重新实现QGraphicsItem.contains( ) 。
bool QGraphicsRectItem.isObscuredBy (self, QGraphicsItem item)
从重新实现QGraphicsItem.isObscuredBy( ) 。
QPainterPath QGraphicsRectItem.opaqueArea (self)
从重新实现QGraphicsItem.opaqueArea( ) 。
QGraphicsRectItem.paint (self, QPainter painter, QStyleOptionGraphicsItem option, QWidget widget = None)
从重新实现QGraphicsItem.paint( ) 。
QRectF QGraphicsRectItem.rect (self)
[
返回该项目的矩形。
]($docs-qrectf.html)
QGraphicsRectItem.setRect (self, QRectF rect)
设置项的矩形也可以在给定rectangle。
See also rect( ) 。
QGraphicsRectItem.setRect (self, float ax, float ay, float w, float h)
设置项的矩形,由(定义的矩形x,y)和给定的width和height。
这个方便的功能等同于调用setRect(QRectF(x, y, width, height))
See also rect( ) 。
QPainterPath QGraphicsRectItem.shape (self)
int QGraphicsRectItem.type (self)
从重新实现QGraphicsItem.type( ) 。