Home · All Classes · Modules

QGraphicsRectItem Class Reference
[QtGui module]

The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene. More...

Inherits QAbstractGraphicsShapeItem.

Methods


Detailed Description

The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene.

To set the item's rectangle, pass a 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(), and contains(). The paint() function draws the rectangle using the item's associated pen and brush, which you can set by calling the setPen() and setBrush() functions.

See also QGraphicsPathItem, QGraphicsEllipseItem, QGraphicsPolygonItem, QGraphicsTextItem, QGraphicsLineItem, QGraphicsPixmapItem, and The Graphics View Framework.


Method Documentation

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

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

The scene argument, if not None, causes self to be owned by Qt instead of PyQt.

Constructs a QGraphicsRectItem. parent is passed to QAbstractGraphicsShapeItem's constructor.

See also QGraphicsScene.addItem().

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

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

The scene argument, if not None, causes self to be owned by Qt instead of PyQt.

Constructs a QGraphicsRectItem, using rect as the default rectangle. parent is passed to QAbstractGraphicsShapeItem's constructor.

See also QGraphicsScene.addItem().

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

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

The scene argument, if not None, causes self to be owned by Qt instead of PyQt.

Constructs a QGraphicsRectItem with a default rectangle defined by (x, y) and the given width and height.

parent is passed to QAbstractGraphicsShapeItem's constructor.

See also QGraphicsScene.addItem().

QRectF QGraphicsRectItem.boundingRect (self)

bool QGraphicsRectItem.contains (self, QPointF point)

bool QGraphicsRectItem.isObscuredBy (self, QGraphicsItem item)

QPainterPath QGraphicsRectItem.opaqueArea (self)

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

QRectF QGraphicsRectItem.rect (self)

Returns the item's rectangle.

See also setRect().

QGraphicsRectItem.setRect (self, QRectF rect)

Sets the item's rectangle to be the given rectangle.

See also rect().

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

This is an overloaded member function, provided for convenience.

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))

See also rect().

QPainterPath QGraphicsRectItem.shape (self)

int QGraphicsRectItem.type (self)


PyQt 4.3.1 for X11Copyright © Riverbank Computing Ltd and Trolltech AS 2007Qt 4.3.0