Home · All Classes · Modules

QGraphicsSimpleTextItem Class Reference
[QtGui module]

The QGraphicsSimpleTextItem class provides a text item that you can add to a QGraphicsScene. More...

Inherits QAbstractGraphicsShapeItem.

Methods


Detailed Description

The QGraphicsSimpleTextItem class provides a text item that you can add to a QGraphicsScene.

To set the item's text, pass a QString to QGraphicsSimpleTextItem's constructor, or call setText().

QGraphicsTextItem uses the text's formatted size and the associated font to provide a reasonable implementation of boundingRect(), shape(), and contains(). You can set the font by calling setFont().

QGraphicsSimpleText does not display rich text. It is optimized for drawing plain text fast and with low memory overhead.

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


Method Documentation

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

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

Constructs a QGraphicsSimpleTextItem.

parent and scene are passed to QGraphicsItem's constructor.

QGraphicsSimpleTextItem.__init__ (self, QString text, QGraphicsItem parent = None, QGraphicsScene scene = None)

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

Constructs a QGraphicsSimpleTextItem, using text as the default plain text.

parent and scene are passed to QGraphicsItem's constructor.

QRectF QGraphicsSimpleTextItem.boundingRect (self)

bool QGraphicsSimpleTextItem.contains (self, QPointF point)

QFont QGraphicsSimpleTextItem.font (self)

Returns the font that is used to draw the item's text.

See also setFont().

bool QGraphicsSimpleTextItem.isObscuredBy (self, QGraphicsItem item)

QPainterPath QGraphicsSimpleTextItem.opaqueArea (self)

QGraphicsSimpleTextItem.paint (self, QPainter painter, QStyleOptionGraphicsItem option, QWidget widget)

QGraphicsSimpleTextItem.setFont (self, QFont font)

Sets the font that is used to draw the item's text to font.

See also font().

QGraphicsSimpleTextItem.setText (self, QString text)

Sets the item's text to text. The text will be displayed as plain text. Newline characters ('\n') as well as characters of type QChar.LineSeparator will cause item to break the text into multiple lines.

See also text().

QPainterPath QGraphicsSimpleTextItem.shape (self)

QString QGraphicsSimpleTextItem.text (self)

Returns the item's text.

See also setText().

int QGraphicsSimpleTextItem.type (self)


PyQt 4.1 for X11Copyright © Riverbank Computing Ltd and Trolltech AS 2006Qt 4.2.1