1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QGraphicsTextItem Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QGraphicsTextItem Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QGraphicsTextItem 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>
<p>Inherits <a href="qgraphicsobject.html">QGraphicsObject</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qgraphicstextitem.html#QGraphicsTextItem">__init__</a></b> (<i>self</i>, QGraphicsItem <i>parent</i> = None, QGraphicsScene <i>scene</i> = None)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#QGraphicsTextItem-2">__init__</a></b> (<i>self</i>, QString <i>text</i>, QGraphicsItem <i>parent</i> = None, QGraphicsScene <i>scene</i> = None)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#adjustSize">adjustSize</a></b> (<i>self</i>)</li><li><div class="fn" />QRectF <b><a href="qgraphicstextitem.html#boundingRect">boundingRect</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qgraphicstextitem.html#contains">contains</a></b> (<i>self</i>, QPointF <i>point</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#contextMenuEvent">contextMenuEvent</a></b> (<i>self</i>, QGraphicsSceneContextMenuEvent <i>event</i>)</li><li><div class="fn" />QColor <b><a href="qgraphicstextitem.html#defaultTextColor">defaultTextColor</a></b> (<i>self</i>)</li><li><div class="fn" />QTextDocument <b><a href="qgraphicstextitem.html#document">document</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#dragEnterEvent">dragEnterEvent</a></b> (<i>self</i>, QGraphicsSceneDragDropEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#dragLeaveEvent">dragLeaveEvent</a></b> (<i>self</i>, QGraphicsSceneDragDropEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#dragMoveEvent">dragMoveEvent</a></b> (<i>self</i>, QGraphicsSceneDragDropEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#dropEvent">dropEvent</a></b> (<i>self</i>, QGraphicsSceneDragDropEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#focusInEvent">focusInEvent</a></b> (<i>self</i>, QFocusEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#focusOutEvent">focusOutEvent</a></b> (<i>self</i>, QFocusEvent <i>event</i>)</li><li><div class="fn" />QFont <b><a href="qgraphicstextitem.html#font">font</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#hoverEnterEvent">hoverEnterEvent</a></b> (<i>self</i>, QGraphicsSceneHoverEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#hoverLeaveEvent">hoverLeaveEvent</a></b> (<i>self</i>, QGraphicsSceneHoverEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#hoverMoveEvent">hoverMoveEvent</a></b> (<i>self</i>, QGraphicsSceneHoverEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#inputMethodEvent">inputMethodEvent</a></b> (<i>self</i>, QInputMethodEvent <i>event</i>)</li><li><div class="fn" />QVariant <b><a href="qgraphicstextitem.html#inputMethodQuery">inputMethodQuery</a></b> (<i>self</i>, Qt.InputMethodQuery <i>query</i>)</li><li><div class="fn" />bool <b><a href="qgraphicstextitem.html#isObscuredBy">isObscuredBy</a></b> (<i>self</i>, QGraphicsItem <i>item</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#keyPressEvent">keyPressEvent</a></b> (<i>self</i>, QKeyEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#keyReleaseEvent">keyReleaseEvent</a></b> (<i>self</i>, QKeyEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#mouseDoubleClickEvent">mouseDoubleClickEvent</a></b> (<i>self</i>, QGraphicsSceneMouseEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#mouseMoveEvent">mouseMoveEvent</a></b> (<i>self</i>, QGraphicsSceneMouseEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#mousePressEvent">mousePressEvent</a></b> (<i>self</i>, QGraphicsSceneMouseEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#mouseReleaseEvent">mouseReleaseEvent</a></b> (<i>self</i>, QGraphicsSceneMouseEvent <i>event</i>)</li><li><div class="fn" />QPainterPath <b><a href="qgraphicstextitem.html#opaqueArea">opaqueArea</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qgraphicstextitem.html#openExternalLinks">openExternalLinks</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#paint">paint</a></b> (<i>self</i>, QPainter <i>painter</i>, QStyleOptionGraphicsItem <i>option</i>, QWidget <i>widget</i>)</li><li><div class="fn" />bool <b><a href="qgraphicstextitem.html#sceneEvent">sceneEvent</a></b> (<i>self</i>, QEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#setDefaultTextColor">setDefaultTextColor</a></b> (<i>self</i>, QColor <i>c</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#setDocument">setDocument</a></b> (<i>self</i>, QTextDocument <i>document</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#setFont">setFont</a></b> (<i>self</i>, QFont <i>font</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#setHtml">setHtml</a></b> (<i>self</i>, QString <i>html</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#setOpenExternalLinks">setOpenExternalLinks</a></b> (<i>self</i>, bool <i>open</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#setPlainText">setPlainText</a></b> (<i>self</i>, QString <i>text</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#setTabChangesFocus">setTabChangesFocus</a></b> (<i>self</i>, bool <i>b</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#setTextCursor">setTextCursor</a></b> (<i>self</i>, QTextCursor <i>cursor</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#setTextInteractionFlags">setTextInteractionFlags</a></b> (<i>self</i>, Qt.TextInteractionFlags <i>flags</i>)</li><li><div class="fn" /><b><a href="qgraphicstextitem.html#setTextWidth">setTextWidth</a></b> (<i>self</i>, float <i>width</i>)</li><li><div class="fn" />QPainterPath <b><a href="qgraphicstextitem.html#shape">shape</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qgraphicstextitem.html#tabChangesFocus">tabChangesFocus</a></b> (<i>self</i>)</li><li><div class="fn" />QTextCursor <b><a href="qgraphicstextitem.html#textCursor">textCursor</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.TextInteractionFlags <b><a href="qgraphicstextitem.html#textInteractionFlags">textInteractionFlags</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qgraphicstextitem.html#textWidth">textWidth</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qgraphicstextitem.html#toHtml">toHtml</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qgraphicstextitem.html#toPlainText">toPlainText</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qgraphicstextitem.html#type">type</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qgraphicstextitem.html#linkActivated">linkActivated</a></b> (const QString&)</li><li><div class="fn" />void <b><a href="qgraphicstextitem.html#linkHovered">linkHovered</a></b> (const QString&)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QGraphicsTextItem 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="qstring.html">QString</a> to QGraphicsTextItem's constructor, or
call <a href="qgraphicstextitem.html#setHtml">setHtml</a>()/<a href="qgraphicstextitem.html#setPlainText">setPlainText</a>().</p>
<p>QGraphicsTextItem 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="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.</p>
<p class="centerAlign"><img alt="" src="images/graphicsview-textitem.png" /></p>
<p><b>Note:</b> QGraphicsTextItem accepts <a href="qgraphicsitem.html#acceptHoverEvents">hover events</a> by default.
You can change this with <a href="qgraphicsitem.html#setAcceptHoverEvents">setAcceptHoverEvents()</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QGraphicsTextItem" />QGraphicsTextItem.__init__ (<i>self</i>, <a href="qgraphicsitem.html">QGraphicsItem</a> <i>parent</i> = None, <a href="qgraphicsscene.html">QGraphicsScene</a> <i>scene</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>The <i>scene</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><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>
<h3 class="fn"><a name="QGraphicsTextItem-2" />QGraphicsTextItem.__init__ (<i>self</i>, QString <i>text</i>, <a href="qgraphicsitem.html">QGraphicsItem</a> <i>parent</i> = None, <a href="qgraphicsscene.html">QGraphicsScene</a> <i>scene</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>The <i>scene</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><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>
<h3 class="fn"><a name="adjustSize" />QGraphicsTextItem.adjustSize (<i>self</i>)</h3><p>Adjusts the text item to a reasonable size.</p>
<h3 class="fn"><a name="boundingRect" /><a href="qrectf.html">QRectF</a> QGraphicsTextItem.boundingRect (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#boundingRect">QGraphicsItem.boundingRect</a>().</p>
<h3 class="fn"><a name="contains" />bool QGraphicsTextItem.contains (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>point</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#contains">QGraphicsItem.contains</a>().</p>
<h3 class="fn"><a name="contextMenuEvent" />QGraphicsTextItem.contextMenuEvent (<i>self</i>, <a href="qgraphicsscenecontextmenuevent.html">QGraphicsSceneContextMenuEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#contextMenuEvent">QGraphicsItem.contextMenuEvent</a>().</p>
<h3 class="fn"><a name="defaultTextColor" /><a href="qcolor.html">QColor</a> QGraphicsTextItem.defaultTextColor (<i>self</i>)</h3><p>Returns the default text color that is used to for unformatted
text.</p>
<p><b>See also</b> <a href="qgraphicstextitem.html#setDefaultTextColor">setDefaultTextColor</a>().</p>
<h3 class="fn"><a name="document" /><a href="qtextdocument.html">QTextDocument</a> QGraphicsTextItem.document (<i>self</i>)</h3><p>Returns the item's text document.</p>
<p><b>See also</b> <a href="qgraphicstextitem.html#setDocument">setDocument</a>().</p>
<h3 class="fn"><a name="dragEnterEvent" />QGraphicsTextItem.dragEnterEvent (<i>self</i>, <a href="qgraphicsscenedragdropevent.html">QGraphicsSceneDragDropEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#dragEnterEvent">QGraphicsItem.dragEnterEvent</a>().</p>
<h3 class="fn"><a name="dragLeaveEvent" />QGraphicsTextItem.dragLeaveEvent (<i>self</i>, <a href="qgraphicsscenedragdropevent.html">QGraphicsSceneDragDropEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#dragLeaveEvent">QGraphicsItem.dragLeaveEvent</a>().</p>
<h3 class="fn"><a name="dragMoveEvent" />QGraphicsTextItem.dragMoveEvent (<i>self</i>, <a href="qgraphicsscenedragdropevent.html">QGraphicsSceneDragDropEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#dragMoveEvent">QGraphicsItem.dragMoveEvent</a>().</p>
<h3 class="fn"><a name="dropEvent" />QGraphicsTextItem.dropEvent (<i>self</i>, <a href="qgraphicsscenedragdropevent.html">QGraphicsSceneDragDropEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#dropEvent">QGraphicsItem.dropEvent</a>().</p>
<h3 class="fn"><a name="focusInEvent" />QGraphicsTextItem.focusInEvent (<i>self</i>, <a href="qfocusevent.html">QFocusEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#focusInEvent">QGraphicsItem.focusInEvent</a>().</p>
<h3 class="fn"><a name="focusOutEvent" />QGraphicsTextItem.focusOutEvent (<i>self</i>, <a href="qfocusevent.html">QFocusEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#focusOutEvent">QGraphicsItem.focusOutEvent</a>().</p>
<h3 class="fn"><a name="font" /><a href="qfont.html">QFont</a> QGraphicsTextItem.font (<i>self</i>)</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>
<h3 class="fn"><a name="hoverEnterEvent" />QGraphicsTextItem.hoverEnterEvent (<i>self</i>, <a href="qgraphicsscenehoverevent.html">QGraphicsSceneHoverEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#hoverEnterEvent">QGraphicsItem.hoverEnterEvent</a>().</p>
<h3 class="fn"><a name="hoverLeaveEvent" />QGraphicsTextItem.hoverLeaveEvent (<i>self</i>, <a href="qgraphicsscenehoverevent.html">QGraphicsSceneHoverEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#hoverLeaveEvent">QGraphicsItem.hoverLeaveEvent</a>().</p>
<h3 class="fn"><a name="hoverMoveEvent" />QGraphicsTextItem.hoverMoveEvent (<i>self</i>, <a href="qgraphicsscenehoverevent.html">QGraphicsSceneHoverEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#hoverMoveEvent">QGraphicsItem.hoverMoveEvent</a>().</p>
<h3 class="fn"><a name="inputMethodEvent" />QGraphicsTextItem.inputMethodEvent (<i>self</i>, <a href="qinputmethodevent.html">QInputMethodEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#inputMethodEvent">QGraphicsItem.inputMethodEvent</a>().</p>
<h3 class="fn"><a name="inputMethodQuery" />QVariant QGraphicsTextItem.inputMethodQuery (<i>self</i>, <a href="qt.html#InputMethodQuery-enum">Qt.InputMethodQuery</a> <i>query</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#inputMethodQuery">QGraphicsItem.inputMethodQuery</a>().</p>
<h3 class="fn"><a name="isObscuredBy" />bool QGraphicsTextItem.isObscuredBy (<i>self</i>, <a href="qgraphicsitem.html">QGraphicsItem</a> <i>item</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#isObscuredBy">QGraphicsItem.isObscuredBy</a>().</p>
<h3 class="fn"><a name="keyPressEvent" />QGraphicsTextItem.keyPressEvent (<i>self</i>, <a href="qkeyevent.html">QKeyEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#keyPressEvent">QGraphicsItem.keyPressEvent</a>().</p>
<h3 class="fn"><a name="keyReleaseEvent" />QGraphicsTextItem.keyReleaseEvent (<i>self</i>, <a href="qkeyevent.html">QKeyEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#keyReleaseEvent">QGraphicsItem.keyReleaseEvent</a>().</p>
<h3 class="fn"><a name="mouseDoubleClickEvent" />QGraphicsTextItem.mouseDoubleClickEvent (<i>self</i>, <a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#mouseDoubleClickEvent">QGraphicsItem.mouseDoubleClickEvent</a>().</p>
<h3 class="fn"><a name="mouseMoveEvent" />QGraphicsTextItem.mouseMoveEvent (<i>self</i>, <a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#mouseMoveEvent">QGraphicsItem.mouseMoveEvent</a>().</p>
<h3 class="fn"><a name="mousePressEvent" />QGraphicsTextItem.mousePressEvent (<i>self</i>, <a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#mousePressEvent">QGraphicsItem.mousePressEvent</a>().</p>
<h3 class="fn"><a name="mouseReleaseEvent" />QGraphicsTextItem.mouseReleaseEvent (<i>self</i>, <a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#mouseReleaseEvent">QGraphicsItem.mouseReleaseEvent</a>().</p>
<h3 class="fn"><a name="opaqueArea" /><a href="qpainterpath.html">QPainterPath</a> QGraphicsTextItem.opaqueArea (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#opaqueArea">QGraphicsItem.opaqueArea</a>().</p>
<h3 class="fn"><a name="openExternalLinks" />bool QGraphicsTextItem.openExternalLinks (<i>self</i>)</h3><h3 class="fn"><a name="paint" />QGraphicsTextItem.paint (<i>self</i>, <a href="qpainter.html">QPainter</a> <i>painter</i>, <a href="qstyleoptiongraphicsitem.html">QStyleOptionGraphicsItem</a> <i>option</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#paint">QGraphicsItem.paint</a>().</p>
<h3 class="fn"><a name="sceneEvent" />bool QGraphicsTextItem.sceneEvent (<i>self</i>, <a href="qevent.html">QEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#sceneEvent">QGraphicsItem.sceneEvent</a>().</p>
<h3 class="fn"><a name="setDefaultTextColor" />QGraphicsTextItem.setDefaultTextColor (<i>self</i>, <a href="qcolor.html">QColor</a> <i>c</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>
<h3 class="fn"><a name="setDocument" />QGraphicsTextItem.setDocument (<i>self</i>, <a href="qtextdocument.html">QTextDocument</a> <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>
<h3 class="fn"><a name="setFont" />QGraphicsTextItem.setFont (<i>self</i>, <a href="qfont.html">QFont</a> <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>
<h3 class="fn"><a name="setHtml" />QGraphicsTextItem.setHtml (<i>self</i>, QString <i>html</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>
<h3 class="fn"><a name="setOpenExternalLinks" />QGraphicsTextItem.setOpenExternalLinks (<i>self</i>, bool <i>open</i>)</h3><h3 class="fn"><a name="setPlainText" />QGraphicsTextItem.setPlainText (<i>self</i>, QString <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>
<h3 class="fn"><a name="setTabChangesFocus" />QGraphicsTextItem.setTabChangesFocus (<i>self</i>, bool <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>
<h3 class="fn"><a name="setTextCursor" />QGraphicsTextItem.setTextCursor (<i>self</i>, <a href="qtextcursor.html">QTextCursor</a> <i>cursor</i>)</h3><h3 class="fn"><a name="setTextInteractionFlags" />QGraphicsTextItem.setTextInteractionFlags (<i>self</i>, <a href="qt-textinteractionflags.html">Qt.TextInteractionFlags</a> <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="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="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="qt.html#TextInteractionFlag-enum">Qt.TextEditable</a> flag.</p>
<p><b>See also</b> <a href="qgraphicstextitem.html#textInteractionFlags">textInteractionFlags</a>().</p>
<h3 class="fn"><a name="setTextWidth" />QGraphicsTextItem.setTextWidth (<i>self</i>, float <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="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="qtextdocument.html#textWidth-prop">QTextDocument.setTextWidth</a>().</p>
<h3 class="fn"><a name="shape" /><a href="qpainterpath.html">QPainterPath</a> QGraphicsTextItem.shape (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#shape">QGraphicsItem.shape</a>().</p>
<h3 class="fn"><a name="tabChangesFocus" />bool QGraphicsTextItem.tabChangesFocus (<i>self</i>)</h3><p>Returns true 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>
<h3 class="fn"><a name="textCursor" /><a href="qtextcursor.html">QTextCursor</a> QGraphicsTextItem.textCursor (<i>self</i>)</h3><h3 class="fn"><a name="textInteractionFlags" /><a href="qt-textinteractionflags.html">Qt.TextInteractionFlags</a> QGraphicsTextItem.textInteractionFlags (<i>self</i>)</h3><p>Returns the current text interaction flags.</p>
<p><b>See also</b> <a href="qgraphicstextitem.html#setTextInteractionFlags">setTextInteractionFlags</a>().</p>
<h3 class="fn"><a name="textWidth" />float QGraphicsTextItem.textWidth (<i>self</i>)</h3><p>Returns the text width.</p>
<p>The width is calculated with the <a href="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="qtextdocument.html#textWidth-prop">QTextDocument.textWidth</a>().</p>
<h3 class="fn"><a name="toHtml" />QString QGraphicsTextItem.toHtml (<i>self</i>)</h3><p>Returns the item's text converted to HTML, or an empty <a href="qstring.html">QString</a> if no text has been set.</p>
<p><b>See also</b> <a href="qgraphicstextitem.html#setHtml">setHtml</a>().</p>
<h3 class="fn"><a name="toPlainText" />QString QGraphicsTextItem.toPlainText (<i>self</i>)</h3><p>Returns the item's text converted to plain text, or an empty
<a href="qstring.html">QString</a> if no text has been set.</p>
<p><b>See also</b> <a href="qgraphicstextitem.html#setPlainText">setPlainText</a>().</p>
<h3 class="fn"><a name="type" />int QGraphicsTextItem.type (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#type">QGraphicsItem.type</a>().</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="linkActivated" />void linkActivated (const QString&)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the user clicks on a link on a text
item that enables <a href="qt.html#TextInteractionFlag-enum">Qt.LinksAccessibleByMouse</a>
or <a href="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>
<h3 class="fn"><a name="linkHovered" />void linkHovered (const QString&)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the user hovers over a link on a
text item that enables <a href="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>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.12.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt 4.8.7</td></tr></table></div></address></body></html>
|