QGraphicsSimpleTextItem Class ReferenceThe QGraphicsSimpleTextItem class provides a simple text path item that you can add to a QGraphicsScene. More... #include <QGraphicsSimpleTextItem> Inherits QAbstractGraphicsShapeItem. This class was introduced in Qt 4.2. Public Functions
Reimplemented Public Functions
Additional Inherited Members
Detailed DescriptionThe 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 Graphics View Framework. Member Function DocumentationQGraphicsSimpleTextItem::QGraphicsSimpleTextItem ( QGraphicsItem * parent = 0 )Constructs a QGraphicsSimpleTextItem. parent is passed to QGraphicsItem's constructor. See also QGraphicsScene::addItem(). QGraphicsSimpleTextItem::QGraphicsSimpleTextItem ( const QString & text, QGraphicsItem * parent = 0 )Constructs a QGraphicsSimpleTextItem, using text as the default plain text. parent is passed to QGraphicsItem's constructor. See also QGraphicsScene::addItem(). QGraphicsSimpleTextItem::~QGraphicsSimpleTextItem ()Destroys the QGraphicsSimpleTextItem. QRectF QGraphicsSimpleTextItem::boundingRect () const [virtual]Reimplemented from QGraphicsItem::boundingRect(). bool QGraphicsSimpleTextItem::contains ( const QPointF & point ) const [virtual]Reimplemented from QGraphicsItem::contains(). QFont QGraphicsSimpleTextItem::font () constReturns the font that is used to draw the item's text. See also setFont(). bool QGraphicsSimpleTextItem::isObscuredBy ( const QGraphicsItem * item ) const [virtual]Reimplemented from QGraphicsItem::isObscuredBy(). QPainterPath QGraphicsSimpleTextItem::opaqueArea () const [virtual]Reimplemented from QGraphicsItem::opaqueArea(). void QGraphicsSimpleTextItem::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget ) [virtual]Reimplemented from QGraphicsItem::paint(). void QGraphicsSimpleTextItem::setFont ( const QFont & font )Sets the font that is used to draw the item's text to font. See also font(). void QGraphicsSimpleTextItem::setText ( const 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 () const [virtual]Reimplemented from QGraphicsItem::shape(). QString QGraphicsSimpleTextItem::text () constReturns the item's text. See also setText(). int QGraphicsSimpleTextItem::type () const [virtual]Reimplemented from QGraphicsItem::type(). X
|
Попытка перевода Qt документации. Если есть желание присоединиться, или если есть замечания или пожелания, то заходите на форум: Перевод Qt документации на русский язык... Люди внесшие вклад в перевод: Команда переводчиков |