QGraphicsSimpleTextItem Class Reference |
QGraphicsSimpleTextItem ( QGraphicsItem * parent = 0 ) | |
QGraphicsSimpleTextItem ( const QString & text, QGraphicsItem * parent = 0 ) | |
~QGraphicsSimpleTextItem () | |
QFont | font () const |
void | setFont ( const QFont & font ) |
void | setText ( const QString & text ) |
QString | text () const |
virtual QRectF | boundingRect () const |
virtual bool | contains ( const QPointF & point ) const |
virtual bool | isObscuredBy ( const QGraphicsItem * item ) const |
virtual QPainterPath | opaqueArea () const |
virtual void | paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget ) |
virtual QPainterPath | shape () const |
virtual int | type () const |
The QGraphicsSimpleTextItem class provides a simple text path item that you can add to a QGraphicsScene.
To set the item's text, you can either pass a QString to QGraphicsSimpleTextItem's constructor, or call setText() to change the text later. To set the text fill color, call setBrush().
The simple text item can have both a fill and an outline; setBrush() will set the text fill (i.e., text color), and setPen() sets the pen that will be used to draw the text outline. (The latter can be slow, especially for complex pens, and items with long text content.) If all you want is to draw a simple line of text, you should call setBrush() only, and leave the pen unset; QGraphicsSimpleTextItem's pen is by default Qt::NoPen.
QGraphicsSimpleTextItem 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; instead, you can use QGraphicsTextItem, which provides full text control capabilities.
See also QGraphicsTextItem, QGraphicsPathItem, QGraphicsRectItem, QGraphicsEllipseItem, QGraphicsPixmapItem, QGraphicsPolygonItem, QGraphicsLineItem, and The Graphics View Framework.
Constructs a QGraphicsSimpleTextItem.
parent is passed to QGraphicsItem's constructor.
See also QGraphicsScene::addItem().
Constructs a QGraphicsSimpleTextItem, using text as the default plain text.
parent is passed to QGraphicsItem's constructor.
See also QGraphicsScene::addItem().
Destroys the QGraphicsSimpleTextItem.
Reimplemented from QGraphicsItem::boundingRect().
Reimplemented from QGraphicsItem::contains().
Returns the font that is used to draw the item's text.
See also setFont().
Reimplemented from QGraphicsItem::isObscuredBy().
Reimplemented from QGraphicsItem::opaqueArea().
Reimplemented from QGraphicsItem::paint().
Sets the font that is used to draw the item's text to font.
See also font().
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().
Reimplemented from QGraphicsItem::shape().
Returns the item's text.
See also setText().
Reimplemented from QGraphicsItem::type().
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.6 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com