The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene . 更多...
继承 QAbstractGraphicsShapeItem .
The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene .
要设置项的矩形,传递 QRectF to QGraphicsRectItem's constructor, or call the setRect () function. The rect () function returns the current rectangle.
QGraphicsRectItem uses the rectangle and the pen width to provide a reasonable implementation of boundingRect (), shape (),和 contains ()。 paint () function draws the rectangle using the item's associated pen and brush, which you can set by calling the setPen () 和 setBrush () 函数。
注意: The rendering of invalid rectangles, such as those with negative widths or heights, is undefined. If you cannot be sure that you are using valid rectangles (for example, if you are creating rectangles using data from an unreliable source) then you should use QRectF.normalized () to create normalized rectangles, and use those instead.
parent argument, if not None, causes self to be owned by Qt instead of PyQt.
scene argument, if not None, causes self to be owned by Qt instead of PyQt.
构造 QGraphicsRectItem . parent is passed to QAbstractGraphicsShapeItem 's 构造函数。
另请参阅 QGraphicsScene.addItem ().
parent argument, if not None, causes self to be owned by Qt instead of PyQt.
scene argument, if not None, causes self to be owned by Qt instead of PyQt.
构造 QGraphicsRectItem ,使用 rect as the default rectangle. parent 会被传递给 QAbstractGraphicsShapeItem 's 构造函数。
另请参阅 QGraphicsScene.addItem ().
parent argument, if not None, causes self to be owned by Qt instead of PyQt.
scene argument, if not None, causes self to be owned by Qt instead of PyQt.
构造 QGraphicsRectItem with a default rectangle defined by ( x , y ) and the given width and height .
parent 会被传递给 QAbstractGraphicsShapeItem 's 构造函数。
另请参阅 QGraphicsScene.addItem ().
重实现自 QGraphicsItem.boundingRect ().
重实现自 QGraphicsItem.contains ().
重实现自 QGraphicsItem.isObscuredBy ().
重实现自 QGraphicsItem.opaqueArea ().
重实现自 QGraphicsItem.paint ().
Returns the item's rectangle.
另请参阅 setRect ().
Sets the item's rectangle to be the given rectangle .
另请参阅 rect ().
Sets the item's rectangle to the rectangle defined by ( x , y ) and the given width and height .
This convenience function is equivalent to calling setRect(QRectF(x, y, width, height))
另请参阅 rect ().
重实现自 QGraphicsItem.shape ().
重实现自 QGraphicsItem.type ().