Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QGraphicsTextItem Class

The QGraphicsTextItem class provides a text item that you can add to a QGraphicsScene to display formatted text. More...

 #include <QGraphicsTextItem>

Inherits: QGraphicsObject.

This class was introduced in Qt 4.2.

Public Types

enum CacheMode { NoCache, ItemCoordinateCache, DeviceCoordinateCache }
enum GraphicsItemChange { ItemEnabledChange, ItemEnabledHasChanged, ItemMatrixChange, ItemPositionChange, ..., ItemScenePositionHasChanged }
enum GraphicsItemFlag { ItemIsMovable, ItemIsSelectable, ItemIsFocusable, ItemClipsToShape, ..., ItemSendsScenePositionChanges }
flags GraphicsItemFlags
enum PanelModality { NonModal, PanelModal, SceneModal }

Properties

Public Functions

QGraphicsItem(QGraphicsItem * parent = 0)
QGraphicsTextItem(QGraphicsItem * parent = 0)
QGraphicsTextItem(const QString & text, QGraphicsItem * parent = 0)
virtual ~QGraphicsItem()
~QGraphicsTextItem()
bool acceptDrops() const
bool acceptHoverEvents() const
bool acceptTouchEvents() const
Qt::MouseButtons acceptedMouseButtons() const
void adjustSize()
virtual void advance(int phase)
virtual QRectF boundingRect() const = 0
QRegion boundingRegion(const QTransform & itemToDeviceTransform) const
qreal boundingRegionGranularity() const
CacheMode cacheMode() const
QList<QGraphicsItem *> childItems() const
QRectF childrenBoundingRect() const
void clearFocus()
QPainterPath clipPath() const
virtual bool collidesWithItem(const QGraphicsItem * other, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const
virtual bool collidesWithPath(const QPainterPath & path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const
QList<QGraphicsItem *> collidingItems(Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const
QGraphicsItem * commonAncestorItem(const QGraphicsItem * other) const
virtual bool contains(const QPointF & point) const
QCursor cursor() const
QVariant data(int key) const
QColor defaultTextColor() const
QTransform deviceTransform(const QTransform & viewportTransform) const
QTextDocument * document() const
qreal effectiveOpacity() const
void ensureVisible(const QRectF & rect = QRectF(), int xmargin = 50, int ymargin = 50)
void ensureVisible(qreal x, qreal y, qreal w, qreal h, int xmargin = 50, int ymargin = 50)
bool filtersChildEvents() const
GraphicsItemFlags flags() const
QGraphicsItem * focusItem() const
QGraphicsItem * focusProxy() const
QFont font() const
void grabKeyboard()
void grabMouse()
QGraphicsEffect * graphicsEffect() const
QGraphicsItemGroup * group() const
bool hasCursor() const
bool hasFocus() const
void hide()
Qt::InputMethodHints inputMethodHints() const
void installSceneEventFilter(QGraphicsItem * filterItem)
bool isActive() const
bool isAncestorOf(const QGraphicsItem * child) const
bool isBlockedByModalPanel(QGraphicsItem ** blockingPanel = 0) const
bool isClipped() const
bool isEnabled() const
bool isObscured() const
bool isObscured(qreal x, qreal y, qreal w, qreal h) const
bool isObscured(const QRectF & rect) const
virtual bool isObscuredBy(const QGraphicsItem * item) const
bool isPanel() const
bool isSelected() const
bool isUnderMouse() const
bool isVisible() const
bool isVisibleTo(const QGraphicsItem * parent) const
bool isWidget() const
bool isWindow() const
QTransform itemTransform(const QGraphicsItem * other, bool * ok = 0) const
QPointF mapFromItem(const QGraphicsItem * item, const QPointF & point) const
QPolygonF mapFromItem(const QGraphicsItem * item, const QRectF & rect) const
QPolygonF mapFromItem(const QGraphicsItem * item, const QPolygonF & polygon) const
QPainterPath mapFromItem(const QGraphicsItem * item, const QPainterPath & path) const
QPolygonF mapFromItem(const QGraphicsItem * item, qreal x, qreal y, qreal w, qreal h) const
QPointF mapFromItem(const QGraphicsItem * item, qreal x, qreal y) const
QPointF mapFromParent(const QPointF & point) const
QPolygonF mapFromParent(const QRectF & rect) const
QPolygonF mapFromParent(const QPolygonF & polygon) const
QPainterPath mapFromParent(const QPainterPath & path) const
QPolygonF mapFromParent(qreal x, qreal y, qreal w, qreal h) const
QPointF mapFromParent(qreal x, qreal y) const
QPointF mapFromScene(const QPointF & point) const
QPolygonF mapFromScene(const QRectF & rect) const
QPolygonF mapFromScene(const QPolygonF & polygon) const
QPainterPath mapFromScene(const QPainterPath & path) const
QPolygonF mapFromScene(qreal x, qreal y, qreal w, qreal h) const
QPointF mapFromScene(qreal x, qreal y) const
QRectF mapRectFromItem(const QGraphicsItem * item, const QRectF & rect) const
QRectF mapRectFromItem(const QGraphicsItem * item, qreal x, qreal y, qreal w, qreal h) const
QRectF mapRectFromParent(const QRectF & rect) const
QRectF mapRectFromParent(qreal x, qreal y, qreal w, qreal h) const
QRectF mapRectFromScene(const QRectF & rect) const
QRectF mapRectFromScene(qreal x, qreal y, qreal w, qreal h) const
QRectF mapRectToItem(const QGraphicsItem * item, const QRectF & rect) const
QRectF mapRectToItem(const QGraphicsItem * item, qreal x, qreal y, qreal w, qreal h) const
QRectF mapRectToParent(const QRectF & rect) const
QRectF mapRectToParent(qreal x, qreal y, qreal w, qreal h) const
QRectF mapRectToScene(const QRectF & rect) const
QRectF mapRectToScene(qreal x, qreal y, qreal w, qreal h) const
QPointF mapToItem(const QGraphicsItem * item, const QPointF & point) const
QPolygonF mapToItem(const QGraphicsItem * item, const QRectF & rect) const
QPolygonF mapToItem(const QGraphicsItem * item, const QPolygonF & polygon) const
QPainterPath mapToItem(const QGraphicsItem * item, const QPainterPath & path) const
QPolygonF mapToItem(const QGraphicsItem * item, qreal x, qreal y, qreal w, qreal h) const
QPointF mapToItem(const QGraphicsItem * item, qreal x, qreal y) const
QPointF mapToParent(const QPointF & point) const
QPolygonF mapToParent(const QRectF & rect) const
QPolygonF mapToParent(const QPolygonF & polygon) const
QPainterPath mapToParent(const QPainterPath & path) const
QPolygonF mapToParent(qreal x, qreal y, qreal w, qreal h) const
QPointF mapToParent(qreal x, qreal y) const
QPointF mapToScene(const QPointF & point) const
QPolygonF mapToScene(const QRectF & rect) const
QPolygonF mapToScene(const QPolygonF & polygon) const
QPainterPath mapToScene(const QPainterPath & path) const
QPolygonF mapToScene(qreal x, qreal y, qreal w, qreal h) const
QPointF mapToScene(qreal x, qreal y) const
void moveBy(qreal dx, qreal dy)
qreal opacity() const
virtual QPainterPath opaqueArea() const
bool openExternalLinks() const
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0) = 0
QGraphicsItem * panel() const
PanelModality panelModality() const
QGraphicsItem * parentItem() const
QGraphicsObject * parentObject() const
QGraphicsWidget * parentWidget() const
QPointF pos() const
void removeSceneEventFilter(QGraphicsItem * filterItem)
void resetTransform()
qreal rotation() const
qreal scale() const
QGraphicsScene * scene() const
QRectF sceneBoundingRect() const
QPointF scenePos() const
QTransform sceneTransform() const
void scroll(qreal dx, qreal dy, const QRectF & rect = QRectF())
void setAcceptDrops(bool on)
void setAcceptHoverEvents(bool enabled)
void setAcceptTouchEvents(bool enabled)
void setAcceptedMouseButtons(Qt::MouseButtons buttons)
void setActive(bool active)
void setBoundingRegionGranularity(qreal granularity)
void setCacheMode(CacheMode mode, const QSize & logicalCacheSize = QSize())
void setCursor(const QCursor & cursor)
void setData(int key, const QVariant & value)
void setDefaultTextColor(const QColor & col)
void setDocument(QTextDocument * document)
void setEnabled(bool enabled)
void setFiltersChildEvents(bool enabled)
void setFlag(GraphicsItemFlag flag, bool enabled = true)
void setFlags(GraphicsItemFlags flags)
void setFocus(Qt::FocusReason focusReason = Qt::OtherFocusReason)
void setFocusProxy(QGraphicsItem * item)
void setFont(const QFont & font)
void setGraphicsEffect(QGraphicsEffect * effect)
void setGroup(QGraphicsItemGroup * group)
void setHtml(const QString & text)
void setInputMethodHints(Qt::InputMethodHints hints)
void setOpacity(qreal opacity)
void setOpenExternalLinks(bool open)
void setPanelModality(PanelModality panelModality)
void setParentItem(QGraphicsItem * newParent)
void setPlainText(const QString & text)
void setPos(const QPointF & pos)
void setPos(qreal x, qreal y)
void setRotation(qreal angle)
void setScale(qreal factor)
void setSelected(bool selected)
void setTabChangesFocus(bool b)
void setTextCursor(const QTextCursor & cursor)
void setTextInteractionFlags(Qt::TextInteractionFlags flags)
void setTextWidth(qreal width)
void setToolTip(const QString & toolTip)
void setTransform(const QTransform & matrix, bool combine = false)
void setTransformOriginPoint(const QPointF & origin)
void setTransformOriginPoint(qreal x, qreal y)
void setTransformations(const QList<QGraphicsTransform *> & transformations)
void setVisible(bool visible)
void setX(qreal x)
void setY(qreal y)
void setZValue(qreal z)
virtual QPainterPath shape() const
void show()
void stackBefore(const QGraphicsItem * sibling)
bool tabChangesFocus() const
QTextCursor textCursor() const
Qt::TextInteractionFlags textInteractionFlags() const
qreal textWidth() const
QGraphicsObject * toGraphicsObject()
const QGraphicsObject * toGraphicsObject() const
QString toHtml() const
QString toPlainText() const
QString toolTip() const
QGraphicsItem * topLevelItem() const
QGraphicsWidget * topLevelWidget() const
QTransform transform() const
QPointF transformOriginPoint() const
QList<QGraphicsTransform *> transformations() const
virtual int type() const
void ungrabKeyboard()
void ungrabMouse()
void unsetCursor()
void update(const QRectF & rect = QRectF())
void update(qreal x, qreal y, qreal width, qreal height)
QGraphicsWidget * window() const
qreal x() const
qreal y() const
qreal zValue() const

Reimplemented Public Functions

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

Signals

void linkActivated(const QString & link)
void linkHovered(const QString & link)

Static Public Members

const int Type
const int UserType
  • 11 static public members inherited from QObject

Protected Functions

virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent * event)
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent * event)
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent * event)
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent * event)
virtual void dropEvent(QGraphicsSceneDragDropEvent * event)
virtual void focusInEvent(QFocusEvent * event)
virtual void focusOutEvent(QFocusEvent * event)
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent * event)
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent * event)
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent * event)
virtual void inputMethodEvent(QInputMethodEvent * event)
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const
virtual QVariant itemChange(GraphicsItemChange change, const QVariant & value)
virtual void keyPressEvent(QKeyEvent * event)
virtual void keyReleaseEvent(QKeyEvent * event)
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event)
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event)
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event)
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
void prepareGeometryChange()
virtual bool sceneEvent(QEvent * event)
virtual bool sceneEventFilter(QGraphicsItem * watched, QEvent * event)
void updateMicroFocus()
virtual void wheelEvent(QGraphicsSceneWheelEvent * event)

Reimplemented Protected Functions

virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent * event)
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent * event)
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent * event)
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent * event)
virtual void dropEvent(QGraphicsSceneDragDropEvent * event)
virtual void focusInEvent(QFocusEvent * event)
virtual void focusOutEvent(QFocusEvent * event)
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent * event)
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent * event)
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent * event)
virtual void inputMethodEvent(QInputMethodEvent * event)
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const
virtual void keyPressEvent(QKeyEvent * event)
virtual void keyReleaseEvent(QKeyEvent * event)
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event)
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event)
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event)
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
virtual bool sceneEvent(QEvent * event)
  • 9 protected functions inherited from QObject

Additional Inherited Members

Detailed Description

The QGraphicsTextItem class provides a text item that you can add to a QGraphicsScene to display formatted text.

If you only need to show plain text in an item, consider using QGraphicsSimpleTextItem instead.

To set the item's text, pass a QString to QGraphicsTextItem's constructor, or call setHtml()/setPlainText().

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

It is possible to make the item editable by setting the Qt::TextEditorInteraction flag using setTextInteractionFlags().

The item's preferred text width can be set using setTextWidth() and obtained using textWidth().

Note: In order to align HTML text in the center, the item's text width must be set.

Note: QGraphicsTextItem accepts hover events by default. You can change this with setAcceptHoverEvents().

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

Property Documentation

openExternalLinks : bool

Specifies whether QGraphicsTextItem should automatically open links using QDesktopServices::openUrl() instead of emitting the linkActivated signal.

The default value is false.

Access functions:

bool openExternalLinks() const
void setOpenExternalLinks(bool open)

textCursor : QTextCursor

This property represents the visible text cursor in an editable text item.

By default, if the item's text has not been set, this property contains a null text cursor; otherwise it contains a text cursor placed at the start of the item's document.

Access functions:

QTextCursor textCursor() const
void setTextCursor(const QTextCursor & cursor)

Member Function Documentation

QGraphicsTextItem::QGraphicsTextItem(QGraphicsItem * parent = 0)

Constructs a QGraphicsTextItem. parent is passed to QGraphicsItem's constructor.

See also QGraphicsScene::addItem().

QGraphicsTextItem::QGraphicsTextItem(const QString & text, QGraphicsItem * parent = 0)

Constructs a QGraphicsTextItem, using text as the default plain text. parent is passed to QGraphicsItem's constructor.

See also QGraphicsScene::addItem().

QGraphicsTextItem::~QGraphicsTextItem()

Destroys the QGraphicsTextItem.

void QGraphicsTextItem::adjustSize()

Adjusts the text item to a reasonable size.

QRectF QGraphicsTextItem::boundingRect() const [virtual]

Reimplemented from QGraphicsItem::boundingRect().

bool QGraphicsTextItem::contains(const QPointF & point) const [virtual]

Reimplemented from QGraphicsItem::contains().

void QGraphicsTextItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::contextMenuEvent().

QColor QGraphicsTextItem::defaultTextColor() const

Returns the default text color that is used to for unformatted text.

See also setDefaultTextColor().

QTextDocument * QGraphicsTextItem::document() const

Returns the item's text document.

See also setDocument().

void QGraphicsTextItem::dragEnterEvent(QGraphicsSceneDragDropEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::dragEnterEvent().

void QGraphicsTextItem::dragLeaveEvent(QGraphicsSceneDragDropEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::dragLeaveEvent().

void QGraphicsTextItem::dragMoveEvent(QGraphicsSceneDragDropEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::dragMoveEvent().

void QGraphicsTextItem::dropEvent(QGraphicsSceneDragDropEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::dropEvent().

void QGraphicsTextItem::focusInEvent(QFocusEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::focusInEvent().

void QGraphicsTextItem::focusOutEvent(QFocusEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::focusOutEvent().

QFont QGraphicsTextItem::font() const

Returns the item's font, which is used to render the text.

See also setFont().

void QGraphicsTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::hoverEnterEvent().

void QGraphicsTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::hoverLeaveEvent().

void QGraphicsTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::hoverMoveEvent().

void QGraphicsTextItem::inputMethodEvent(QInputMethodEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::inputMethodEvent().

QVariant QGraphicsTextItem::inputMethodQuery(Qt::InputMethodQuery query) const [virtual protected]

Reimplemented from QGraphicsItem::inputMethodQuery().

bool QGraphicsTextItem::isObscuredBy(const QGraphicsItem * item) const [virtual]

Reimplemented from QGraphicsItem::isObscuredBy().

void QGraphicsTextItem::keyPressEvent(QKeyEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::keyPressEvent().

void QGraphicsTextItem::keyReleaseEvent(QKeyEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::keyReleaseEvent().

void QGraphicsTextItem::linkActivated(const QString & link) [signal]

This signal is emitted when the user clicks on a link on a text item that enables Qt::LinksAccessibleByMouse or Qt::LinksAccessibleByKeyboard. link is the link that was clicked.

See also setTextInteractionFlags().

void QGraphicsTextItem::linkHovered(const QString & link) [signal]

This signal is emitted when the user hovers over a link on a text item that enables Qt::LinksAccessibleByMouse. link is the link that was hovered over.

See also setTextInteractionFlags().

void QGraphicsTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::mouseDoubleClickEvent().

void QGraphicsTextItem::mouseMoveEvent(QGraphicsSceneMouseEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::mouseMoveEvent().

void QGraphicsTextItem::mousePressEvent(QGraphicsSceneMouseEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::mousePressEvent().

void QGraphicsTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::mouseReleaseEvent().

QPainterPath QGraphicsTextItem::opaqueArea() const [virtual]

Reimplemented from QGraphicsItem::opaqueArea().

void QGraphicsTextItem::paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) [virtual]

Reimplemented from QGraphicsItem::paint().

bool QGraphicsTextItem::sceneEvent(QEvent * event) [virtual protected]

Reimplemented from QGraphicsItem::sceneEvent().

void QGraphicsTextItem::setDefaultTextColor(const QColor & col)

Sets the color for unformatted text to col.

See also defaultTextColor().

void QGraphicsTextItem::setDocument(QTextDocument * document)

Sets the text document document on the item.

See also document().

void QGraphicsTextItem::setFont(const QFont & font)

Sets the font used to render the text item to font.

See also font().

void QGraphicsTextItem::setHtml(const QString & text)

Sets the item's text to text, assuming that text is HTML formatted. If the item has keyboard input focus, this function will also call ensureVisible() to ensure that the text is visible in all viewports.

See also toHtml(), hasFocus(), and QGraphicsSimpleTextItem.

void QGraphicsTextItem::setPlainText(const QString & text)

Sets the item's text to text. If the item has keyboard input focus, this function will also call ensureVisible() to ensure that the text is visible in all viewports.

See also toHtml() and hasFocus().

void QGraphicsTextItem::setTabChangesFocus(bool b)

If b is true, the Tab key will cause the widget to change focus; otherwise, the tab key will insert a tab into the document.

In some occasions text edits should not allow the user to input tabulators or change indentation using the Tab key, as this breaks the focus chain. The default is false.

This function was introduced in Qt 4.5.

See also tabChangesFocus(), ItemIsFocusable, and textInteractionFlags().

void QGraphicsTextItem::setTextInteractionFlags(Qt::TextInteractionFlags flags)

Sets the flags flags to specify how the text item should react to user input.

The default for a QGraphicsTextItem is Qt::NoTextInteraction. This function also affects the ItemIsFocusable QGraphicsItem flag by setting it if flags is different from Qt::NoTextInteraction and clearing it otherwise.

By default, the text is read-only. To transform the item into an editor, set the Qt::TextEditable flag.

See also textInteractionFlags().

void QGraphicsTextItem::setTextWidth(qreal width)

Sets the preferred width for the item's text. If the actual text is wider than the specified width then it will be broken into multiple lines.

If width is set to -1 then the text will not be broken into multiple lines unless it is enforced through an explicit line break or a new paragraph.

The default value is -1.

Note that QGraphicsTextItem keeps a QTextDocument internally, which is used to calculate the text width.

See also textWidth() and QTextDocument::setTextWidth().

QPainterPath QGraphicsTextItem::shape() const [virtual]

Reimplemented from QGraphicsItem::shape().

bool QGraphicsTextItem::tabChangesFocus() const

Returns true if the Tab key will cause the widget to change focus; otherwise, false is returned.

By default, this behavior is disabled, and this function will return false.

This function was introduced in Qt 4.5.

See also setTabChangesFocus().

Qt::TextInteractionFlags QGraphicsTextItem::textInteractionFlags() const

Returns the current text interaction flags.

See also setTextInteractionFlags().

qreal QGraphicsTextItem::textWidth() const

Returns the text width.

The width is calculated with the QTextDocument that QGraphicsTextItem keeps internally.

See also setTextWidth() and QTextDocument::textWidth().

QString QGraphicsTextItem::toHtml() const

Returns the item's text converted to HTML, or an empty QString if no text has been set.

See also setHtml().

QString QGraphicsTextItem::toPlainText() const

Returns the item's text converted to plain text, or an empty QString if no text has been set.

See also setPlainText().

int QGraphicsTextItem::type() const [virtual]

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 5.0-snapshot
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 !
 
 
 
 
Partenaires

Hébergement Web