Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-updates > by-pkgid > 768f7d9f703884aa2562bf0a651086df > files > 3377

qtbase5-doc-5.9.4-1.1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qgraphicsitem.cpp -->
  <title>QGraphicsTextItem Class | Qt Widgets 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-module.html">C++ Classes</a></td><td >QGraphicsTextItem</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#reimplemented-public-functions">Reimplemented Public Functions</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#reimplemented-protected-functions">Reimplemented Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QGraphicsTextItem Class</h1>
<!-- $$$QGraphicsTextItem-brief -->
<p>The <a href="qgraphicstextitem.html">QGraphicsTextItem</a> class provides a text item that you can add to a <a href="qgraphicsscene.html">QGraphicsScene</a> to display formatted text. <a href="#details">More...</a></p>
<!-- @@@QGraphicsTextItem -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QGraphicsTextItem&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += widgets</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign">  Qt 4.2</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qgraphicsobject.html">QGraphicsObject</a></td></tr></table></div><ul>
<li><a href="qgraphicstextitem-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><a href="qgraphicstextitem.html#openExternalLinks-prop">openExternalLinks</a></b> : bool</li>
<li class="fn"><b><a href="qgraphicstextitem.html#textCursor-prop">textCursor</a></b> : QTextCursor</li>
</ul>
<ul>
<li class="fn">12 properties inherited from <a href="qgraphicsobject.html#properties">QGraphicsObject</a></li>
<li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#QGraphicsTextItem">QGraphicsTextItem</a></b>(QGraphicsItem *<i>parent</i> = Q_NULLPTR)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#QGraphicsTextItem-1">QGraphicsTextItem</a></b>(const QString &amp;<i>text</i>, QGraphicsItem *<i>parent</i> = Q_NULLPTR)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#dtor.QGraphicsTextItem">~QGraphicsTextItem</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#adjustSize">adjustSize</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QColor </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#defaultTextColor">defaultTextColor</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextDocument *</td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#document">document</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QFont </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#font">font</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#openExternalLinks-prop">openExternalLinks</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#setDefaultTextColor">setDefaultTextColor</a></b>(const QColor &amp;<i>col</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#setDocument">setDocument</a></b>(QTextDocument *<i>document</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#setFont">setFont</a></b>(const QFont &amp;<i>font</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#setHtml">setHtml</a></b>(const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#openExternalLinks-prop">setOpenExternalLinks</a></b>(bool <i>open</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#setPlainText">setPlainText</a></b>(const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#setTabChangesFocus">setTabChangesFocus</a></b>(bool <i>b</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#textCursor-prop">setTextCursor</a></b>(const QTextCursor &amp;<i>cursor</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#setTextInteractionFlags">setTextInteractionFlags</a></b>(Qt::TextInteractionFlags <i>flags</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#setTextWidth">setTextWidth</a></b>(qreal <i>width</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#tabChangesFocus">tabChangesFocus</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextCursor </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#textCursor-prop">textCursor</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::TextInteractionFlags </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#textInteractionFlags">textInteractionFlags</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#textWidth">textWidth</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#toHtml">toHtml</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#toPlainText">toPlainText</a></b>() const</td></tr>
</table></div>
<a name="reimplemented-public-functions"></a>
<h2 id="reimplemented-public-functions">Reimplemented Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual QRectF </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#boundingRect">boundingRect</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#contains">contains</a></b>(const QPointF &amp;<i>point</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#isObscuredBy">isObscuredBy</a></b>(const QGraphicsItem *<i>item</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QPainterPath </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#opaqueArea">opaqueArea</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#paint">paint</a></b>(QPainter *<i>painter</i>, const QStyleOptionGraphicsItem *<i>option</i>, QWidget *<i>widget</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QPainterPath </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#shape">shape</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#type">type</a></b>() const</td></tr>
</table></div>
<ul>
<li class="fn">2 public functions inherited from <a href="qgraphicsobject.html#public-functions">QGraphicsObject</a></li>
<li class="fn">32 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li>
<li class="fn">176 public functions inherited from <a href="qgraphicsitem.html#public-functions">QGraphicsItem</a></li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#linkActivated">linkActivated</a></b>(const QString &amp;<i>link</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#linkHovered">linkHovered</a></b>(const QString &amp;<i>link</i>)</td></tr>
</table></div>
<ul>
<li class="fn">9 signals inherited from <a href="qgraphicsobject.html#signals">QGraphicsObject</a></li>
<li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li>
</ul>
<a name="reimplemented-protected-functions"></a>
<h2 id="reimplemented-protected-functions">Reimplemented Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#contextMenuEvent">contextMenuEvent</a></b>(QGraphicsSceneContextMenuEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#dragEnterEvent">dragEnterEvent</a></b>(QGraphicsSceneDragDropEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#dragLeaveEvent">dragLeaveEvent</a></b>(QGraphicsSceneDragDropEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#dragMoveEvent">dragMoveEvent</a></b>(QGraphicsSceneDragDropEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#dropEvent">dropEvent</a></b>(QGraphicsSceneDragDropEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#focusInEvent">focusInEvent</a></b>(QFocusEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#focusOutEvent">focusOutEvent</a></b>(QFocusEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#hoverEnterEvent">hoverEnterEvent</a></b>(QGraphicsSceneHoverEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#hoverLeaveEvent">hoverLeaveEvent</a></b>(QGraphicsSceneHoverEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#hoverMoveEvent">hoverMoveEvent</a></b>(QGraphicsSceneHoverEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#inputMethodEvent">inputMethodEvent</a></b>(QInputMethodEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QVariant </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#inputMethodQuery">inputMethodQuery</a></b>(Qt::InputMethodQuery <i>query</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#keyPressEvent">keyPressEvent</a></b>(QKeyEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#keyReleaseEvent">keyReleaseEvent</a></b>(QKeyEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#mouseDoubleClickEvent">mouseDoubleClickEvent</a></b>(QGraphicsSceneMouseEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#mouseMoveEvent">mouseMoveEvent</a></b>(QGraphicsSceneMouseEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#mousePressEvent">mousePressEvent</a></b>(QGraphicsSceneMouseEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#mouseReleaseEvent">mouseReleaseEvent</a></b>(QGraphicsSceneMouseEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicstextitem.html#sceneEvent">sceneEvent</a></b>(QEvent *<i>event</i>)</td></tr>
</table></div>
<ul>
<li class="fn">1 protected function inherited from <a href="qgraphicsobject.html#protected-functions">QGraphicsObject</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
<li class="fn">24 protected functions inherited from <a href="qgraphicsitem.html#protected-functions">QGraphicsItem</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li>
<li class="fn">1 public variable inherited from <a href="../qtcore/qobject.html#public-variables">QObject</a></li>
<li class="fn">10 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li>
<li class="fn">2 static public members inherited from <a href="qgraphicsitem.html#static-public-members">QGraphicsItem</a></li>
<li class="fn">1 protected function inherited from <a href="qgraphicsobject.html#protected-functions">QGraphicsObject</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
<li class="fn">24 protected functions inherited from <a href="qgraphicsitem.html#protected-functions">QGraphicsItem</a></li>
<li class="fn">1 protected slot inherited from <a href="qgraphicsobject.html#protected-slots">QGraphicsObject</a></li>
<li class="fn">2 protected variables inherited from <a href="../qtcore/qobject.html#protected-variables">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QGraphicsTextItem-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qgraphicstextitem.html">QGraphicsTextItem</a> class provides a text item that you can add to a <a href="qgraphicsscene.html">QGraphicsScene</a> to display formatted text.</p>
<p>If you only need to show plain text in an item, consider using <a href="qgraphicssimpletextitem.html">QGraphicsSimpleTextItem</a> instead.</p>
<p>To set the item's text, pass a <a href="../qtcore/qstring.html">QString</a> to <a href="qgraphicstextitem.html">QGraphicsTextItem</a>'s constructor, or call <a href="qgraphicstextitem.html#setHtml">setHtml</a>()/<a href="qgraphicstextitem.html#setPlainText">setPlainText</a>().</p>
<p><a href="qgraphicstextitem.html">QGraphicsTextItem</a> uses the text's formatted size and the associated font to provide a reasonable implementation of <a href="qgraphicstextitem.html#boundingRect">boundingRect</a>(), <a href="qgraphicstextitem.html#shape">shape</a>(), and <a href="qgraphicstextitem.html#contains">contains</a>(). You can set the font by calling <a href="qgraphicstextitem.html#setFont">setFont</a>().</p>
<p>It is possible to make the item editable by setting the <a href="../qtcore/qt.html#TextInteractionFlag-enum">Qt::TextEditorInteraction</a> flag using <a href="qgraphicstextitem.html#setTextInteractionFlags">setTextInteractionFlags</a>().</p>
<p>The item's preferred text width can be set using <a href="qgraphicstextitem.html#setTextWidth">setTextWidth</a>() and obtained using <a href="qgraphicstextitem.html#textWidth">textWidth</a>().</p>
<p><b>Note: </b>In order to align HTML text in the center, the item's text width must be set. Otherwise, you can call <a href="qgraphicstextitem.html#adjustSize">adjustSize</a>() after setting the item's text.</p><p class="centerAlign"><img src="images/graphicsview-textitem.png" alt="" /></p><p><b>Note: </b><a href="qgraphicstextitem.html">QGraphicsTextItem</a> accepts <a href="qgraphicsitem.html#acceptHoverEvents">hover events</a> by default. You can change this with <a href="qgraphicsitem.html#setAcceptHoverEvents">setAcceptHoverEvents()</a>.</p></div>
<p><b>See also </b><a href="qgraphicssimpletextitem.html">QGraphicsSimpleTextItem</a>, <a href="qgraphicspathitem.html">QGraphicsPathItem</a>, <a href="qgraphicsrectitem.html">QGraphicsRectItem</a>, <a href="qgraphicsellipseitem.html">QGraphicsEllipseItem</a>, <a href="qgraphicspixmapitem.html">QGraphicsPixmapItem</a>, <a href="qgraphicspolygonitem.html">QGraphicsPolygonItem</a>, <a href="qgraphicslineitem.html">QGraphicsLineItem</a>, and <a href="graphicsview.html">Graphics View Framework</a>.</p>
<!-- @@@QGraphicsTextItem -->
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$openExternalLinks-prop$$$openExternalLinks$$$setOpenExternalLinksbool -->
<h3 class="fn" id="openExternalLinks-prop"><a name="openExternalLinks-prop"></a><span class="name">openExternalLinks</span> : <span class="type">bool</span></h3>
<p>Specifies whether <a href="qgraphicstextitem.html">QGraphicsTextItem</a> should automatically open links using <a href="../qtgui/qdesktopservices.html#openUrl">QDesktopServices::openUrl</a>() instead of emitting the <a href="qgraphicstextitem.html#linkActivated">linkActivated</a> signal.</p>
<p>The default value is false.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>openExternalLinks</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setOpenExternalLinks</b></span>(bool <i>open</i>)</td></tr>
</table></div>
<!-- @@@openExternalLinks -->
<!-- $$$textCursor-prop$$$textCursor$$$setTextCursorconstQTextCursor& -->
<h3 class="fn" id="textCursor-prop"><a name="textCursor-prop"></a><span class="name">textCursor</span> : <span class="type"><a href="../qtgui/qtextcursor.html">QTextCursor</a></span></h3>
<p>This property represents the visible text cursor in an editable text item.</p>
<p>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.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QTextCursor </td><td class="memItemRight bottomAlign"><span class="name"><b>textCursor</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setTextCursor</b></span>(const QTextCursor &amp;<i>cursor</i>)</td></tr>
</table></div>
<!-- @@@textCursor -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QGraphicsTextItem[overload1]$$$QGraphicsTextItemQGraphicsItem* -->
<h3 class="fn" id="QGraphicsTextItem"><a name="QGraphicsTextItem"></a>QGraphicsTextItem::<span class="name">QGraphicsTextItem</span>(<span class="type"><a href="qgraphicsitem.html#QGraphicsItem">QGraphicsItem</a></span> *<i>parent</i> = Q_NULLPTR)</h3>
<p>Constructs a <a href="qgraphicstextitem.html">QGraphicsTextItem</a>. <i>parent</i> is passed to <a href="qgraphicsitem.html">QGraphicsItem</a>'s constructor.</p>
<p><b>See also </b><a href="qgraphicsscene.html#addItem">QGraphicsScene::addItem</a>().</p>
<!-- @@@QGraphicsTextItem -->
<!-- $$$QGraphicsTextItem$$$QGraphicsTextItemconstQString&QGraphicsItem* -->
<h3 class="fn" id="QGraphicsTextItem-1"><a name="QGraphicsTextItem-1"></a>QGraphicsTextItem::<span class="name">QGraphicsTextItem</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, <span class="type"><a href="qgraphicsitem.html#QGraphicsItem">QGraphicsItem</a></span> *<i>parent</i> = Q_NULLPTR)</h3>
<p>Constructs a <a href="qgraphicstextitem.html">QGraphicsTextItem</a>, using <i>text</i> as the default plain text. <i>parent</i> is passed to <a href="qgraphicsitem.html">QGraphicsItem</a>'s constructor.</p>
<p><b>See also </b><a href="qgraphicsscene.html#addItem">QGraphicsScene::addItem</a>().</p>
<!-- @@@QGraphicsTextItem -->
<!-- $$$~QGraphicsTextItem[overload1]$$$~QGraphicsTextItem -->
<h3 class="fn" id="dtor.QGraphicsTextItem"><a name="dtor.QGraphicsTextItem"></a>QGraphicsTextItem::<span class="name">~QGraphicsTextItem</span>()</h3>
<p>Destroys the <a href="qgraphicstextitem.html">QGraphicsTextItem</a>.</p>
<!-- @@@~QGraphicsTextItem -->
<!-- $$$adjustSize[overload1]$$$adjustSize -->
<h3 class="fn" id="adjustSize"><a name="adjustSize"></a><span class="type">void</span> QGraphicsTextItem::<span class="name">adjustSize</span>()</h3>
<p>Adjusts the text item to a reasonable size.</p>
<!-- @@@adjustSize -->
<!-- $$$boundingRect[overload1]$$$boundingRect -->
<h3 class="fn" id="boundingRect"><a name="boundingRect"></a><code>[virtual] </code><span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> QGraphicsTextItem::<span class="name">boundingRect</span>() const</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#boundingRect">QGraphicsItem::boundingRect</a>().</p>
<!-- @@@boundingRect -->
<!-- $$$contains[overload1]$$$containsconstQPointF& -->
<h3 class="fn" id="contains"><a name="contains"></a><code>[virtual] </code><span class="type">bool</span> QGraphicsTextItem::<span class="name">contains</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>point</i>) const</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#contains">QGraphicsItem::contains</a>().</p>
<!-- @@@contains -->
<!-- $$$contextMenuEvent[overload1]$$$contextMenuEventQGraphicsSceneContextMenuEvent* -->
<h3 class="fn" id="contextMenuEvent"><a name="contextMenuEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">contextMenuEvent</span>(<span class="type"><a href="qgraphicsscenecontextmenuevent.html">QGraphicsSceneContextMenuEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#contextMenuEvent">QGraphicsItem::contextMenuEvent</a>().</p>
<!-- @@@contextMenuEvent -->
<!-- $$$defaultTextColor[overload1]$$$defaultTextColor -->
<h3 class="fn" id="defaultTextColor"><a name="defaultTextColor"></a><span class="type"><a href="../qtgui/qcolor.html">QColor</a></span> QGraphicsTextItem::<span class="name">defaultTextColor</span>() const</h3>
<p>Returns the default text color that is used for unformatted text.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#setDefaultTextColor">setDefaultTextColor</a>().</p>
<!-- @@@defaultTextColor -->
<!-- $$$document[overload1]$$$document -->
<h3 class="fn" id="document"><a name="document"></a><span class="type"><a href="../qtgui/qtextdocument.html">QTextDocument</a></span> *QGraphicsTextItem::<span class="name">document</span>() const</h3>
<p>Returns the item's text document.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#setDocument">setDocument</a>().</p>
<!-- @@@document -->
<!-- $$$dragEnterEvent[overload1]$$$dragEnterEventQGraphicsSceneDragDropEvent* -->
<h3 class="fn" id="dragEnterEvent"><a name="dragEnterEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">dragEnterEvent</span>(<span class="type"><a href="qgraphicsscenedragdropevent.html">QGraphicsSceneDragDropEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#dragEnterEvent">QGraphicsItem::dragEnterEvent</a>().</p>
<!-- @@@dragEnterEvent -->
<!-- $$$dragLeaveEvent[overload1]$$$dragLeaveEventQGraphicsSceneDragDropEvent* -->
<h3 class="fn" id="dragLeaveEvent"><a name="dragLeaveEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">dragLeaveEvent</span>(<span class="type"><a href="qgraphicsscenedragdropevent.html">QGraphicsSceneDragDropEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#dragLeaveEvent">QGraphicsItem::dragLeaveEvent</a>().</p>
<!-- @@@dragLeaveEvent -->
<!-- $$$dragMoveEvent[overload1]$$$dragMoveEventQGraphicsSceneDragDropEvent* -->
<h3 class="fn" id="dragMoveEvent"><a name="dragMoveEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">dragMoveEvent</span>(<span class="type"><a href="qgraphicsscenedragdropevent.html">QGraphicsSceneDragDropEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#dragMoveEvent">QGraphicsItem::dragMoveEvent</a>().</p>
<!-- @@@dragMoveEvent -->
<!-- $$$dropEvent[overload1]$$$dropEventQGraphicsSceneDragDropEvent* -->
<h3 class="fn" id="dropEvent"><a name="dropEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">dropEvent</span>(<span class="type"><a href="qgraphicsscenedragdropevent.html">QGraphicsSceneDragDropEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#dropEvent">QGraphicsItem::dropEvent</a>().</p>
<!-- @@@dropEvent -->
<!-- $$$focusInEvent[overload1]$$$focusInEventQFocusEvent* -->
<h3 class="fn" id="focusInEvent"><a name="focusInEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">focusInEvent</span>(<span class="type"><a href="../qtgui/qfocusevent.html">QFocusEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#focusInEvent">QGraphicsItem::focusInEvent</a>().</p>
<!-- @@@focusInEvent -->
<!-- $$$focusOutEvent[overload1]$$$focusOutEventQFocusEvent* -->
<h3 class="fn" id="focusOutEvent"><a name="focusOutEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">focusOutEvent</span>(<span class="type"><a href="../qtgui/qfocusevent.html">QFocusEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#focusOutEvent">QGraphicsItem::focusOutEvent</a>().</p>
<!-- @@@focusOutEvent -->
<!-- $$$font[overload1]$$$font -->
<h3 class="fn" id="font"><a name="font"></a><span class="type"><a href="../qtgui/qfont.html">QFont</a></span> QGraphicsTextItem::<span class="name">font</span>() const</h3>
<p>Returns the item's font, which is used to render the text.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#setFont">setFont</a>().</p>
<!-- @@@font -->
<!-- $$$hoverEnterEvent[overload1]$$$hoverEnterEventQGraphicsSceneHoverEvent* -->
<h3 class="fn" id="hoverEnterEvent"><a name="hoverEnterEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">hoverEnterEvent</span>(<span class="type"><a href="qgraphicsscenehoverevent.html">QGraphicsSceneHoverEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#hoverEnterEvent">QGraphicsItem::hoverEnterEvent</a>().</p>
<!-- @@@hoverEnterEvent -->
<!-- $$$hoverLeaveEvent[overload1]$$$hoverLeaveEventQGraphicsSceneHoverEvent* -->
<h3 class="fn" id="hoverLeaveEvent"><a name="hoverLeaveEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">hoverLeaveEvent</span>(<span class="type"><a href="qgraphicsscenehoverevent.html">QGraphicsSceneHoverEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#hoverLeaveEvent">QGraphicsItem::hoverLeaveEvent</a>().</p>
<!-- @@@hoverLeaveEvent -->
<!-- $$$hoverMoveEvent[overload1]$$$hoverMoveEventQGraphicsSceneHoverEvent* -->
<h3 class="fn" id="hoverMoveEvent"><a name="hoverMoveEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">hoverMoveEvent</span>(<span class="type"><a href="qgraphicsscenehoverevent.html">QGraphicsSceneHoverEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#hoverMoveEvent">QGraphicsItem::hoverMoveEvent</a>().</p>
<!-- @@@hoverMoveEvent -->
<!-- $$$inputMethodEvent[overload1]$$$inputMethodEventQInputMethodEvent* -->
<h3 class="fn" id="inputMethodEvent"><a name="inputMethodEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">inputMethodEvent</span>(<span class="type"><a href="../qtgui/qinputmethodevent.html">QInputMethodEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#inputMethodEvent">QGraphicsItem::inputMethodEvent</a>().</p>
<!-- @@@inputMethodEvent -->
<!-- $$$inputMethodQuery[overload1]$$$inputMethodQueryQt::InputMethodQuery -->
<h3 class="fn" id="inputMethodQuery"><a name="inputMethodQuery"></a><code>[virtual protected] </code><span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> QGraphicsTextItem::<span class="name">inputMethodQuery</span>(<span class="type"><a href="../qtcore/qt.html#InputMethodQuery-enum">Qt::InputMethodQuery</a></span> <i>query</i>) const</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#inputMethodQuery">QGraphicsItem::inputMethodQuery</a>().</p>
<!-- @@@inputMethodQuery -->
<!-- $$$isObscuredBy[overload1]$$$isObscuredByconstQGraphicsItem* -->
<h3 class="fn" id="isObscuredBy"><a name="isObscuredBy"></a><code>[virtual] </code><span class="type">bool</span> QGraphicsTextItem::<span class="name">isObscuredBy</span>(const <span class="type"><a href="qgraphicsitem.html#QGraphicsItem">QGraphicsItem</a></span> *<i>item</i>) const</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#isObscuredBy">QGraphicsItem::isObscuredBy</a>().</p>
<!-- @@@isObscuredBy -->
<!-- $$$keyPressEvent[overload1]$$$keyPressEventQKeyEvent* -->
<h3 class="fn" id="keyPressEvent"><a name="keyPressEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">keyPressEvent</span>(<span class="type"><a href="../qtgui/qkeyevent.html">QKeyEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#keyPressEvent">QGraphicsItem::keyPressEvent</a>().</p>
<!-- @@@keyPressEvent -->
<!-- $$$keyReleaseEvent[overload1]$$$keyReleaseEventQKeyEvent* -->
<h3 class="fn" id="keyReleaseEvent"><a name="keyReleaseEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">keyReleaseEvent</span>(<span class="type"><a href="../qtgui/qkeyevent.html">QKeyEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#keyReleaseEvent">QGraphicsItem::keyReleaseEvent</a>().</p>
<!-- @@@keyReleaseEvent -->
<!-- $$$linkActivated[overload1]$$$linkActivatedconstQString& -->
<h3 class="fn" id="linkActivated"><a name="linkActivated"></a><code>[signal] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">linkActivated</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>link</i>)</h3>
<p>This signal is emitted when the user clicks on a link on a text item that enables <a href="../qtcore/qt.html#TextInteractionFlag-enum">Qt::LinksAccessibleByMouse</a> or <a href="../qtcore/qt.html#TextInteractionFlag-enum">Qt::LinksAccessibleByKeyboard</a>. <i>link</i> is the link that was clicked.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#setTextInteractionFlags">setTextInteractionFlags</a>().</p>
<!-- @@@linkActivated -->
<!-- $$$linkHovered[overload1]$$$linkHoveredconstQString& -->
<h3 class="fn" id="linkHovered"><a name="linkHovered"></a><code>[signal] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">linkHovered</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>link</i>)</h3>
<p>This signal is emitted when the user hovers over a link on a text item that enables <a href="../qtcore/qt.html#TextInteractionFlag-enum">Qt::LinksAccessibleByMouse</a>. <i>link</i> is the link that was hovered over.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#setTextInteractionFlags">setTextInteractionFlags</a>().</p>
<!-- @@@linkHovered -->
<!-- $$$mouseDoubleClickEvent[overload1]$$$mouseDoubleClickEventQGraphicsSceneMouseEvent* -->
<h3 class="fn" id="mouseDoubleClickEvent"><a name="mouseDoubleClickEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">mouseDoubleClickEvent</span>(<span class="type"><a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#mouseDoubleClickEvent">QGraphicsItem::mouseDoubleClickEvent</a>().</p>
<!-- @@@mouseDoubleClickEvent -->
<!-- $$$mouseMoveEvent[overload1]$$$mouseMoveEventQGraphicsSceneMouseEvent* -->
<h3 class="fn" id="mouseMoveEvent"><a name="mouseMoveEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">mouseMoveEvent</span>(<span class="type"><a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#mouseMoveEvent">QGraphicsItem::mouseMoveEvent</a>().</p>
<!-- @@@mouseMoveEvent -->
<!-- $$$mousePressEvent[overload1]$$$mousePressEventQGraphicsSceneMouseEvent* -->
<h3 class="fn" id="mousePressEvent"><a name="mousePressEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">mousePressEvent</span>(<span class="type"><a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#mousePressEvent">QGraphicsItem::mousePressEvent</a>().</p>
<!-- @@@mousePressEvent -->
<!-- $$$mouseReleaseEvent[overload1]$$$mouseReleaseEventQGraphicsSceneMouseEvent* -->
<h3 class="fn" id="mouseReleaseEvent"><a name="mouseReleaseEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">mouseReleaseEvent</span>(<span class="type"><a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#mouseReleaseEvent">QGraphicsItem::mouseReleaseEvent</a>().</p>
<!-- @@@mouseReleaseEvent -->
<!-- $$$opaqueArea[overload1]$$$opaqueArea -->
<h3 class="fn" id="opaqueArea"><a name="opaqueArea"></a><code>[virtual] </code><span class="type"><a href="../qtgui/qpainterpath.html">QPainterPath</a></span> QGraphicsTextItem::<span class="name">opaqueArea</span>() const</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#opaqueArea">QGraphicsItem::opaqueArea</a>().</p>
<!-- @@@opaqueArea -->
<!-- $$$paint[overload1]$$$paintQPainter*constQStyleOptionGraphicsItem*QWidget* -->
<h3 class="fn" id="paint"><a name="paint"></a><code>[virtual] </code><span class="type">void</span> QGraphicsTextItem::<span class="name">paint</span>(<span class="type"><a href="../qtgui/qpainter.html">QPainter</a></span> *<i>painter</i>, const <span class="type"><a href="qstyleoptiongraphicsitem.html">QStyleOptionGraphicsItem</a></span> *<i>option</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> *<i>widget</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#paint">QGraphicsItem::paint</a>().</p>
<!-- @@@paint -->
<!-- $$$sceneEvent[overload1]$$$sceneEventQEvent* -->
<h3 class="fn" id="sceneEvent"><a name="sceneEvent"></a><code>[virtual protected] </code><span class="type">bool</span> QGraphicsTextItem::<span class="name">sceneEvent</span>(<span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#sceneEvent">QGraphicsItem::sceneEvent</a>().</p>
<!-- @@@sceneEvent -->
<!-- $$$setDefaultTextColor[overload1]$$$setDefaultTextColorconstQColor& -->
<h3 class="fn" id="setDefaultTextColor"><a name="setDefaultTextColor"></a><span class="type">void</span> QGraphicsTextItem::<span class="name">setDefaultTextColor</span>(const <span class="type"><a href="../qtgui/qcolor.html">QColor</a></span> &amp;<i>col</i>)</h3>
<p>Sets the color for unformatted text to <i>col</i>.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#defaultTextColor">defaultTextColor</a>().</p>
<!-- @@@setDefaultTextColor -->
<!-- $$$setDocument[overload1]$$$setDocumentQTextDocument* -->
<h3 class="fn" id="setDocument"><a name="setDocument"></a><span class="type">void</span> QGraphicsTextItem::<span class="name">setDocument</span>(<span class="type"><a href="../qtgui/qtextdocument.html">QTextDocument</a></span> *<i>document</i>)</h3>
<p>Sets the text document <i>document</i> on the item.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#document">document</a>().</p>
<!-- @@@setDocument -->
<!-- $$$setFont[overload1]$$$setFontconstQFont& -->
<h3 class="fn" id="setFont"><a name="setFont"></a><span class="type">void</span> QGraphicsTextItem::<span class="name">setFont</span>(const <span class="type"><a href="../qtgui/qfont.html">QFont</a></span> &amp;<i>font</i>)</h3>
<p>Sets the font used to render the text item to <i>font</i>.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#font">font</a>().</p>
<!-- @@@setFont -->
<!-- $$$setHtml[overload1]$$$setHtmlconstQString& -->
<h3 class="fn" id="setHtml"><a name="setHtml"></a><span class="type">void</span> QGraphicsTextItem::<span class="name">setHtml</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>)</h3>
<p>Sets the item's text to <i>text</i>, assuming that text is HTML formatted. If the item has keyboard input focus, this function will also call <a href="qgraphicsitem.html#ensureVisible">ensureVisible</a>() to ensure that the text is visible in all viewports.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#toHtml">toHtml</a>(), <a href="qgraphicsitem.html#hasFocus">hasFocus</a>(), and <a href="qgraphicssimpletextitem.html">QGraphicsSimpleTextItem</a>.</p>
<!-- @@@setHtml -->
<!-- $$$setPlainText[overload1]$$$setPlainTextconstQString& -->
<h3 class="fn" id="setPlainText"><a name="setPlainText"></a><span class="type">void</span> QGraphicsTextItem::<span class="name">setPlainText</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>)</h3>
<p>Sets the item's text to <i>text</i>. If the item has keyboard input focus, this function will also call <a href="qgraphicsitem.html#ensureVisible">ensureVisible</a>() to ensure that the text is visible in all viewports.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#toHtml">toHtml</a>() and <a href="qgraphicsitem.html#hasFocus">hasFocus</a>().</p>
<!-- @@@setPlainText -->
<!-- $$$setTabChangesFocus[overload1]$$$setTabChangesFocusbool -->
<h3 class="fn" id="setTabChangesFocus"><a name="setTabChangesFocus"></a><span class="type">void</span> QGraphicsTextItem::<span class="name">setTabChangesFocus</span>(<span class="type">bool</span> <i>b</i>)</h3>
<p>If <i>b</i> is true, the <b>Tab</b> key will cause the widget to change focus; otherwise, the tab key will insert a tab into the document.</p>
<p>In some occasions text edits should not allow the user to input tabulators or change indentation using the <b>Tab</b> key, as this breaks the focus chain. The default is false.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#tabChangesFocus">tabChangesFocus</a>(), <a href="qgraphicsitem.html#GraphicsItemFlag-enum">ItemIsFocusable</a>, and <a href="qgraphicstextitem.html#textInteractionFlags">textInteractionFlags</a>().</p>
<!-- @@@setTabChangesFocus -->
<!-- $$$setTextInteractionFlags[overload1]$$$setTextInteractionFlagsQt::TextInteractionFlags -->
<h3 class="fn" id="setTextInteractionFlags"><a name="setTextInteractionFlags"></a><span class="type">void</span> QGraphicsTextItem::<span class="name">setTextInteractionFlags</span>(<span class="type"><a href="../qtcore/qt.html#TextInteractionFlag-enum">Qt::TextInteractionFlags</a></span> <i>flags</i>)</h3>
<p>Sets the flags <i>flags</i> to specify how the text item should react to user input.</p>
<p>The default for a <a href="qgraphicstextitem.html">QGraphicsTextItem</a> is <a href="../qtcore/qt.html#TextInteractionFlag-enum">Qt::NoTextInteraction</a>. This function also affects the <a href="qgraphicsitem.html#GraphicsItemFlag-enum">ItemIsFocusable</a> <a href="qgraphicsitem.html">QGraphicsItem</a> flag by setting it if <i>flags</i> is different from <a href="../qtcore/qt.html#TextInteractionFlag-enum">Qt::NoTextInteraction</a> and clearing it otherwise.</p>
<p>By default, the text is read-only. To transform the item into an editor, set the <a href="../qtcore/qt.html#TextInteractionFlag-enum">Qt::TextEditable</a> flag.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#textInteractionFlags">textInteractionFlags</a>().</p>
<!-- @@@setTextInteractionFlags -->
<!-- $$$setTextWidth[overload1]$$$setTextWidthqreal -->
<h3 class="fn" id="setTextWidth"><a name="setTextWidth"></a><span class="type">void</span> QGraphicsTextItem::<span class="name">setTextWidth</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>width</i>)</h3>
<p>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.</p>
<p>If <i>width</i> 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.</p>
<p>The default value is -1.</p>
<p>Note that <a href="qgraphicstextitem.html">QGraphicsTextItem</a> keeps a <a href="../qtgui/qtextdocument.html">QTextDocument</a> internally, which is used to calculate the text width.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#textWidth">textWidth</a>() and <a href="../qtgui/qtextdocument.html#textWidth-prop">QTextDocument::setTextWidth</a>().</p>
<!-- @@@setTextWidth -->
<!-- $$$shape[overload1]$$$shape -->
<h3 class="fn" id="shape"><a name="shape"></a><code>[virtual] </code><span class="type"><a href="../qtgui/qpainterpath.html">QPainterPath</a></span> QGraphicsTextItem::<span class="name">shape</span>() const</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#shape">QGraphicsItem::shape</a>().</p>
<!-- @@@shape -->
<!-- $$$tabChangesFocus[overload1]$$$tabChangesFocus -->
<h3 class="fn" id="tabChangesFocus"><a name="tabChangesFocus"></a><span class="type">bool</span> QGraphicsTextItem::<span class="name">tabChangesFocus</span>() const</h3>
<p>Returns <code>true</code> if the <b>Tab</b> key will cause the widget to change focus; otherwise, false is returned.</p>
<p>By default, this behavior is disabled, and this function will return false.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#setTabChangesFocus">setTabChangesFocus</a>().</p>
<!-- @@@tabChangesFocus -->
<!-- $$$textInteractionFlags[overload1]$$$textInteractionFlags -->
<h3 class="fn" id="textInteractionFlags"><a name="textInteractionFlags"></a><span class="type"><a href="../qtcore/qt.html#TextInteractionFlag-enum">Qt::TextInteractionFlags</a></span> QGraphicsTextItem::<span class="name">textInteractionFlags</span>() const</h3>
<p>Returns the current text interaction flags.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#setTextInteractionFlags">setTextInteractionFlags</a>().</p>
<!-- @@@textInteractionFlags -->
<!-- $$$textWidth[overload1]$$$textWidth -->
<h3 class="fn" id="textWidth"><a name="textWidth"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QGraphicsTextItem::<span class="name">textWidth</span>() const</h3>
<p>Returns the text width.</p>
<p>The width is calculated with the <a href="../qtgui/qtextdocument.html">QTextDocument</a> that <a href="qgraphicstextitem.html">QGraphicsTextItem</a> keeps internally.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#setTextWidth">setTextWidth</a>() and <a href="../qtgui/qtextdocument.html#textWidth-prop">QTextDocument::textWidth</a>().</p>
<!-- @@@textWidth -->
<!-- $$$toHtml[overload1]$$$toHtml -->
<h3 class="fn" id="toHtml"><a name="toHtml"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QGraphicsTextItem::<span class="name">toHtml</span>() const</h3>
<p>Returns the item's text converted to HTML, or an empty <a href="../qtcore/qstring.html">QString</a> if no text has been set.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#setHtml">setHtml</a>().</p>
<!-- @@@toHtml -->
<!-- $$$toPlainText[overload1]$$$toPlainText -->
<h3 class="fn" id="toPlainText"><a name="toPlainText"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QGraphicsTextItem::<span class="name">toPlainText</span>() const</h3>
<p>Returns the item's text converted to plain text, or an empty <a href="../qtcore/qstring.html">QString</a> if no text has been set.</p>
<p><b>See also </b><a href="qgraphicstextitem.html#setPlainText">setPlainText</a>().</p>
<!-- @@@toPlainText -->
<!-- $$$type[overload1]$$$type -->
<h3 class="fn" id="type"><a name="type"></a><code>[virtual] </code><span class="type">int</span> QGraphicsTextItem::<span class="name">type</span>() const</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#type">QGraphicsItem::type</a>().</p>
<!-- @@@type -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>