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 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457
|
<?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>QTextEdit 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="../pyqt4ref.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">QTextEdit Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QTextEdit class provides a widget that is used to edit and display both plain and rich text. <a href="#details">More...</a></p>
<p>Inherits <a href="qabstractscrollarea.html">QAbstractScrollArea</a>.</p><p>Inherited by <a href="qtextbrowser.html">QTextBrowser</a>.</p><h3>Types</h3><ul><li><div class="fn" />class <b><a href="qtextedit-autoformatting.html">AutoFormatting</a></b></li><li><div class="fn" />enum <b><a href="qtextedit.html#AutoFormattingFlag-enum">AutoFormattingFlag</a></b> { AutoNone, AutoBulletList, AutoAll }</li><li><div class="fn" />enum <b><a href="qtextedit.html#CursorAction-enum">CursorAction</a></b> { MoveBackward, MoveForward, MoveWordBackward, MoveWordForward, ..., MovePageDown }</li><li><div class="fn" />enum <b><a href="qtextedit.html#LineWrapMode-enum">LineWrapMode</a></b> { NoWrap, WidgetWidth, FixedPixelWidth, FixedColumnWidth }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qtextedit.html#QTextEdit">__init__</a></b> (<i>self</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qtextedit.html#QTextEdit-2">__init__</a></b> (<i>self</i>, QString <i>text</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" />bool <b><a href="qtextedit.html#acceptRichText">acceptRichText</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.Alignment <b><a href="qtextedit.html#alignment">alignment</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qtextedit.html#anchorAt">anchorAt</a></b> (<i>self</i>, QPoint <i>pos</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#append">append</a></b> (<i>self</i>, QString <i>text</i>)</li><li><div class="fn" />AutoFormatting <b><a href="qtextedit.html#autoFormatting">autoFormatting</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtextedit.html#canInsertFromMimeData">canInsertFromMimeData</a></b> (<i>self</i>, QMimeData <i>source</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#changeEvent">changeEvent</a></b> (<i>self</i>, QEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#contextMenuEvent">contextMenuEvent</a></b> (<i>self</i>, QContextMenuEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#copy">copy</a></b> (<i>self</i>)</li><li><div class="fn" />QMimeData <b><a href="qtextedit.html#createMimeDataFromSelection">createMimeDataFromSelection</a></b> (<i>self</i>)</li><li><div class="fn" />QMenu <b><a href="qtextedit.html#createStandardContextMenu">createStandardContextMenu</a></b> (<i>self</i>)</li><li><div class="fn" />QTextCharFormat <b><a href="qtextedit.html#currentCharFormat">currentCharFormat</a></b> (<i>self</i>)</li><li><div class="fn" />QFont <b><a href="qtextedit.html#currentFont">currentFont</a></b> (<i>self</i>)</li><li><div class="fn" />QTextCursor <b><a href="qtextedit.html#cursorForPosition">cursorForPosition</a></b> (<i>self</i>, QPoint <i>pos</i>)</li><li><div class="fn" />QRect <b><a href="qtextedit.html#cursorRect">cursorRect</a></b> (<i>self</i>, QTextCursor <i>cursor</i>)</li><li><div class="fn" />QRect <b><a href="qtextedit.html#cursorRect-2">cursorRect</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#cut">cut</a></b> (<i>self</i>)</li><li><div class="fn" />QTextDocument <b><a href="qtextedit.html#document">document</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qtextedit.html#documentTitle">documentTitle</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#dragEnterEvent">dragEnterEvent</a></b> (<i>self</i>, QDragEnterEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#dragLeaveEvent">dragLeaveEvent</a></b> (<i>self</i>, QDragLeaveEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#dragMoveEvent">dragMoveEvent</a></b> (<i>self</i>, QDragMoveEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#dropEvent">dropEvent</a></b> (<i>self</i>, QDropEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#ensureCursorVisible">ensureCursorVisible</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtextedit.html#event">event</a></b> (<i>self</i>, QEvent <i>e</i>)</li><li><div class="fn" />bool <b><a href="qtextedit.html#find">find</a></b> (<i>self</i>, QString <i>exp</i>, QTextDocument.FindFlags <i>options</i> = 0)</li><li><div class="fn" /><b><a href="qtextedit.html#focusInEvent">focusInEvent</a></b> (<i>self</i>, QFocusEvent <i>e</i>)</li><li><div class="fn" />bool <b><a href="qtextedit.html#focusNextPrevChild">focusNextPrevChild</a></b> (<i>self</i>, bool <i>next</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#focusOutEvent">focusOutEvent</a></b> (<i>self</i>, QFocusEvent <i>e</i>)</li><li><div class="fn" />QString <b><a href="qtextedit.html#fontFamily">fontFamily</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtextedit.html#fontItalic">fontItalic</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtextedit.html#fontPointSize">fontPointSize</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtextedit.html#fontUnderline">fontUnderline</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextedit.html#fontWeight">fontWeight</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#inputMethodEvent">inputMethodEvent</a></b> (<i>self</i>, QInputMethodEvent)</li><li><div class="fn" />QVariant <b><a href="qtextedit.html#inputMethodQuery">inputMethodQuery</a></b> (<i>self</i>, Qt.InputMethodQuery <i>property</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#insertFromMimeData">insertFromMimeData</a></b> (<i>self</i>, QMimeData <i>source</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#insertHtml">insertHtml</a></b> (<i>self</i>, QString <i>text</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#insertPlainText">insertPlainText</a></b> (<i>self</i>, QString <i>text</i>)</li><li><div class="fn" />bool <b><a href="qtextedit.html#isReadOnly">isReadOnly</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtextedit.html#isUndoRedoEnabled">isUndoRedoEnabled</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#keyPressEvent">keyPressEvent</a></b> (<i>self</i>, QKeyEvent <i>e</i>)</li><li><div class="fn" />int <b><a href="qtextedit.html#lineWrapColumnOrWidth">lineWrapColumnOrWidth</a></b> (<i>self</i>)</li><li><div class="fn" />LineWrapMode <b><a href="qtextedit.html#lineWrapMode">lineWrapMode</a></b> (<i>self</i>)</li><li><div class="fn" />QVariant <b><a href="qtextedit.html#loadResource">loadResource</a></b> (<i>self</i>, int <i>type</i>, QUrl <i>name</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#mergeCurrentCharFormat">mergeCurrentCharFormat</a></b> (<i>self</i>, QTextCharFormat <i>modifier</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#mouseDoubleClickEvent">mouseDoubleClickEvent</a></b> (<i>self</i>, QMouseEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#mouseMoveEvent">mouseMoveEvent</a></b> (<i>self</i>, QMouseEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#mousePressEvent">mousePressEvent</a></b> (<i>self</i>, QMouseEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#mouseReleaseEvent">mouseReleaseEvent</a></b> (<i>self</i>, QMouseEvent <i>e</i>)</li><li><div class="fn" />bool <b><a href="qtextedit.html#overwriteMode">overwriteMode</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#paste">paste</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#resizeEvent">resizeEvent</a></b> (<i>self</i>, QResizeEvent)</li><li><div class="fn" /><b><a href="qtextedit.html#scrollContentsBy">scrollContentsBy</a></b> (<i>self</i>, int <i>dx</i>, int <i>dy</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#scrollToAnchor">scrollToAnchor</a></b> (<i>self</i>, QString <i>name</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#selectAll">selectAll</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setAcceptRichText">setAcceptRichText</a></b> (<i>self</i>, bool <i>accept</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setAlignment">setAlignment</a></b> (<i>self</i>, Qt.Alignment <i>a</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setAutoFormatting">setAutoFormatting</a></b> (<i>self</i>, AutoFormatting <i>features</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setCurrentCharFormat">setCurrentCharFormat</a></b> (<i>self</i>, QTextCharFormat <i>format</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setCurrentFont">setCurrentFont</a></b> (<i>self</i>, QFont <i>f</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setDocument">setDocument</a></b> (<i>self</i>, QTextDocument <i>document</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setDocumentTitle">setDocumentTitle</a></b> (<i>self</i>, QString <i>title</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setFontFamily">setFontFamily</a></b> (<i>self</i>, QString <i>fontFamily</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setFontItalic">setFontItalic</a></b> (<i>self</i>, bool <i>b</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setFontPointSize">setFontPointSize</a></b> (<i>self</i>, float <i>s</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setFontUnderline">setFontUnderline</a></b> (<i>self</i>, bool <i>b</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setFontWeight">setFontWeight</a></b> (<i>self</i>, int <i>w</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setHtml">setHtml</a></b> (<i>self</i>, QString <i>text</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setLineWrapColumnOrWidth">setLineWrapColumnOrWidth</a></b> (<i>self</i>, int <i>w</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setLineWrapMode">setLineWrapMode</a></b> (<i>self</i>, LineWrapMode <i>mode</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setOverwriteMode">setOverwriteMode</a></b> (<i>self</i>, bool <i>overwrite</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setPlainText">setPlainText</a></b> (<i>self</i>, QString <i>text</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setReadOnly">setReadOnly</a></b> (<i>self</i>, bool <i>ro</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setTabChangesFocus">setTabChangesFocus</a></b> (<i>self</i>, bool <i>b</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setTabStopWidth">setTabStopWidth</a></b> (<i>self</i>, int <i>width</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setTextColor">setTextColor</a></b> (<i>self</i>, QColor <i>c</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setTextCursor">setTextCursor</a></b> (<i>self</i>, QTextCursor <i>cursor</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setUndoRedoEnabled">setUndoRedoEnabled</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#setWordWrapMode">setWordWrapMode</a></b> (<i>self</i>, QTextOption.WrapMode <i>policy</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#showEvent">showEvent</a></b> (<i>self</i>, QShowEvent)</li><li><div class="fn" />bool <b><a href="qtextedit.html#tabChangesFocus">tabChangesFocus</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextedit.html#tabStopWidth">tabStopWidth</a></b> (<i>self</i>)</li><li><div class="fn" />QColor <b><a href="qtextedit.html#textColor">textColor</a></b> (<i>self</i>)</li><li><div class="fn" />QTextCursor <b><a href="qtextedit.html#textCursor">textCursor</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#timerEvent">timerEvent</a></b> (<i>self</i>, QTimerEvent <i>e</i>)</li><li><div class="fn" />QString <b><a href="qtextedit.html#toHtml">toHtml</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qtextedit.html#toPlainText">toPlainText</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#wheelEvent">wheelEvent</a></b> (<i>self</i>, QWheelEvent <i>e</i>)</li><li><div class="fn" />QTextOption.WrapMode <b><a href="qtextedit.html#wordWrapMode">wordWrapMode</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextedit.html#zoomIn">zoomIn</a></b> (<i>self</i>, int <i>range</i> = 1)</li><li><div class="fn" /><b><a href="qtextedit.html#zoomOut">zoomOut</a></b> (<i>self</i>, int <i>range</i> = 1)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qtextedit.html#copyAvailable">copyAvailable</a></b> (bool)</li><li><div class="fn" />void <b><a href="qtextedit.html#currentCharFormatChanged">currentCharFormatChanged</a></b> (const QTextCharFormat&)</li><li><div class="fn" />void <b><a href="qtextedit.html#cursorPositionChanged">cursorPositionChanged</a></b> ()</li><li><div class="fn" />void <b><a href="qtextedit.html#redoAvailable">redoAvailable</a></b> (bool)</li><li><div class="fn" />void <b><a href="qtextedit.html#selectionChanged">selectionChanged</a></b> ()</li><li><div class="fn" />void <b><a href="qtextedit.html#textChanged">textChanged</a></b> ()</li><li><div class="fn" />void <b><a href="qtextedit.html#undoAvailable">undoAvailable</a></b> (bool)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QTextEdit class provides a widget that is used to edit and display both plain and rich text.</p>
<ul>
<li><a href="#introduction-and-concepts">Introduction and Concepts</a></li>
<li><a href="#using-qtextedit-as-a-display-widget">Using QTextEdit as a Display Widget</a></li>
<li style="list-style: none">
<ul>
<li><a href="#read-only-key-bindings">Read-only Key Bindings</a></li>
</ul>
</li>
<li><a href="#using-qtextedit-as-an-editor">Using QTextEdit as an Editor</a></li>
<li style="list-style: none">
<ul>
<li><a href="#editing-key-bindings">Editing Key Bindings</a></li>
</ul>
</li>
</ul>
<a id="introduction-and-concepts" name="introduction-and-concepts" />
<h3>Introduction and Concepts</h3>
<p>QTextEdit is an advanced WYSIWYG viewer/editor supporting rich text formatting using HTML-style tags. It is optimized to handle large documents and to respond quickly to user input.</p>
<p>QTextEdit works on paragraphs and characters. A paragraph is a formatted string which is word-wrapped to fit into the width of the widget. By default when reading plain text, one newline signifies a paragraph. A document consists of zero or more paragraphs. The words in the paragraph are aligned in accordance with the paragraph's alignment. Paragraphs are separated by hard line breaks. Each character within a paragraph has its own attributes, for example, font and color.</p>
<p>QTextEdit can display images, lists and tables. If the text is too large to view within the text edit's viewport, scrollbars will appear. The text edit can load both plain text and HTML files (a subset of HTML 3.2 and 4).</p>
<p>If you just need to display a small piece of rich text use <a href="qlabel.html">QLabel</a>.</p>
<p>Note that we do not intend to add a full-featured web browser widget to Qt (because that would easily double Qt's size and only a few applications would benefit from it). The rich text support in Qt is designed to provide a fast, portable and efficient way to add reasonable online help facilities to applications, and to provide a basis for rich text editors.</p>
<a id="using-qtextedit-as-a-display-widget" name="using-qtextedit-as-a-display-widget" />
<h3>Using QTextEdit as a Display Widget</h3>
<p>QTextEdit can display a large HTML subset, including tables and images.</p>
<p>The text is set or replaced using <a href="qtextedit.html#html-prop">setHtml</a>() which deletes any existing text and replaces it with the text passed in the <a href="qtextedit.html#html-prop">setHtml</a>() call. If you call <a href="qtextedit.html#html-prop">setHtml</a>() with legacy HTML, and then call <a href="qtextedit-qt3.html#text">text</a>(), the text that is returned may have different markup, but will render the same. The entire text can be deleted with <a href="qtextedit.html#clear">clear</a>().</p>
<p>Text itself can be inserted using the <a href="qtextcursor.html">QTextCursor</a> class or using the convenience functions <a href="qtextedit.html#insertHtml">insertHtml</a>(), <a href="qtextedit.html#insertPlainText">insertPlainText</a>(), <a href="qtextedit.html#append">append</a>() or <a href="qtextedit.html#paste">paste</a>(). <a href="qtextcursor.html">QTextCursor</a> is also able to insert complex objects like tables or lists into the document, and it deals with creating selections and applying changes to selected text.</p>
<p>By default the text edit wraps words at whitespace to fit within the text edit widget. The <a href="qtextedit.html#lineWrapMode-prop">setLineWrapMode</a>() function is used to specify the kind of line wrap you want, or <a href="qtextedit.html#LineWrapMode-enum">NoWrap</a> if you don't want any wrapping. Call <a href="qtextedit.html#lineWrapMode-prop">setLineWrapMode</a>() to set a fixed pixel width <a href="qtextedit.html#LineWrapMode-enum">FixedPixelWidth</a>, or character column (e.g. 80 column) <a href="qtextedit.html#LineWrapMode-enum">FixedColumnWidth</a> with the pixels or columns specified with <a href="qtextedit.html#lineWrapColumnOrWidth-prop">setLineWrapColumnOrWidth</a>(). If you use word wrap to the widget's width <a href="qtextedit.html#LineWrapMode-enum">WidgetWidth</a>, you can specify whether to break on whitespace or anywhere with <a href="qtextedit.html#wordWrapMode-prop">setWordWrapMode</a>().</p>
<p>The <a href="qtextedit.html#find">find</a>() function can be used to find and select a given string within the text.</p>
<a id="read-only-key-bindings" name="read-only-key-bindings" />
<h4>Read-only Key Bindings</h4>
<p>When QTextEdit is used read-only the key bindings are limited to navigation, and text may only be selected with the mouse:</p>
<table align="center" border="0" cellpadding="2" cellspacing="1">
<tr bgcolor="#A2C511" valign="top">
<th>Keypresses</th>
<th>Action</th>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td><a href="qt.html#ArrowType-enum">Qt.UpArrow</a></td>
<td>Moves one line up.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td><a href="qt.html#ArrowType-enum">Qt.DownArrow</a></td>
<td>Moves one line down.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td><a href="qt.html#ArrowType-enum">Qt.LeftArrow</a></td>
<td>Moves one character to the left.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td><a href="qt.html#ArrowType-enum">Qt.RightArrow</a></td>
<td>Moves one character to the right.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>PageUp</td>
<td>Moves one (viewport) page up.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>PageDown</td>
<td>Moves one (viewport) page down.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Home</td>
<td>Moves to the beginning of the text.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>End</td>
<td>Moves to the end of the text.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Alt+Wheel</td>
<td>Scrolls the page horizontally (the Wheel is the mouse wheel).</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>Ctrl+Wheel</td>
<td>Zooms the text.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Ctrl+A</td>
<td>Selects all text.</td>
</tr>
</table>
<br />
<br />
<p>The text edit may be able to provide some meta-information. For example, the <a href="qtextedit.html#documentTitle-prop">documentTitle</a>() function will return the text from within HTML <tt><title></tt> tags.</p>
<a id="using-qtextedit-as-an-editor" name="using-qtextedit-as-an-editor" />
<h3>Using QTextEdit as an Editor</h3>
<p>All the information about using QTextEdit as a display widget also applies here.</p>
<p>The current char format's attributes are set with <a href="qtextedit.html#setFontItalic">setFontItalic</a>(), <a href="qtextedit.html#setFontWeight">setFontWeight</a>(), <a href="qtextedit.html#setFontUnderline">setFontUnderline</a>(), <a href="qtextedit.html#setFontFamily">setFontFamily</a>(), <a href="qtextedit.html#setFontPointSize">setFontPointSize</a>(), <a href="qtextedit.html#setTextColor">setTextColor</a>() and <a href="qtextedit.html#setCurrentFont">setCurrentFont</a>(). The current paragraph's alignment is set with <a href="qtextedit.html#setAlignment">setAlignment</a>().</p>
<p>Selection of text is handled by the <a href="qtextcursor.html">QTextCursor</a> class, which provides functionality for creating selections, retrieving the text contents or deleting selections. You can retrieve the object that corresponds with the user-visible cursor using the <a href="qtextedit.html#textCursor">textCursor</a>() method. If you want to set a selection in QTextEdit just create one on a <a href="qtextcursor.html">QTextCursor</a> object and then make that cursor the visible cursor using <a href="qwidget.html#cursor-prop">setCursor</a>(). The selection can be copied to the clipboard with <a href="qtextedit.html#copy">copy</a>(), or cut to the clipboard with <a href="qtextedit.html#cut">cut</a>(). The entire text can be selected using <a href="qtextedit.html#selectAll">selectAll</a>().</p>
<p>When the cursor is moved and the underlying formatting attributes change, the <a href="qtextedit.html#currentCharFormatChanged">currentCharFormatChanged</a>() signal is emitted to reflect the new attributes at the new cursor position.</p>
<p>QTextEdit holds a <a href="qtextdocument.html">QTextDocument</a> object which can be retrieved using the <a href="qtextedit.html#document">document</a>() method. You can also set your own document object using <a href="qtextedit.html#setDocument">setDocument</a>(). <a href="qtextdocument.html">QTextDocument</a> emits a <a href="qtextedit.html#textChanged">textChanged</a>() signal if the text changes and it also provides a <a href="qtextedit-qt3.html#isModified">isModified</a>() function which will return true if the text has been modified since it was either loaded or since the last call to setModified with false as argument. In addition it provides methods for undo and redo.</p>
<a id="editing-key-bindings" name="editing-key-bindings" />
<h4>Editing Key Bindings</h4>
<p>The list of key bindings which are implemented for editing:</p>
<table align="center" border="0" cellpadding="2" cellspacing="1">
<tr bgcolor="#A2C511" valign="top">
<th>Keypresses</th>
<th>Action</th>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Backspace</td>
<td>Deletes the character to the left of the cursor.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>Delete</td>
<td>Deletes the character to the right of the cursor.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Ctrl+C</td>
<td>Copy the selected text to the clipboard.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>Ctrl+Insert</td>
<td>Copy the selected text to the clipboard.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Ctrl+K</td>
<td>Deletes to the end of the line.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>Ctrl+V</td>
<td>Pastes the clipboard text into text edit.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Shift+Insert</td>
<td>Pastes the clipboard text into text edit.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>Ctrl+X</td>
<td>Deletes the selected text and copies it to the clipboard.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Shift+Delete</td>
<td>Deletes the selected text and copies it to the clipboard.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>Ctrl+Z</td>
<td>Undoes the last operation.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Ctrl+Y</td>
<td>Redoes the last operation.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>LeftArrow</td>
<td>Moves the cursor one character to the left.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Ctrl+LeftArrow</td>
<td>Moves the cursor one word to the left.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>RightArrow</td>
<td>Moves the cursor one character to the right.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Ctrl+RightArrow</td>
<td>Moves the cursor one word to the right.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>UpArrow</td>
<td>Moves the cursor one line up.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Ctrl+UpArrow</td>
<td>Moves the cursor one word up.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>DownArrow</td>
<td>Moves the cursor one line down.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Ctrl+Down Arrow</td>
<td>Moves the cursor one word down.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>PageUp</td>
<td>Moves the cursor one page up.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>PageDown</td>
<td>Moves the cursor one page down.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>Home</td>
<td>Moves the cursor to the beginning of the line.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Ctrl+Home</td>
<td>Moves the cursor to the beginning of the text.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>End</td>
<td>Moves the cursor to the end of the line.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Ctrl+End</td>
<td>Moves the cursor to the end of the text.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>Alt+Wheel</td>
<td>Scrolls the page horizontally (the Wheel is the mouse wheel).</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Ctrl+Wheel</td>
<td>Zooms the text.</td>
</tr>
</table>
<br />
<br />
<p>To select (mark) text hold down the Shift key whilst pressing one of the movement keystrokes, for example, <i>Shift+Right Arrow</i> will select the character to the right, and <i>Shift+Ctrl+Right Arrow</i> will select the word to the right, etc.</p>
<p>See also <a href="qtextdocument.html">QTextDocument</a>, <a href="qtextcursor.html">QTextCursor</a>, <a href="qtextedit.html#document">document</a>(), <a href="qtextedit.html#textCursor">textCursor</a>(), <a href="qtextedit.html#setDocument">setDocument</a>(), and <a href="qtextedit.html#setTextCursor">setTextCursor</a>().</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="AutoFormattingFlag-enum" />QTextEdit.AutoFormattingFlag</h3><table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr>
<th width="25%">Constant</th>
<th width="15%">Value</th>
<th width="60%">Description</th>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.AutoNone</tt></td>
<td align="center" valign="top"><tt>0</tt></td>
<td valign="top">Don't do any automatic formatting.</td>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.AutoBulletList</tt></td>
<td align="center" valign="top"><tt>0x00000001</tt></td>
<td valign="top">Automatically create bullet lists (e.g. when the user enters an asterisk ('*') in the left most column, or presses Enter in an existing list item.</td>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.AutoAll</tt></td>
<td align="center" valign="top"><tt>0xffffffff</tt></td>
<td valign="top">Apply all automatic formatting. Currently only automatic bullet lists are supported.</td>
</tr>
</table>
<br />
<br />
<p>The AutoFormatting type is a typedef for <a href="qflags.html">QFlags</a><AutoFormattingFlag>. It stores an OR combination of AutoFormattingFlag values.</p>
<h3 class="fn"><a name="CursorAction-enum" />QTextEdit.CursorAction</h3><table border="1" cellpadding="2" cellspacing="1" width="40%">
<tr>
<th width="60%">Constant</th>
<th width="40%">Value</th>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.MoveBackward</tt></td>
<td align="center" valign="top"><tt>0</tt></td>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.MoveForward</tt></td>
<td align="center" valign="top"><tt>1</tt></td>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.MoveWordBackward</tt></td>
<td align="center" valign="top"><tt>2</tt></td>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.MoveWordForward</tt></td>
<td align="center" valign="top"><tt>3</tt></td>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.MoveUp</tt></td>
<td align="center" valign="top"><tt>4</tt></td>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.MoveDown</tt></td>
<td align="center" valign="top"><tt>5</tt></td>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.MoveLineStart</tt></td>
<td align="center" valign="top"><tt>6</tt></td>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.MoveLineEnd</tt></td>
<td align="center" valign="top"><tt>7</tt></td>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.MoveHome</tt></td>
<td align="center" valign="top"><tt>8</tt></td>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.MoveEnd</tt></td>
<td align="center" valign="top"><tt>9</tt></td>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.MovePageUp</tt></td>
<td align="center" valign="top"><tt>10</tt></td>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.MovePageDown</tt></td>
<td align="center" valign="top"><tt>11</tt></td>
</tr>
</table>
<br />
<br />
<h3 class="fn"><a name="LineWrapMode-enum" />QTextEdit.LineWrapMode</h3><table border="1" cellpadding="2" cellspacing="1" width="40%">
<tr>
<th width="60%">Constant</th>
<th width="40%">Value</th>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.NoWrap</tt></td>
<td align="center" valign="top"><tt>0</tt></td>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.WidgetWidth</tt></td>
<td align="center" valign="top"><tt>1</tt></td>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.FixedPixelWidth</tt></td>
<td align="center" valign="top"><tt>2</tt></td>
</tr>
<tr>
<td valign="top"><tt>QTextEdit.FixedColumnWidth</tt></td>
<td align="center" valign="top"><tt>3</tt></td>
</tr>
</table>
<br />
<br />
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QTextEdit" />QTextEdit.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</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>Constructs an empty <a href="qtextedit.html">QTextEdit</a> with parent <i>parent</i>.</p>
<h3 class="fn"><a name="QTextEdit-2" />QTextEdit.__init__ (<i>self</i>, <a href="qstring.html">QString</a> <i>text</i>, <a href="qwidget.html">QWidget</a> <i>parent</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>Constructs a <a href="qtextedit.html">QTextEdit</a> with parent <i>parent</i>. The text edit will display the text <i>text</i>. The text is interpreted as html.</p>
<h3 class="fn"><a name="acceptRichText" />bool QTextEdit.acceptRichText (<i>self</i>)</h3><h3 class="fn"><a name="alignment" /><a href="qt-alignment.html">Qt.Alignment</a> QTextEdit.alignment (<i>self</i>)</h3><p>Returns the alignment of the current paragraph.</p>
<p>See also <a href="qtextedit.html#setAlignment">setAlignment</a>().</p>
<h3 class="fn"><a name="anchorAt" /><a href="qstring.html">QString</a> QTextEdit.anchorAt (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>pos</i>)</h3><p>Returns the reference of the anchor at position <i>pos</i>, or an empty string if no anchor exists at that point.</p>
<h3 class="fn"><a name="append" />QTextEdit.append (<i>self</i>, <a href="qstring.html">QString</a> <i>text</i>)</h3><p>Appends a new paragraph with <i>text</i> to the end of the text edit.</p>
<h3 class="fn"><a name="autoFormatting" /><a href="qtextedit-autoformatting.html">AutoFormatting</a> QTextEdit.autoFormatting (<i>self</i>)</h3><h3 class="fn"><a name="canInsertFromMimeData" />bool QTextEdit.canInsertFromMimeData (<i>self</i>, <a href="qmimedata.html">QMimeData</a> <i>source</i>)</h3><p>This function returns true if the contents of the MIME data object, specified by <i>source</i>, can be decoded and inserted into the document. It is called for example when during a drag operation the mouse enters this widget and it is necessary to determine whether it is possible to accept the drag.</p>
<h3 class="fn"><a name="changeEvent" />QTextEdit.changeEvent (<i>self</i>, <a href="qevent.html">QEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="clear" />QTextEdit.clear (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void clear()</tt>.</p><p>Deletes all the text in the text edit.</p>
<p>Note that the undo/redo history is cleared by this function.</p>
<p>See also <a href="qtextedit.html#cut">cut</a>(), <a href="qtextedit.html#setPlainText">setPlainText</a>(), and <a href="qtextedit.html#html-prop">setHtml</a>().</p>
<h3 class="fn"><a name="contextMenuEvent" />QTextEdit.contextMenuEvent (<i>self</i>, <a href="qcontextmenuevent.html">QContextMenuEvent</a> <i>e</i>)</h3><p>Shows the standard context menu created with <a href="qtextedit.html#createStandardContextMenu">createStandardContextMenu</a>().</p>
<p>If you do not want the text edit to have a context menu, you can set its <a href="qwidget.html#contextMenuPolicy-prop">contextMenuPolicy</a> to <a href="qt.html#ContextMenuPolicy-enum">Qt.NoContextMenu</a>. If you want to customize the context menu, reimplement this function. If you want to extend the standard context menu, reimplement this function, call <a href="qtextedit.html#createStandardContextMenu">createStandardContextMenu</a>() and extend the menu returned.</p>
<p>Information about the event is passed in <i>e</i>.</p>
<pre>
void TextEdit.contextMenuEvent(QContextMenuEvent * e) {
QMenu *menu = createStandardContextMenu();
menu->addAction(My Menu Item");
//...
menu->exec(e->globalPos());
delete menu;
}
</pre>
<p>Reimplemented from <a href="qwidget.html#contextMenuEvent">QWidget</a>.</p>
<h3 class="fn"><a name="copy" />QTextEdit.copy (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void copy()</tt>.</p><p>Copies any selected text to the clipboard.</p>
<p>See also <a href="qtextedit.html#copyAvailable">copyAvailable</a>().</p>
<h3 class="fn"><a name="createMimeDataFromSelection" /><a href="qmimedata.html">QMimeData</a> QTextEdit.createMimeDataFromSelection (<i>self</i>)</h3><p>This function returns a new MIME data object to represent the contents of the text edit's current selection. It is called when the selection needs to be encapsulated into a new <a href="qmimedata.html">QMimeData</a> object; for example, when a drag and drop operation is started, or when data is copyied to the clipboard.</p>
<p>If you reimplement this function, note that the ownership of the returned <a href="qmimedata.html">QMimeData</a> object is passed to the caller. The selection can be retrieved by using the <a href="qtextedit.html#textCursor">textCursor</a>() function.</p>
<h3 class="fn"><a name="createStandardContextMenu" /><a href="qmenu.html">QMenu</a> QTextEdit.createStandardContextMenu (<i>self</i>)</h3><p>This function creates the standard context menu which is shown when the user clicks on the line edit with the right mouse button. It is called from the default <a href="qtextedit.html#contextMenuEvent">contextMenuEvent</a>() handler. The popup menu's ownership is transferred to the caller.</p>
<h3 class="fn"><a name="currentCharFormat" /><a href="qtextcharformat.html">QTextCharFormat</a> QTextEdit.currentCharFormat (<i>self</i>)</h3><p>Returns the char format that is used when inserting new text.</p>
<p>See also <a href="qtextedit.html#setCurrentCharFormat">setCurrentCharFormat</a>().</p>
<h3 class="fn"><a name="currentFont" /><a href="qfont.html">QFont</a> QTextEdit.currentFont (<i>self</i>)</h3><p>Returns the font of the current format.</p>
<p>See also <a href="qtextedit.html#setCurrentFont">setCurrentFont</a>(), <a href="qtextedit.html#setFontFamily">setFontFamily</a>(), and <a href="qtextedit.html#setFontPointSize">setFontPointSize</a>().</p>
<h3 class="fn"><a name="cursorForPosition" /><a href="qtextcursor.html">QTextCursor</a> QTextEdit.cursorForPosition (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>pos</i>)</h3><p>returns a <a href="qtextcursor.html">QTextCursor</a> at position <i>pos</i> (in viewport coordinates).</p>
<h3 class="fn"><a name="cursorRect" /><a href="qrect.html">QRect</a> QTextEdit.cursorRect (<i>self</i>, <a href="qtextcursor.html">QTextCursor</a> <i>cursor</i>)</h3><p>returns a rectangle (in viewport coordinates) that includes the <i>cursor</i>.</p>
<h3 class="fn"><a name="cursorRect-2" /><a href="qrect.html">QRect</a> QTextEdit.cursorRect (<i>self</i>)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p>returns a rectangle (in viewport coordinates) that includes the cursor of the text edit.</p>
<h3 class="fn"><a name="cut" />QTextEdit.cut (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void cut()</tt>.</p><p>Copies the selected text to the clipboard and deletes it from the text edit.</p>
<p>If there is no selected text nothing happens.</p>
<p>See also <a href="qtextedit.html#copy">copy</a>() and <a href="qtextedit.html#paste">paste</a>().</p>
<h3 class="fn"><a name="document" /><a href="qtextdocument.html">QTextDocument</a> QTextEdit.document (<i>self</i>)</h3><p>Returns a pointer to the underlying document.</p>
<p>See also <a href="qtextedit.html#setDocument">setDocument</a>().</p>
<h3 class="fn"><a name="documentTitle" /><a href="qstring.html">QString</a> QTextEdit.documentTitle (<i>self</i>)</h3><h3 class="fn"><a name="dragEnterEvent" />QTextEdit.dragEnterEvent (<i>self</i>, <a href="qdragenterevent.html">QDragEnterEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="dragLeaveEvent" />QTextEdit.dragLeaveEvent (<i>self</i>, <a href="qdragleaveevent.html">QDragLeaveEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="dragMoveEvent" />QTextEdit.dragMoveEvent (<i>self</i>, <a href="qdragmoveevent.html">QDragMoveEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="dropEvent" />QTextEdit.dropEvent (<i>self</i>, <a href="qdropevent.html">QDropEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="ensureCursorVisible" />QTextEdit.ensureCursorVisible (<i>self</i>)</h3><p>Ensures that the cursor is visible by scrolling the text edit if necessary.</p>
<h3 class="fn"><a name="event" />bool QTextEdit.event (<i>self</i>, <a href="qevent.html">QEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="find" />bool QTextEdit.find (<i>self</i>, <a href="qstring.html">QString</a> <i>exp</i>, <a href="qtextdocument-findflags.html">QTextDocument.FindFlags</a> <i>options</i> = 0)</h3><p>Finds the next occurrence of the string, <i>exp</i>, using the given <i>options</i>. Returns true if <i>exp</i> was found and changes the cursor to select the match; otherwise returns false.</p>
<h3 class="fn"><a name="focusInEvent" />QTextEdit.focusInEvent (<i>self</i>, <a href="qfocusevent.html">QFocusEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="focusNextPrevChild" />bool QTextEdit.focusNextPrevChild (<i>self</i>, bool <i>next</i>)</h3><h3 class="fn"><a name="focusOutEvent" />QTextEdit.focusOutEvent (<i>self</i>, <a href="qfocusevent.html">QFocusEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="fontFamily" /><a href="qstring.html">QString</a> QTextEdit.fontFamily (<i>self</i>)</h3><p>Returns the font family of the current format.</p>
<p>See also <a href="qtextedit.html#setFontFamily">setFontFamily</a>(), <a href="qtextedit.html#setCurrentFont">setCurrentFont</a>(), and <a href="qtextedit.html#setFontPointSize">setFontPointSize</a>().</p>
<h3 class="fn"><a name="fontItalic" />bool QTextEdit.fontItalic (<i>self</i>)</h3><p>Returns true if the font of the current format is italic; otherwise returns false.</p>
<p>See also <a href="qtextedit.html#setFontItalic">setFontItalic</a>().</p>
<h3 class="fn"><a name="fontPointSize" />float QTextEdit.fontPointSize (<i>self</i>)</h3><p>Returns the point size of the font of the current format.</p>
<p>See also <a href="qtextedit.html#setFontFamily">setFontFamily</a>(), <a href="qtextedit.html#setCurrentFont">setCurrentFont</a>(), and <a href="qtextedit.html#setFontPointSize">setFontPointSize</a>().</p>
<h3 class="fn"><a name="fontUnderline" />bool QTextEdit.fontUnderline (<i>self</i>)</h3><p>Returns true if the font of the current format is underlined; otherwise returns false.</p>
<p>See also <a href="qtextedit.html#setFontUnderline">setFontUnderline</a>().</p>
<h3 class="fn"><a name="fontWeight" />int QTextEdit.fontWeight (<i>self</i>)</h3><p>Returns the font weight of the current format.</p>
<p>See also <a href="qtextedit.html#setFontWeight">setFontWeight</a>(), <a href="qtextedit.html#setCurrentFont">setCurrentFont</a>(), <a href="qtextedit.html#setFontPointSize">setFontPointSize</a>(), and <a href="qfont.html#Weight-enum">QFont.Weight</a>.</p>
<h3 class="fn"><a name="inputMethodEvent" />QTextEdit.inputMethodEvent (<i>self</i>, <a href="qinputmethodevent.html">QInputMethodEvent</a>)</h3><h3 class="fn"><a name="inputMethodQuery" /><a href="qvariant.html">QVariant</a> QTextEdit.inputMethodQuery (<i>self</i>, <a href="qt.html#InputMethodQuery-enum">Qt.InputMethodQuery</a> <i>property</i>)</h3><h3 class="fn"><a name="insertFromMimeData" />QTextEdit.insertFromMimeData (<i>self</i>, <a href="qmimedata.html">QMimeData</a> <i>source</i>)</h3><p>This function inserts the contents of the MIME data object, specified by <i>source</i>, into the text edit at the current cursor position. It is called whenever text is inserted as the result of a clipboard paste operation, or when the text edit accepts data from a drag and drop operation.</p>
<h3 class="fn"><a name="insertHtml" />QTextEdit.insertHtml (<i>self</i>, <a href="qstring.html">QString</a> <i>text</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void insertHtml(const QString&)</tt>.</p><p>Convenience slot that inserts <i>text</i> which is assumed to be of html formatting at the current cursor position.</p>
<p>It is equivalent to:</p>
<pre>
QTextDocumentFragment fragment = QTextDocumentFragment.fromHtml(text);
edit->textCursor().insertFragment(fragment);
</pre>
<h3 class="fn"><a name="insertPlainText" />QTextEdit.insertPlainText (<i>self</i>, <a href="qstring.html">QString</a> <i>text</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void insertPlainText(const QString&)</tt>.</p><p>Convenience slot that inserts <i>text</i> at the current cursor position.</p>
<p>It is equivalent to</p>
<pre>
edit->textCursor().insertText(text);
</pre>
<h3 class="fn"><a name="isReadOnly" />bool QTextEdit.isReadOnly (<i>self</i>)</h3><h3 class="fn"><a name="isUndoRedoEnabled" />bool QTextEdit.isUndoRedoEnabled (<i>self</i>)</h3><h3 class="fn"><a name="keyPressEvent" />QTextEdit.keyPressEvent (<i>self</i>, <a href="qkeyevent.html">QKeyEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="lineWrapColumnOrWidth" />int QTextEdit.lineWrapColumnOrWidth (<i>self</i>)</h3><h3 class="fn"><a name="lineWrapMode" /><a href="qtextedit.html#LineWrapMode-enum">LineWrapMode</a> QTextEdit.lineWrapMode (<i>self</i>)</h3><h3 class="fn"><a name="loadResource" /><a href="qvariant.html">QVariant</a> QTextEdit.loadResource (<i>self</i>, int <i>type</i>, <a href="qurl.html">QUrl</a> <i>name</i>)</h3><p>Loads the resource specified by the given <i>type</i> and <i>name</i>.</p>
<p>This function is an extension of <a href="qtextdocument.html#loadResource">QTextDocument.loadResource</a>().</p>
<p>See also <a href="qtextdocument.html#loadResource">QTextDocument.loadResource</a>().</p>
<h3 class="fn"><a name="mergeCurrentCharFormat" />QTextEdit.mergeCurrentCharFormat (<i>self</i>, <a href="qtextcharformat.html">QTextCharFormat</a> <i>modifier</i>)</h3><p>If the editor has a selection then the properties of <i>modifier</i> are applied to the selection. Without a selection the properties are applied to the word under the cursor. In addition they are always merged into the current char format.</p>
<p>See also <a href="qtextcursor.html#mergeCharFormat">QTextCursor.mergeCharFormat</a>().</p>
<h3 class="fn"><a name="mouseDoubleClickEvent" />QTextEdit.mouseDoubleClickEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="mouseMoveEvent" />QTextEdit.mouseMoveEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="mousePressEvent" />QTextEdit.mousePressEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="mouseReleaseEvent" />QTextEdit.mouseReleaseEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="overwriteMode" />bool QTextEdit.overwriteMode (<i>self</i>)</h3><h3 class="fn"><a name="paintEvent" />QTextEdit.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="paste" />QTextEdit.paste (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void paste()</tt>.</p><p>Pastes the text from the clipboard into the text edit at the current cursor position.</p>
<p>If there is no text in the clipboard nothing happens.</p>
<p>To change the behavior of this function, i.e. to modify what <a href="qtextedit.html">QTextEdit</a> can paste and how it is being pasted, reimplement the virtual <a href="qtextedit.html#canInsertFromMimeData">canInsertFromMimeData</a>() and <a href="qtextedit.html#insertFromMimeData">insertFromMimeData</a>() functions.</p>
<p>See also <a href="qtextedit.html#cut">cut</a>() and <a href="qtextedit.html#copy">copy</a>().</p>
<h3 class="fn"><a name="resizeEvent" />QTextEdit.resizeEvent (<i>self</i>, <a href="qresizeevent.html">QResizeEvent</a>)</h3><h3 class="fn"><a name="scrollContentsBy" />QTextEdit.scrollContentsBy (<i>self</i>, int <i>dx</i>, int <i>dy</i>)</h3><h3 class="fn"><a name="scrollToAnchor" />QTextEdit.scrollToAnchor (<i>self</i>, <a href="qstring.html">QString</a> <i>name</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void scrollToAnchor(const QString&)</tt>.</p><p>Scrolls the text edit so that the anchor with the given <i>name</i> is visible; does nothing if the <i>name</i> is empty, or is already visible, or isn't found.</p>
<h3 class="fn"><a name="selectAll" />QTextEdit.selectAll (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void selectAll()</tt>.</p><p>Selects all text.</p>
<p>See also <a href="qtextedit.html#copy">copy</a>(), <a href="qtextedit.html#cut">cut</a>(), and <a href="qtextedit.html#textCursor">textCursor</a>().</p>
<h3 class="fn"><a name="setAcceptRichText" />QTextEdit.setAcceptRichText (<i>self</i>, bool <i>accept</i>)</h3><h3 class="fn"><a name="setAlignment" />QTextEdit.setAlignment (<i>self</i>, <a href="qt-alignment.html">Qt.Alignment</a> <i>a</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setAlignment(Qt::Alignment)</tt>.</p><p>Sets the alignment of the current paragraph to <i>a</i>. Valid alignments are <a href="qt.html#AlignmentFlag-enum">Qt.AlignLeft</a>, <a href="qt.html#AlignmentFlag-enum">Qt.AlignRight</a>, <a href="qt.html#AlignmentFlag-enum">Qt.AlignJustify</a> and <a href="qt.html#AlignmentFlag-enum">Qt.AlignCenter</a> (which centers horizontally).</p>
<p>See also <a href="qtextedit.html#alignment">alignment</a>().</p>
<h3 class="fn"><a name="setAutoFormatting" />QTextEdit.setAutoFormatting (<i>self</i>, <a href="qtextedit-autoformatting.html">AutoFormatting</a> <i>features</i>)</h3><h3 class="fn"><a name="setCurrentCharFormat" />QTextEdit.setCurrentCharFormat (<i>self</i>, <a href="qtextcharformat.html">QTextCharFormat</a> <i>format</i>)</h3><p>Sets the char format that is be used when inserting new text to <i>format</i> .</p>
<p>See also <a href="qtextedit.html#currentCharFormat">currentCharFormat</a>().</p>
<h3 class="fn"><a name="setCurrentFont" />QTextEdit.setCurrentFont (<i>self</i>, <a href="qfont.html">QFont</a> <i>f</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setCurrentFont(const QFont&)</tt>.</p><p>Sets the font of the current format to <i>f</i>.</p>
<p>See also <a href="qtextedit.html#currentFont">currentFont</a>(), <a href="qtextedit.html#setFontPointSize">setFontPointSize</a>(), and <a href="qtextedit.html#setFontFamily">setFontFamily</a>().</p>
<h3 class="fn"><a name="setDocument" />QTextEdit.setDocument (<i>self</i>, <a href="qtextdocument.html">QTextDocument</a> <i>document</i>)</h3><p>Makes <i>document</i> the new document of the text editor.</p>
<p>The parent <a href="qobject.html">QObject</a> of the provided document remains the owner of the object. If the current document is a child of the text editor, then it is deleted.</p>
<p>See also <a href="qtextedit.html#document">document</a>().</p>
<h3 class="fn"><a name="setDocumentTitle" />QTextEdit.setDocumentTitle (<i>self</i>, <a href="qstring.html">QString</a> <i>title</i>)</h3><h3 class="fn"><a name="setFontFamily" />QTextEdit.setFontFamily (<i>self</i>, <a href="qstring.html">QString</a> <i>fontFamily</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setFontFamily(const QString&)</tt>.</p><p>Sets the font family of the current format to <i>fontFamily</i>.</p>
<p>See also <a href="qtextedit.html#fontFamily">fontFamily</a>() and <a href="qtextedit.html#setCurrentFont">setCurrentFont</a>().</p>
<h3 class="fn"><a name="setFontItalic" />QTextEdit.setFontItalic (<i>self</i>, bool <i>b</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setFontItalic(bool)</tt>.</p><p>If <i>italic</i> is true, sets the current format to italic; otherwise sets the current format to non-italic.</p>
<p>See also <a href="qtextedit.html#fontItalic">fontItalic</a>().</p>
<h3 class="fn"><a name="setFontPointSize" />QTextEdit.setFontPointSize (<i>self</i>, float <i>s</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setFontPointSize(double)</tt>.</p><p>Sets the point size of the current format to <i>s</i>.</p>
<p>Note that if <i>s</i> is zero or negative, the behavior of this function is not defined.</p>
<p>See also <a href="qtextedit.html#fontPointSize">fontPointSize</a>(), <a href="qtextedit.html#setCurrentFont">setCurrentFont</a>(), and <a href="qtextedit.html#setFontFamily">setFontFamily</a>().</p>
<h3 class="fn"><a name="setFontUnderline" />QTextEdit.setFontUnderline (<i>self</i>, bool <i>b</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setFontUnderline(bool)</tt>.</p><p>If <i>underline</i> is true, sets the current format to underline; otherwise sets the current format to non-underline.</p>
<p>See also <a href="qtextedit.html#fontUnderline">fontUnderline</a>().</p>
<h3 class="fn"><a name="setFontWeight" />QTextEdit.setFontWeight (<i>self</i>, int <i>w</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setFontWeight(int)</tt>.</p><p>Sets the font weight of the current format to <i>w</i>.</p>
<p>See also <a href="qtextedit.html#fontWeight">fontWeight</a>(), <a href="qtextedit.html#setCurrentFont">setCurrentFont</a>(), <a href="qtextedit.html#setFontFamily">setFontFamily</a>(), and <a href="qfont.html#Weight-enum">QFont.Weight</a>.</p>
<h3 class="fn"><a name="setHtml" />QTextEdit.setHtml (<i>self</i>, <a href="qstring.html">QString</a> <i>text</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setHtml(const QString&)</tt>.</p><h3 class="fn"><a name="setLineWrapColumnOrWidth" />QTextEdit.setLineWrapColumnOrWidth (<i>self</i>, int <i>w</i>)</h3><h3 class="fn"><a name="setLineWrapMode" />QTextEdit.setLineWrapMode (<i>self</i>, <a href="qtextedit.html#LineWrapMode-enum">LineWrapMode</a> <i>mode</i>)</h3><h3 class="fn"><a name="setOverwriteMode" />QTextEdit.setOverwriteMode (<i>self</i>, bool <i>overwrite</i>)</h3><h3 class="fn"><a name="setPlainText" />QTextEdit.setPlainText (<i>self</i>, <a href="qstring.html">QString</a> <i>text</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setPlainText(const QString&)</tt>.</p><p>Changes the text of the text edit to the string <i>text</i>. Any previous text is removed.</p>
<p><i>text</i> is interpreted as plain text.</p>
<p>Note that the undo/redo history is cleared by this function.</p>
<p>See also <a href="qtextedit.html#toPlainText">toPlainText</a>().</p>
<h3 class="fn"><a name="setReadOnly" />QTextEdit.setReadOnly (<i>self</i>, bool <i>ro</i>)</h3><h3 class="fn"><a name="setTabChangesFocus" />QTextEdit.setTabChangesFocus (<i>self</i>, bool <i>b</i>)</h3><h3 class="fn"><a name="setTabStopWidth" />QTextEdit.setTabStopWidth (<i>self</i>, int <i>width</i>)</h3><h3 class="fn"><a name="setTextColor" />QTextEdit.setTextColor (<i>self</i>, <a href="qcolor.html">QColor</a> <i>c</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setTextColor(const QColor&)</tt>.</p><p>Sets the text color of the current format to <i>c</i>.</p>
<p>See also <a href="qtextedit.html#textColor">textColor</a>().</p>
<h3 class="fn"><a name="setTextCursor" />QTextEdit.setTextCursor (<i>self</i>, <a href="qtextcursor.html">QTextCursor</a> <i>cursor</i>)</h3><p>Sets the visible <i>cursor</i>.</p>
<p>See also <a href="qtextedit.html#textCursor">textCursor</a>().</p>
<h3 class="fn"><a name="setUndoRedoEnabled" />QTextEdit.setUndoRedoEnabled (<i>self</i>, bool <i>enable</i>)</h3><h3 class="fn"><a name="setWordWrapMode" />QTextEdit.setWordWrapMode (<i>self</i>, <a href="qtextoption.html#WrapMode-enum">QTextOption.WrapMode</a> <i>policy</i>)</h3><h3 class="fn"><a name="showEvent" />QTextEdit.showEvent (<i>self</i>, <a href="qshowevent.html">QShowEvent</a>)</h3><h3 class="fn"><a name="tabChangesFocus" />bool QTextEdit.tabChangesFocus (<i>self</i>)</h3><h3 class="fn"><a name="tabStopWidth" />int QTextEdit.tabStopWidth (<i>self</i>)</h3><h3 class="fn"><a name="textColor" /><a href="qcolor.html">QColor</a> QTextEdit.textColor (<i>self</i>)</h3><p>Returns the text color of the current format.</p>
<p>See also <a href="qtextedit.html#setTextColor">setTextColor</a>().</p>
<h3 class="fn"><a name="textCursor" /><a href="qtextcursor.html">QTextCursor</a> QTextEdit.textCursor (<i>self</i>)</h3><p>Returns a copy of the <a href="qtextcursor.html">QTextCursor</a> that represents the currently visible cursor. Note that changes on the returned cursor do not affect <a href="qtextedit.html">QTextEdit</a>'s cursor; use <a href="qtextedit.html#setTextCursor">setTextCursor</a>() to update the visible cursor.</p>
<p>See also <a href="qtextedit.html#setTextCursor">setTextCursor</a>().</p>
<h3 class="fn"><a name="timerEvent" />QTextEdit.timerEvent (<i>self</i>, <a href="qtimerevent.html">QTimerEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="toHtml" /><a href="qstring.html">QString</a> QTextEdit.toHtml (<i>self</i>)</h3><h3 class="fn"><a name="toPlainText" /><a href="qstring.html">QString</a> QTextEdit.toPlainText (<i>self</i>)</h3><p>Returns the text of the text edit as plain text.</p>
<p>See also <a href="qtextedit.html#setPlainText">QTextEdit.setPlainText</a>().</p>
<h3 class="fn"><a name="wheelEvent" />QTextEdit.wheelEvent (<i>self</i>, <a href="qwheelevent.html">QWheelEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="wordWrapMode" /><a href="qtextoption.html#WrapMode-enum">QTextOption.WrapMode</a> QTextEdit.wordWrapMode (<i>self</i>)</h3><h3 class="fn"><a name="zoomIn" />QTextEdit.zoomIn (<i>self</i>, int <i>range</i> = 1)</h3><p>This method is also a Qt slot with the C++ signature <tt>void zoomIn(int = 1)</tt>.</p><p>Zooms in on the text by by making the base font size <i>range</i> points larger and recalculating all font sizes to be the new size. This does not change the size of any images.</p>
<p>See also <a href="qtextedit.html#zoomOut">zoomOut</a>().</p>
<h3 class="fn"><a name="zoomOut" />QTextEdit.zoomOut (<i>self</i>, int <i>range</i> = 1)</h3><p>This method is also a Qt slot with the C++ signature <tt>void zoomOut(int = 1)</tt>.</p><p>Zooms out on the text by making the base font size <i>range</i> points smaller and recalculating all font sizes to be the new size. This does not change the size of any images.</p>
<p>See also <a href="qtextedit.html#zoomIn">zoomIn</a>().</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="copyAvailable" />void copyAvailable (bool)</h3><p>This signal is emitted when text is selected or de-selected in the text edit.</p>
<p>When text is selected this signal will be emitted with <i>yes</i> set to true. If no text has been selected or if the selected text is de-selected this signal is emitted with <i>yes</i> set to false.</p>
<p>If <i>yes</i> is true then <a href="qtextedit.html#copy">copy</a>() can be used to copy the selection to the clipboard. If <i>yes</i> is false then <a href="qtextedit.html#copy">copy</a>() does nothing.</p>
<p>See also <a href="qtextedit.html#selectionChanged">selectionChanged</a>().</p>
<h3 class="fn"><a name="currentCharFormatChanged" />void currentCharFormatChanged (const QTextCharFormat&)</h3><p>This signal is emitted if the current character format has changed, for example caused by a change of the cursor position.</p>
<p>The new format is <i>f</i>.</p>
<p>See also <a href="qtextedit.html#setCurrentCharFormat">setCurrentCharFormat</a>().</p>
<h3 class="fn"><a name="cursorPositionChanged" />void cursorPositionChanged ()</h3><p>This signal is emitted whenever the position of the cursor changed.</p>
<h3 class="fn"><a name="redoAvailable" />void redoAvailable (bool)</h3><p>This signal is emitted whenever redo operations become available (<i>available</i> is true) or unavailable (<i>available</i> is false).</p>
<h3 class="fn"><a name="selectionChanged" />void selectionChanged ()</h3><p>This signal is emitted whenever the selection changes.</p>
<p>See also <a href="qtextedit.html#copyAvailable">copyAvailable</a>().</p>
<h3 class="fn"><a name="textChanged" />void textChanged ()</h3><p>This signal is emitted whenever the document's content changes; for example, when text is inserted or deleted, or when formatting is applied.</p>
<h3 class="fn"><a name="undoAvailable" />void undoAvailable (bool)</h3><p>This signal is emitted whenever undo operations become available (<i>available</i> is true) or unavailable (<i>available</i> is false).</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt 4.0.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.trolltech.com">Trolltech AS</a> 2006</td><td align="right" width="25%">Qt 4.1.4</td></tr></table></div></address></body></html>
|