Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 929

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?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>QPlainTextEdit 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">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QPlainTextEdit Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QPlainTextEdit class provides a widget that is used to edit
and display plain text. <a href="#details">More...</a></p>

<p>Inherits <a href="qabstractscrollarea.html">QAbstractScrollArea</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qplaintextedit.html#LineWrapMode-enum">LineWrapMode</a></b> { NoWrap, WidgetWidth }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qplaintextedit.html#QPlainTextEdit">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qplaintextedit.html#QPlainTextEdit-2">__init__</a></b> (<i>self</i>, QString&#160;<i>text</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />QString <b><a href="qplaintextedit.html#anchorAt">anchorAt</a></b> (<i>self</i>, QPoint&#160;<i>pos</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#appendHtml">appendHtml</a></b> (<i>self</i>, QString&#160;<i>html</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#appendPlainText">appendPlainText</a></b> (<i>self</i>, QString&#160;<i>text</i>)</li><li><div class="fn" />bool <b><a href="qplaintextedit.html#backgroundVisible">backgroundVisible</a></b> (<i>self</i>)</li><li><div class="fn" />QRectF <b><a href="qplaintextedit.html#blockBoundingGeometry">blockBoundingGeometry</a></b> (<i>self</i>, QTextBlock&#160;<i>block</i>)</li><li><div class="fn" />QRectF <b><a href="qplaintextedit.html#blockBoundingRect">blockBoundingRect</a></b> (<i>self</i>, QTextBlock&#160;<i>block</i>)</li><li><div class="fn" />int <b><a href="qplaintextedit.html#blockCount">blockCount</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qplaintextedit.html#canInsertFromMimeData">canInsertFromMimeData</a></b> (<i>self</i>, QMimeData&#160;<i>source</i>)</li><li><div class="fn" />bool <b><a href="qplaintextedit.html#canPaste">canPaste</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#centerCursor">centerCursor</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qplaintextedit.html#centerOnScroll">centerOnScroll</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#changeEvent">changeEvent</a></b> (<i>self</i>, QEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" />QPointF <b><a href="qplaintextedit.html#contentOffset">contentOffset</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#contextMenuEvent">contextMenuEvent</a></b> (<i>self</i>, QContextMenuEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#copy">copy</a></b> (<i>self</i>)</li><li><div class="fn" />QMimeData <b><a href="qplaintextedit.html#createMimeDataFromSelection">createMimeDataFromSelection</a></b> (<i>self</i>)</li><li><div class="fn" />QMenu <b><a href="qplaintextedit.html#createStandardContextMenu">createStandardContextMenu</a></b> (<i>self</i>)</li><li><div class="fn" />QTextCharFormat <b><a href="qplaintextedit.html#currentCharFormat">currentCharFormat</a></b> (<i>self</i>)</li><li><div class="fn" />QTextCursor <b><a href="qplaintextedit.html#cursorForPosition">cursorForPosition</a></b> (<i>self</i>, QPoint&#160;<i>pos</i>)</li><li><div class="fn" />QRect <b><a href="qplaintextedit.html#cursorRect">cursorRect</a></b> (<i>self</i>, QTextCursor&#160;<i>cursor</i>)</li><li><div class="fn" />QRect <b><a href="qplaintextedit.html#cursorRect-2">cursorRect</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qplaintextedit.html#cursorWidth">cursorWidth</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#cut">cut</a></b> (<i>self</i>)</li><li><div class="fn" />QTextDocument <b><a href="qplaintextedit.html#document">document</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qplaintextedit.html#documentTitle">documentTitle</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#dragEnterEvent">dragEnterEvent</a></b> (<i>self</i>, QDragEnterEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#dragLeaveEvent">dragLeaveEvent</a></b> (<i>self</i>, QDragLeaveEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#dragMoveEvent">dragMoveEvent</a></b> (<i>self</i>, QDragMoveEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#dropEvent">dropEvent</a></b> (<i>self</i>, QDropEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#ensureCursorVisible">ensureCursorVisible</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qplaintextedit.html#event">event</a></b> (<i>self</i>, QEvent&#160;<i>e</i>)</li><li><div class="fn" />list-of-QTextEdit.ExtraSelection <b><a href="qplaintextedit.html#extraSelections">extraSelections</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qplaintextedit.html#find">find</a></b> (<i>self</i>, QString&#160;<i>exp</i>, QTextDocument.FindFlags&#160;<i>options</i>&#160;=&#160;0)</li><li><div class="fn" />QTextBlock <b><a href="qplaintextedit.html#firstVisibleBlock">firstVisibleBlock</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#focusInEvent">focusInEvent</a></b> (<i>self</i>, QFocusEvent&#160;<i>e</i>)</li><li><div class="fn" />bool <b><a href="qplaintextedit.html#focusNextPrevChild">focusNextPrevChild</a></b> (<i>self</i>, bool&#160;<i>next</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#focusOutEvent">focusOutEvent</a></b> (<i>self</i>, QFocusEvent&#160;<i>e</i>)</li><li><div class="fn" />QAbstractTextDocumentLayout.PaintContext <b><a href="qplaintextedit.html#getPaintContext">getPaintContext</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#inputMethodEvent">inputMethodEvent</a></b> (<i>self</i>, QInputMethodEvent)</li><li><div class="fn" />QVariant <b><a href="qplaintextedit.html#inputMethodQuery">inputMethodQuery</a></b> (<i>self</i>, Qt.InputMethodQuery&#160;<i>property</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#insertFromMimeData">insertFromMimeData</a></b> (<i>self</i>, QMimeData&#160;<i>source</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#insertPlainText">insertPlainText</a></b> (<i>self</i>, QString&#160;<i>text</i>)</li><li><div class="fn" />bool <b><a href="qplaintextedit.html#isReadOnly">isReadOnly</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qplaintextedit.html#isUndoRedoEnabled">isUndoRedoEnabled</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#keyPressEvent">keyPressEvent</a></b> (<i>self</i>, QKeyEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#keyReleaseEvent">keyReleaseEvent</a></b> (<i>self</i>, QKeyEvent&#160;<i>e</i>)</li><li><div class="fn" />LineWrapMode <b><a href="qplaintextedit.html#lineWrapMode">lineWrapMode</a></b> (<i>self</i>)</li><li><div class="fn" />QVariant <b><a href="qplaintextedit.html#loadResource">loadResource</a></b> (<i>self</i>, int&#160;<i>type</i>, QUrl&#160;<i>name</i>)</li><li><div class="fn" />int <b><a href="qplaintextedit.html#maximumBlockCount">maximumBlockCount</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#mergeCurrentCharFormat">mergeCurrentCharFormat</a></b> (<i>self</i>, QTextCharFormat&#160;<i>modifier</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#mouseDoubleClickEvent">mouseDoubleClickEvent</a></b> (<i>self</i>, QMouseEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#mouseMoveEvent">mouseMoveEvent</a></b> (<i>self</i>, QMouseEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#mousePressEvent">mousePressEvent</a></b> (<i>self</i>, QMouseEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#mouseReleaseEvent">mouseReleaseEvent</a></b> (<i>self</i>, QMouseEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#moveCursor">moveCursor</a></b> (<i>self</i>, QTextCursor.MoveOperation&#160;<i>operation</i>, QTextCursor.MoveMode&#160;<i>mode</i>&#160;=&#160;QTextCursor.MoveAnchor)</li><li><div class="fn" />bool <b><a href="qplaintextedit.html#overwriteMode">overwriteMode</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#paste">paste</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#print">print</a></b> (<i>self</i>, QPrinter&#160;<i>printer</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#print">print_</a></b> (<i>self</i>, QPrinter&#160;<i>printer</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#redo">redo</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#resizeEvent">resizeEvent</a></b> (<i>self</i>, QResizeEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#scrollContentsBy">scrollContentsBy</a></b> (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#selectAll">selectAll</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setBackgroundVisible">setBackgroundVisible</a></b> (<i>self</i>, bool&#160;<i>visible</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setCenterOnScroll">setCenterOnScroll</a></b> (<i>self</i>, bool&#160;<i>enabled</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setCurrentCharFormat">setCurrentCharFormat</a></b> (<i>self</i>, QTextCharFormat&#160;<i>format</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setCursorWidth">setCursorWidth</a></b> (<i>self</i>, int&#160;<i>width</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setDocument">setDocument</a></b> (<i>self</i>, QTextDocument&#160;<i>document</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setDocumentTitle">setDocumentTitle</a></b> (<i>self</i>, QString&#160;<i>title</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setExtraSelections">setExtraSelections</a></b> (<i>self</i>, list-of-QTextEdit.ExtraSelection&#160;<i>selections</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setLineWrapMode">setLineWrapMode</a></b> (<i>self</i>, LineWrapMode&#160;<i>mode</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setMaximumBlockCount">setMaximumBlockCount</a></b> (<i>self</i>, int&#160;<i>maximum</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setOverwriteMode">setOverwriteMode</a></b> (<i>self</i>, bool&#160;<i>overwrite</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setPlainText">setPlainText</a></b> (<i>self</i>, QString&#160;<i>text</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setReadOnly">setReadOnly</a></b> (<i>self</i>, bool&#160;<i>ro</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setTabChangesFocus">setTabChangesFocus</a></b> (<i>self</i>, bool&#160;<i>b</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setTabStopWidth">setTabStopWidth</a></b> (<i>self</i>, int&#160;<i>width</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setTextCursor">setTextCursor</a></b> (<i>self</i>, QTextCursor&#160;<i>cursor</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setTextInteractionFlags">setTextInteractionFlags</a></b> (<i>self</i>, Qt.TextInteractionFlags&#160;<i>flags</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setUndoRedoEnabled">setUndoRedoEnabled</a></b> (<i>self</i>, bool&#160;<i>enable</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#setWordWrapMode">setWordWrapMode</a></b> (<i>self</i>, QTextOption.WrapMode&#160;<i>policy</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#showEvent">showEvent</a></b> (<i>self</i>, QShowEvent)</li><li><div class="fn" />bool <b><a href="qplaintextedit.html#tabChangesFocus">tabChangesFocus</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qplaintextedit.html#tabStopWidth">tabStopWidth</a></b> (<i>self</i>)</li><li><div class="fn" />QTextCursor <b><a href="qplaintextedit.html#textCursor">textCursor</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.TextInteractionFlags <b><a href="qplaintextedit.html#textInteractionFlags">textInteractionFlags</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#timerEvent">timerEvent</a></b> (<i>self</i>, QTimerEvent&#160;<i>e</i>)</li><li><div class="fn" />QString <b><a href="qplaintextedit.html#toPlainText">toPlainText</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#undo">undo</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qplaintextedit.html#wheelEvent">wheelEvent</a></b> (<i>self</i>, QWheelEvent&#160;<i>e</i>)</li><li><div class="fn" />QTextOption.WrapMode <b><a href="qplaintextedit.html#wordWrapMode">wordWrapMode</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qplaintextedit.html#blockCountChanged">blockCountChanged</a></b> (int)</li><li><div class="fn" />void <b><a href="qplaintextedit.html#copyAvailable">copyAvailable</a></b> (bool)</li><li><div class="fn" />void <b><a href="qplaintextedit.html#cursorPositionChanged">cursorPositionChanged</a></b> ()</li><li><div class="fn" />void <b><a href="qplaintextedit.html#modificationChanged">modificationChanged</a></b> (bool)</li><li><div class="fn" />void <b><a href="qplaintextedit.html#redoAvailable">redoAvailable</a></b> (bool)</li><li><div class="fn" />void <b><a href="qplaintextedit.html#selectionChanged">selectionChanged</a></b> ()</li><li><div class="fn" />void <b><a href="qplaintextedit.html#textChanged">textChanged</a></b> ()</li><li><div class="fn" />void <b><a href="qplaintextedit.html#undoAvailable">undoAvailable</a></b> (bool)</li><li><div class="fn" />void <b><a href="qplaintextedit.html#updateRequest">updateRequest</a></b> (const QRect&amp;,int)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QPlainTextEdit class provides a widget that is used to edit
and display plain text.</p>
<a id="introduction-and-concepts" name="introduction-and-concepts" />
<h3>Introduction and Concepts</h3>
<p>QPlainTextEdit is an advanced viewer/editor supporting plain
text. It is optimized to handle large documents and to respond
quickly to user input.</p>
<p>QPlainText uses very much the same technology and concepts as
<a href="qtextedit.html">QTextEdit</a>, but is optimized for plain
text handling.</p>
<p>QPlainTextEdit 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. Paragraphs are separated by hard line breaks. Each
character within a paragraph has its own attributes, for example,
font and color.</p>
<p>The shape of the mouse cursor on a QPlainTextEdit is <a href="qt.html#CursorShape-enum">Qt.IBeamCursor</a> by default. It can
be changed through the <a href="qabstractscrollarea.html#viewport">viewport</a>()'s cursor
property.</p>
<a id="using-qplaintextedit-as-a-display-widget" name="using-qplaintextedit-as-a-display-widget" />
<h3>Using QPlainTextEdit as a Display Widget</h3>
<p>The text is set or replaced using <a href="qplaintextedit.html#plainText-prop">setPlainText</a>() which
deletes the existing text and replaces it with the text passed to
<a href="qplaintextedit.html#plainText-prop">setPlainText</a>().</p>
<p>Text can be inserted using the <a href="qtextcursor.html">QTextCursor</a> class or using the convenience
functions <a href="qplaintextedit.html#insertPlainText">insertPlainText</a>(),
<a href="qplaintextedit.html#appendPlainText">appendPlainText</a>()
or <a href="qplaintextedit.html#paste">paste</a>().</p>
<p>By default, the text edit wraps words at whitespace to fit
within the text edit widget. The <a href="qplaintextedit.html#lineWrapMode-prop">setLineWrapMode</a>()
function is used to specify the kind of line wrap you want,
<a href="qplaintextedit.html#LineWrapMode-enum">WidgetWidth</a> or
<a href="qplaintextedit.html#LineWrapMode-enum">NoWrap</a> if you
don't want any wrapping. If you use word wrap to the widget's width
<a href="qplaintextedit.html#LineWrapMode-enum">WidgetWidth</a>,
you can specify whether to break on whitespace or anywhere with
<a href="qplaintextedit.html#wordWrapMode-prop">setWordWrapMode</a>().</p>
<p>The <a href="qplaintextedit.html#find">find</a>() function can
be used to find and select a given string within the text.</p>
<p>If you want to limit the total number of paragraphs in a
QPlainTextEdit, as it is for example useful in a log viewer, then
you can use the <a href="qplaintextedit.html#maximumBlockCount-prop">maximumBlockCount</a>
property. The combination of <a href="qplaintextedit.html#maximumBlockCount-prop">setMaximumBlockCount</a>()
and <a href="qplaintextedit.html#appendPlainText">appendPlainText</a>() turns
QPlainTextEdit into an efficient viewer for log text. The scrolling
can be reduced with the <a href="qplaintextedit.html#centerOnScroll-prop">centerOnScroll</a>()
property, making the log viewer even faster. Text can be formatted
in a limited way, either using a syntax highlighter (see below), or
by appending html-formatted text with <a href="qplaintextedit.html#appendHtml">appendHtml</a>(). While
QPlainTextEdit does not support complex rich text rendering with
tables and floats, it does support limited paragraph-based
formatting that you may need in a log viewer.</p>
<a id="read-only-key-bindings" name="read-only-key-bindings" />
<h4>Read-only Key Bindings</h4>
<p>When QPlainTextEdit is used read-only the key bindings are
limited to navigation, and text may only be selected with the
mouse:</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th>Keypresses</th>
<th>Action</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td><a href="qt.html#ArrowType-enum">Qt.UpArrow</a></td>
<td>Moves one line up.</td>
</tr>
<tr class="even" valign="top">
<td><a href="qt.html#ArrowType-enum">Qt.DownArrow</a></td>
<td>Moves one line down.</td>
</tr>
<tr class="odd" valign="top">
<td><a href="qt.html#ArrowType-enum">Qt.LeftArrow</a></td>
<td>Moves one character to the left.</td>
</tr>
<tr class="even" valign="top">
<td><a href="qt.html#ArrowType-enum">Qt.RightArrow</a></td>
<td>Moves one character to the right.</td>
</tr>
<tr class="odd" valign="top">
<td>PageUp</td>
<td>Moves one (viewport) page up.</td>
</tr>
<tr class="even" valign="top">
<td>PageDown</td>
<td>Moves one (viewport) page down.</td>
</tr>
<tr class="odd" valign="top">
<td>Home</td>
<td>Moves to the beginning of the text.</td>
</tr>
<tr class="even" valign="top">
<td>End</td>
<td>Moves to the end of the text.</td>
</tr>
<tr class="odd" valign="top">
<td>Alt+Wheel</td>
<td>Scrolls the page horizontally (the Wheel is the mouse
wheel).</td>
</tr>
<tr class="even" valign="top">
<td>Ctrl+Wheel</td>
<td>Zooms the text.</td>
</tr>
<tr class="odd" valign="top">
<td>Ctrl+A</td>
<td>Selects all text.</td>
</tr>
</table>
<a id="using-qplaintextedit-as-an-editor" name="using-qplaintextedit-as-an-editor" />
<h3>Using QPlainTextEdit as an Editor</h3>
<p>All the information about using QPlainTextEdit as a display
widget also applies here.</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="qplaintextedit.html#textCursor">textCursor</a>() method. If you
want to set a selection in QPlainTextEdit 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="qplaintextedit.html#copy">copy</a>(), or cut to the clipboard with
<a href="qplaintextedit.html#cut">cut</a>(). The entire text can be
selected using <a href="qplaintextedit.html#selectAll">selectAll</a>().</p>
<p>QPlainTextEdit holds a <a href="qtextdocument.html">QTextDocument</a> object which can be
retrieved using the <a href="qplaintextedit.html#document">document</a>() method. You can also
set your own document object using <a href="qplaintextedit.html#setDocument">setDocument</a>(). <a href="qtextdocument.html">QTextDocument</a> emits a <a href="qplaintextedit.html#textChanged">textChanged</a>() signal if the
text changes and it also provides a isModified() 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="syntax-highlighting" name="syntax-highlighting" />
<h4>Syntax Highlighting</h4>
<p>Just like <a href="qtextedit.html">QTextEdit</a>, QPlainTextEdit
works together with <a href="qsyntaxhighlighter.html">QSyntaxHighlighter</a>.</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 class="generic">
<thead>
<tr class="qt-style">
<th>Keypresses</th>
<th>Action</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td>Backspace</td>
<td>Deletes the character to the left of the cursor.</td>
</tr>
<tr class="even" valign="top">
<td>Delete</td>
<td>Deletes the character to the right of the cursor.</td>
</tr>
<tr class="odd" valign="top">
<td>Ctrl+C</td>
<td>Copy the selected text to the clipboard.</td>
</tr>
<tr class="even" valign="top">
<td>Ctrl+Insert</td>
<td>Copy the selected text to the clipboard.</td>
</tr>
<tr class="odd" valign="top">
<td>Ctrl+K</td>
<td>Deletes to the end of the line.</td>
</tr>
<tr class="even" valign="top">
<td>Ctrl+V</td>
<td>Pastes the clipboard text into text edit.</td>
</tr>
<tr class="odd" valign="top">
<td>Shift+Insert</td>
<td>Pastes the clipboard text into text edit.</td>
</tr>
<tr class="even" valign="top">
<td>Ctrl+X</td>
<td>Deletes the selected text and copies it to the clipboard.</td>
</tr>
<tr class="odd" valign="top">
<td>Shift+Delete</td>
<td>Deletes the selected text and copies it to the clipboard.</td>
</tr>
<tr class="even" valign="top">
<td>Ctrl+Z</td>
<td>Undoes the last operation.</td>
</tr>
<tr class="odd" valign="top">
<td>Ctrl+Y</td>
<td>Redoes the last operation.</td>
</tr>
<tr class="even" valign="top">
<td>LeftArrow</td>
<td>Moves the cursor one character to the left.</td>
</tr>
<tr class="odd" valign="top">
<td>Ctrl+LeftArrow</td>
<td>Moves the cursor one word to the left.</td>
</tr>
<tr class="even" valign="top">
<td>RightArrow</td>
<td>Moves the cursor one character to the right.</td>
</tr>
<tr class="odd" valign="top">
<td>Ctrl+RightArrow</td>
<td>Moves the cursor one word to the right.</td>
</tr>
<tr class="even" valign="top">
<td>UpArrow</td>
<td>Moves the cursor one line up.</td>
</tr>
<tr class="odd" valign="top">
<td>Ctrl+UpArrow</td>
<td>Moves the cursor one word up.</td>
</tr>
<tr class="even" valign="top">
<td>DownArrow</td>
<td>Moves the cursor one line down.</td>
</tr>
<tr class="odd" valign="top">
<td>Ctrl+Down Arrow</td>
<td>Moves the cursor one word down.</td>
</tr>
<tr class="even" valign="top">
<td>PageUp</td>
<td>Moves the cursor one page up.</td>
</tr>
<tr class="odd" valign="top">
<td>PageDown</td>
<td>Moves the cursor one page down.</td>
</tr>
<tr class="even" valign="top">
<td>Home</td>
<td>Moves the cursor to the beginning of the line.</td>
</tr>
<tr class="odd" valign="top">
<td>Ctrl+Home</td>
<td>Moves the cursor to the beginning of the text.</td>
</tr>
<tr class="even" valign="top">
<td>End</td>
<td>Moves the cursor to the end of the line.</td>
</tr>
<tr class="odd" valign="top">
<td>Ctrl+End</td>
<td>Moves the cursor to the end of the text.</td>
</tr>
<tr class="even" valign="top">
<td>Alt+Wheel</td>
<td>Scrolls the page horizontally (the Wheel is the mouse
wheel).</td>
</tr>
<tr class="odd" valign="top">
<td>Ctrl+Wheel</td>
<td>Zooms the text.</td>
</tr>
</table>
<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>
<a id="differences-to-qtextedit" name="differences-to-qtextedit" />
<h3>Differences to QTextEdit</h3>
<p>QPlainTextEdit is a thin class, implemented by using most of the
technology that is behind <a href="qtextedit.html">QTextEdit</a>
and <a href="qtextdocument.html">QTextDocument</a>. Its performance
benefits over <a href="qtextedit.html">QTextEdit</a> stem mostly
from using a different and simplified text layout called <a href="qplaintextdocumentlayout.html">QPlainTextDocumentLayout</a> on the
text document (see <a href="qtextdocument.html#setDocumentLayout">QTextDocument.setDocumentLayout</a>()).
The plain text document layout does not support tables nor embedded
frames, and <i>replaces a pixel-exact height calculation with a
line-by-line respectively paragraph-by-paragraph scrolling
approach</i>. This makes it possible to handle significantly larger
documents, and still resize the editor with line wrap enabled in
real time. It also makes for a fast log viewer (see <a href="qplaintextedit.html#maximumBlockCount-prop">setMaximumBlockCount</a>()).</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="LineWrapMode-enum" />QPlainTextEdit.LineWrapMode</h3><table class="valuelist">
<tr>
<th class="tblConst">Constant</th>
<th class="tblVal">Value</th>
</tr>
<tr>
<td class="topAlign"><tt>QPlainTextEdit.NoWrap</tt></td>
<td class="topAlign"><tt>0</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPlainTextEdit.WidgetWidth</tt></td>
<td class="topAlign"><tt>1</tt></td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPlainTextEdit" />QPlainTextEdit.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;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="qplaintextedit.html">QPlainTextEdit</a> with parent
<i>parent</i>.</p>


<h3 class="fn"><a name="QPlainTextEdit-2" />QPlainTextEdit.__init__ (<i>self</i>, QString&#160;<i>text</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;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="qplaintextedit.html">QPlainTextEdit</a>
with parent <i>parent</i>. The text edit will display the plain
text <i>text</i>.</p>


<h3 class="fn"><a name="anchorAt" />QString QPlainTextEdit.anchorAt (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<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>
<p>This function was introduced in Qt 4.7.</p>


<h3 class="fn"><a name="appendHtml" />QPlainTextEdit.appendHtml (<i>self</i>, QString&#160;<i>html</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void appendHtml(const QString&amp;)</tt>.</p><p>Appends a new paragraph with <i>html</i> to the end of the text
edit.</p>
<p><a href="qplaintextedit.html#appendPlainText">appendPlainText</a>()</p>


<h3 class="fn"><a name="appendPlainText" />QPlainTextEdit.appendPlainText (<i>self</i>, QString&#160;<i>text</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void appendPlainText(const QString&amp;)</tt>.</p><p>Appends a new paragraph with <i>text</i> to the end of the text
edit.</p>
<p><b>See also</b> <a href="qplaintextedit.html#appendHtml">appendHtml</a>().</p>


<h3 class="fn"><a name="backgroundVisible" />bool QPlainTextEdit.backgroundVisible (<i>self</i>)</h3><h3 class="fn"><a name="blockBoundingGeometry" /><a href="qrectf.html">QRectF</a> QPlainTextEdit.blockBoundingGeometry (<i>self</i>, <a href="qtextblock.html">QTextBlock</a>&#160;<i>block</i>)</h3><p>Returns the bounding rectangle of the text <i>block</i> in
content coordinates. Translate the rectangle with the <a href="qplaintextedit.html#contentOffset">contentOffset</a>() to get
visual coordinates on the viewport.</p>
<p><b>See also</b> <a href="qplaintextedit.html#firstVisibleBlock">firstVisibleBlock</a>() and
<a href="qplaintextedit.html#blockBoundingRect">blockBoundingRect</a>().</p>


<h3 class="fn"><a name="blockBoundingRect" /><a href="qrectf.html">QRectF</a> QPlainTextEdit.blockBoundingRect (<i>self</i>, <a href="qtextblock.html">QTextBlock</a>&#160;<i>block</i>)</h3><p>Returns the bounding rectangle of the text <i>block</i> in the
block's own coordinates.</p>
<p><b>See also</b> <a href="qplaintextedit.html#blockBoundingGeometry">blockBoundingGeometry</a>().</p>


<h3 class="fn"><a name="blockCount" />int QPlainTextEdit.blockCount (<i>self</i>)</h3><h3 class="fn"><a name="canInsertFromMimeData" />bool QPlainTextEdit.canInsertFromMimeData (<i>self</i>, <a href="qmimedata.html">QMimeData</a>&#160;<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="canPaste" />bool QPlainTextEdit.canPaste (<i>self</i>)</h3><p>Returns whether text can be pasted from the clipboard into the
textedit.</p>


<h3 class="fn"><a name="centerCursor" />QPlainTextEdit.centerCursor (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void centerCursor()</tt>.</p><p>Scrolls the document in order to center the cursor
vertically.</p>
<p><b>See also</b> <a href="qplaintextedit.html#ensureCursorVisible">ensureCursorVisible</a>()
and <a href="qplaintextedit.html#centerOnScroll-prop">centerOnScroll</a>.</p>


<h3 class="fn"><a name="centerOnScroll" />bool QPlainTextEdit.centerOnScroll (<i>self</i>)</h3><h3 class="fn"><a name="changeEvent" />QPlainTextEdit.changeEvent (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget.changeEvent</a>().</p>


<h3 class="fn"><a name="clear" />QPlainTextEdit.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><b>See also</b> <a href="qplaintextedit.html#cut">cut</a>() and
<a href="qplaintextedit.html#plainText-prop">setPlainText</a>().</p>


<h3 class="fn"><a name="contentOffset" /><a href="qpointf.html">QPointF</a> QPlainTextEdit.contentOffset (<i>self</i>)</h3><p>Returns the content's origin in viewport coordinates.</p>
<p>The origin of the content of a plain text edit is always the top
left corner of the first visible text block. The content offset is
different from (0,0) when the text has been scrolled horizontally,
or when the first visible block has been scrolled partially off the
screen, i.e. the visible text does not start with the first line of
the first visible block, or when the first visible block is the
very first block and the editor displays a margin.</p>
<p><b>See also</b> <a href="qplaintextedit.html#firstVisibleBlock">firstVisibleBlock</a>(),
<a href="qabstractscrollarea.html#horizontalScrollBar">horizontalScrollBar</a>(),
and <a href="qabstractscrollarea.html#verticalScrollBar">verticalScrollBar</a>().</p>


<h3 class="fn"><a name="contextMenuEvent" />QPlainTextEdit.contextMenuEvent (<i>self</i>, <a href="qcontextmenuevent.html">QContextMenuEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#contextMenuEvent">QWidget.contextMenuEvent</a>().</p>
<p>Shows the standard context menu created with <a href="qplaintextedit.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="qplaintextedit.html#createStandardContextMenu">createStandardContextMenu</a>()
and extend the menu returned.</p>
<p>Information about the event is passed in the <i>event</i>
object.</p>
<pre class="cpp">
 <span class="type">void</span> MyQPlainTextEdit<span class="operator">.</span>contextMenuEvent(<span class="type"><a href="qcontextmenuevent.html">QContextMenuEvent</a></span> <span class="operator">*</span>event)
 {
     <span class="type"><a href="qmenu.html">QMenu</a></span> <span class="operator">*</span>menu <span class="operator">=</span> createStandardContextMenu();
     menu<span class="operator">-</span><span class="operator">&gt;</span>addAction(tr(<span class="string">"My Menu Item"</span>));
     <span class="comment">//...</span>
     menu<span class="operator">-</span><span class="operator">&gt;</span>exec(event<span class="operator">-</span><span class="operator">&gt;</span>globalPos());
     <span class="keyword">delete</span> menu;
 }
</pre>


<h3 class="fn"><a name="copy" />QPlainTextEdit.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><b>See also</b> <a href="qplaintextedit.html#copyAvailable">copyAvailable</a>().</p>


<h3 class="fn"><a name="createMimeDataFromSelection" /><a href="qmimedata.html">QMimeData</a> QPlainTextEdit.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 copied 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="qplaintextedit.html#textCursor">textCursor</a>() function.</p>


<h3 class="fn"><a name="createStandardContextMenu" /><a href="qmenu.html">QMenu</a> QPlainTextEdit.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="qplaintextedit.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> QPlainTextEdit.currentCharFormat (<i>self</i>)</h3><p>Returns the char format that is used when inserting new
text.</p>
<p><b>See also</b> <a href="qplaintextedit.html#setCurrentCharFormat">setCurrentCharFormat</a>().</p>


<h3 class="fn"><a name="cursorForPosition" /><a href="qtextcursor.html">QTextCursor</a> QPlainTextEdit.cursorForPosition (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<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> QPlainTextEdit.cursorRect (<i>self</i>, <a href="qtextcursor.html">QTextCursor</a>&#160;<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> QPlainTextEdit.cursorRect (<i>self</i>)</h3><p>returns a rectangle (in viewport coordinates) that includes the
cursor of the text edit.</p>


<h3 class="fn"><a name="cursorWidth" />int QPlainTextEdit.cursorWidth (<i>self</i>)</h3><h3 class="fn"><a name="cut" />QPlainTextEdit.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><b>See also</b> <a href="qplaintextedit.html#copy">copy</a>()
and <a href="qplaintextedit.html#paste">paste</a>().</p>


<h3 class="fn"><a name="document" /><a href="qtextdocument.html">QTextDocument</a> QPlainTextEdit.document (<i>self</i>)</h3><p>Returns a pointer to the underlying document.</p>
<p><b>See also</b> <a href="qplaintextedit.html#setDocument">setDocument</a>().</p>


<h3 class="fn"><a name="documentTitle" />QString QPlainTextEdit.documentTitle (<i>self</i>)</h3><h3 class="fn"><a name="dragEnterEvent" />QPlainTextEdit.dragEnterEvent (<i>self</i>, <a href="qdragenterevent.html">QDragEnterEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#dragEnterEvent">QWidget.dragEnterEvent</a>().</p>


<h3 class="fn"><a name="dragLeaveEvent" />QPlainTextEdit.dragLeaveEvent (<i>self</i>, <a href="qdragleaveevent.html">QDragLeaveEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#dragLeaveEvent">QWidget.dragLeaveEvent</a>().</p>


<h3 class="fn"><a name="dragMoveEvent" />QPlainTextEdit.dragMoveEvent (<i>self</i>, <a href="qdragmoveevent.html">QDragMoveEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#dragMoveEvent">QWidget.dragMoveEvent</a>().</p>


<h3 class="fn"><a name="dropEvent" />QPlainTextEdit.dropEvent (<i>self</i>, <a href="qdropevent.html">QDropEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#dropEvent">QWidget.dropEvent</a>().</p>


<h3 class="fn"><a name="ensureCursorVisible" />QPlainTextEdit.ensureCursorVisible (<i>self</i>)</h3><p>Ensures that the cursor is visible by scrolling the text edit if
necessary.</p>
<p><b>See also</b> <a href="qplaintextedit.html#centerCursor">centerCursor</a>() and <a href="qplaintextedit.html#centerOnScroll-prop">centerOnScroll</a>.</p>


<h3 class="fn"><a name="event" />bool QPlainTextEdit.event (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>e</i>)</h3><h3 class="fn"><a name="extraSelections" />list-of-QTextEdit.ExtraSelection QPlainTextEdit.extraSelections (<i>self</i>)</h3><p>Returns previously set extra selections.</p>
<p><b>See also</b> <a href="qplaintextedit.html#setExtraSelections">setExtraSelections</a>().</p>


<h3 class="fn"><a name="find" />bool QPlainTextEdit.find (<i>self</i>, QString&#160;<i>exp</i>, <a href="qtextdocument-findflags.html">QTextDocument.FindFlags</a>&#160;<i>options</i>&#160;=&#160;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="firstVisibleBlock" /><a href="qtextblock.html">QTextBlock</a> QPlainTextEdit.firstVisibleBlock (<i>self</i>)</h3><p>Returns the first visible block.</p>
<p><b>See also</b> <a href="qplaintextedit.html#blockBoundingRect">blockBoundingRect</a>().</p>


<h3 class="fn"><a name="focusInEvent" />QPlainTextEdit.focusInEvent (<i>self</i>, <a href="qfocusevent.html">QFocusEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#focusInEvent">QWidget.focusInEvent</a>().</p>


<h3 class="fn"><a name="focusNextPrevChild" />bool QPlainTextEdit.focusNextPrevChild (<i>self</i>, bool&#160;<i>next</i>)</h3><p>Reimplemented from <a href="qwidget.html#focusNextPrevChild">QWidget.focusNextPrevChild</a>().</p>


<h3 class="fn"><a name="focusOutEvent" />QPlainTextEdit.focusOutEvent (<i>self</i>, <a href="qfocusevent.html">QFocusEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#focusOutEvent">QWidget.focusOutEvent</a>().</p>


<h3 class="fn"><a name="getPaintContext" /><a href="qabstracttextdocumentlayout-paintcontext.html">QAbstractTextDocumentLayout.PaintContext</a> QPlainTextEdit.getPaintContext (<i>self</i>)</h3><p>Returns the paint context for the <a href="qabstractscrollarea.html#viewport">viewport</a>(), useful only
when reimplementing <a href="qplaintextedit.html#paintEvent">paintEvent</a>().</p>


<h3 class="fn"><a name="inputMethodEvent" />QPlainTextEdit.inputMethodEvent (<i>self</i>, <a href="qinputmethodevent.html">QInputMethodEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#inputMethodEvent">QWidget.inputMethodEvent</a>().</p>


<h3 class="fn"><a name="inputMethodQuery" />QVariant QPlainTextEdit.inputMethodQuery (<i>self</i>, <a href="qt.html#InputMethodQuery-enum">Qt.InputMethodQuery</a>&#160;<i>property</i>)</h3><p>Reimplemented from <a href="qwidget.html#inputMethodQuery">QWidget.inputMethodQuery</a>().</p>


<h3 class="fn"><a name="insertFromMimeData" />QPlainTextEdit.insertFromMimeData (<i>self</i>, <a href="qmimedata.html">QMimeData</a>&#160;<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="insertPlainText" />QPlainTextEdit.insertPlainText (<i>self</i>, QString&#160;<i>text</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void insertPlainText(const QString&amp;)</tt>.</p><p>Convenience slot that inserts <i>text</i> at the current cursor
position.</p>
<p>It is equivalent to</p>
<pre class="cpp">
 edit<span class="operator">-</span><span class="operator">&gt;</span><a href="qplaintextedit.html#textCursor">textCursor</a>()<span class="operator">.</span>insertText(text);
</pre>


<h3 class="fn"><a name="isReadOnly" />bool QPlainTextEdit.isReadOnly (<i>self</i>)</h3><h3 class="fn"><a name="isUndoRedoEnabled" />bool QPlainTextEdit.isUndoRedoEnabled (<i>self</i>)</h3><h3 class="fn"><a name="keyPressEvent" />QPlainTextEdit.keyPressEvent (<i>self</i>, <a href="qkeyevent.html">QKeyEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget.keyPressEvent</a>().</p>


<h3 class="fn"><a name="keyReleaseEvent" />QPlainTextEdit.keyReleaseEvent (<i>self</i>, <a href="qkeyevent.html">QKeyEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#keyReleaseEvent">QWidget.keyReleaseEvent</a>().</p>


<h3 class="fn"><a name="lineWrapMode" /><a href="qplaintextedit.html#LineWrapMode-enum">LineWrapMode</a> QPlainTextEdit.lineWrapMode (<i>self</i>)</h3><h3 class="fn"><a name="loadResource" />QVariant QPlainTextEdit.loadResource (<i>self</i>, int&#160;<i>type</i>, <a href="qurl.html">QUrl</a>&#160;<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><b>See also</b> <a href="qtextdocument.html#loadResource">QTextDocument.loadResource</a>().</p>


<h3 class="fn"><a name="maximumBlockCount" />int QPlainTextEdit.maximumBlockCount (<i>self</i>)</h3><h3 class="fn"><a name="mergeCurrentCharFormat" />QPlainTextEdit.mergeCurrentCharFormat (<i>self</i>, <a href="qtextcharformat.html">QTextCharFormat</a>&#160;<i>modifier</i>)</h3><p>Merges the properties specified in <i>modifier</i> into the
current character format by calling QTextCursor.mergeCharFormat on
the editor's cursor. If the editor has a selection then the
properties of <i>modifier</i> are directly applied to the
selection.</p>
<p><b>See also</b> <a href="qtextcursor.html#mergeCharFormat">QTextCursor.mergeCharFormat</a>().</p>


<h3 class="fn"><a name="mouseDoubleClickEvent" />QPlainTextEdit.mouseDoubleClickEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#mouseDoubleClickEvent">QWidget.mouseDoubleClickEvent</a>().</p>


<h3 class="fn"><a name="mouseMoveEvent" />QPlainTextEdit.mouseMoveEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#mouseMoveEvent">QWidget.mouseMoveEvent</a>().</p>


<h3 class="fn"><a name="mousePressEvent" />QPlainTextEdit.mousePressEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#mousePressEvent">QWidget.mousePressEvent</a>().</p>


<h3 class="fn"><a name="mouseReleaseEvent" />QPlainTextEdit.mouseReleaseEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#mouseReleaseEvent">QWidget.mouseReleaseEvent</a>().</p>


<h3 class="fn"><a name="moveCursor" />QPlainTextEdit.moveCursor (<i>self</i>, <a href="qtextcursor.html#MoveOperation-enum">QTextCursor.MoveOperation</a>&#160;<i>operation</i>, <a href="qtextcursor.html#MoveMode-enum">QTextCursor.MoveMode</a>&#160;<i>mode</i>&#160;=&#160;QTextCursor.MoveAnchor)</h3><p>Moves the cursor by performing the given <i>operation</i>.</p>
<p>If <i>mode</i> is <a href="qtextcursor.html#MoveMode-enum">QTextCursor.KeepAnchor</a>, the
cursor selects the text it moves over. This is the same effect that
the user achieves when they hold down the Shift key and move the
cursor with the cursor keys.</p>
<p><b>See also</b> <a href="qtextcursor.html#movePosition">QTextCursor.movePosition</a>().</p>


<h3 class="fn"><a name="overwriteMode" />bool QPlainTextEdit.overwriteMode (<i>self</i>)</h3><h3 class="fn"><a name="paintEvent" />QPlainTextEdit.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p>


<h3 class="fn"><a name="paste" />QPlainTextEdit.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="qplaintextedit.html">QPlainTextEdit</a> can paste and how
it is being pasted, reimplement the virtual <a href="qplaintextedit.html#canInsertFromMimeData">canInsertFromMimeData</a>()
and <a href="qplaintextedit.html#insertFromMimeData">insertFromMimeData</a>()
functions.</p>
<p><b>See also</b> <a href="qplaintextedit.html#cut">cut</a>() and
<a href="qplaintextedit.html#copy">copy</a>().</p>


<h3 class="fn"><a name="print" />QPlainTextEdit.print (<i>self</i>, <a href="qprinter.html">QPrinter</a>&#160;<i>printer</i>)</h3><p>Convenience function to print the text edit's document to the
given <i>printer</i>. This is equivalent to calling the print
method on the document directly except that this function also
supports <a href="qprinter.html#PrintRange-enum">QPrinter.Selection</a> as print
range.</p>
<p><b>See also</b> <a href="qtextdocument.html#print">QTextDocument.print</a>().</p>


<h3 class="fn"><a name="print" />QPlainTextEdit.print_ (<i>self</i>, <a href="qprinter.html">QPrinter</a>&#160;<i>printer</i>)</h3><p>Convenience function to print the text edit's document to the
given <i>printer</i>. This is equivalent to calling the print
method on the document directly except that this function also
supports <a href="qprinter.html#PrintRange-enum">QPrinter.Selection</a> as print
range.</p>
<p><b>See also</b> <a href="qtextdocument.html#print">QTextDocument.print</a>().</p>


<h3 class="fn"><a name="redo" />QPlainTextEdit.redo (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void redo()</tt>.</p><p>Redoes the last operation.</p>
<p>If there is no operation to redo, i.e. there is no redo step in
the undo/redo history, nothing happens.</p>
<p><b>See also</b> <a href="qplaintextedit.html#undo">undo</a>().</p>


<h3 class="fn"><a name="resizeEvent" />QPlainTextEdit.resizeEvent (<i>self</i>, <a href="qresizeevent.html">QResizeEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget.resizeEvent</a>().</p>


<h3 class="fn"><a name="scrollContentsBy" />QPlainTextEdit.scrollContentsBy (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>)</h3><p>Reimplemented from <a href="qabstractscrollarea.html#scrollContentsBy">QAbstractScrollArea.scrollContentsBy</a>().</p>


<h3 class="fn"><a name="selectAll" />QPlainTextEdit.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><b>See also</b> <a href="qplaintextedit.html#copy">copy</a>(),
<a href="qplaintextedit.html#cut">cut</a>(), and <a href="qplaintextedit.html#textCursor">textCursor</a>().</p>


<h3 class="fn"><a name="setBackgroundVisible" />QPlainTextEdit.setBackgroundVisible (<i>self</i>, bool&#160;<i>visible</i>)</h3><h3 class="fn"><a name="setCenterOnScroll" />QPlainTextEdit.setCenterOnScroll (<i>self</i>, bool&#160;<i>enabled</i>)</h3><h3 class="fn"><a name="setCurrentCharFormat" />QPlainTextEdit.setCurrentCharFormat (<i>self</i>, <a href="qtextcharformat.html">QTextCharFormat</a>&#160;<i>format</i>)</h3><p>Sets the char format that is be used when inserting new text to
<i>format</i> by calling <a href="qtextcursor.html#setCharFormat">QTextCursor.setCharFormat</a>()
on the editor's cursor. If the editor has a selection then the char
format is directly applied to the selection.</p>
<p><b>See also</b> <a href="qplaintextedit.html#currentCharFormat">currentCharFormat</a>().</p>


<h3 class="fn"><a name="setCursorWidth" />QPlainTextEdit.setCursorWidth (<i>self</i>, int&#160;<i>width</i>)</h3><h3 class="fn"><a name="setDocument" />QPlainTextEdit.setDocument (<i>self</i>, <a href="qtextdocument.html">QTextDocument</a>&#160;<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>The document must have a document layout that inherits <a href="qplaintextdocumentlayout.html">QPlainTextDocumentLayout</a> (see
<a href="qtextdocument.html#setDocumentLayout">QTextDocument.setDocumentLayout</a>()).</p>
<p><b>See also</b> <a href="qplaintextedit.html#document">document</a>().</p>


<h3 class="fn"><a name="setDocumentTitle" />QPlainTextEdit.setDocumentTitle (<i>self</i>, QString&#160;<i>title</i>)</h3><h3 class="fn"><a name="setExtraSelections" />QPlainTextEdit.setExtraSelections (<i>self</i>, list-of-QTextEdit.ExtraSelection&#160;<i>selections</i>)</h3><p>This function allows temporarily marking certain regions in the
document with a given color, specified as <i>selections</i>. This
can be useful for example in a programming editor to mark a whole
line of text with a given background color to indicate the
existence of a breakpoint.</p>
<p><b>See also</b> <a href="qtextedit-extraselection.html">QTextEdit.ExtraSelection</a> and
<a href="qplaintextedit.html#extraSelections">extraSelections</a>().</p>


<h3 class="fn"><a name="setLineWrapMode" />QPlainTextEdit.setLineWrapMode (<i>self</i>, <a href="qplaintextedit.html#LineWrapMode-enum">LineWrapMode</a>&#160;<i>mode</i>)</h3><h3 class="fn"><a name="setMaximumBlockCount" />QPlainTextEdit.setMaximumBlockCount (<i>self</i>, int&#160;<i>maximum</i>)</h3><h3 class="fn"><a name="setOverwriteMode" />QPlainTextEdit.setOverwriteMode (<i>self</i>, bool&#160;<i>overwrite</i>)</h3><h3 class="fn"><a name="setPlainText" />QPlainTextEdit.setPlainText (<i>self</i>, QString&#160;<i>text</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setPlainText(const QString&amp;)</tt>.</p><h3 class="fn"><a name="setReadOnly" />QPlainTextEdit.setReadOnly (<i>self</i>, bool&#160;<i>ro</i>)</h3><h3 class="fn"><a name="setTabChangesFocus" />QPlainTextEdit.setTabChangesFocus (<i>self</i>, bool&#160;<i>b</i>)</h3><h3 class="fn"><a name="setTabStopWidth" />QPlainTextEdit.setTabStopWidth (<i>self</i>, int&#160;<i>width</i>)</h3><h3 class="fn"><a name="setTextCursor" />QPlainTextEdit.setTextCursor (<i>self</i>, <a href="qtextcursor.html">QTextCursor</a>&#160;<i>cursor</i>)</h3><p>Sets the visible <i>cursor</i>.</p>
<p><b>See also</b> <a href="qplaintextedit.html#textCursor">textCursor</a>().</p>


<h3 class="fn"><a name="setTextInteractionFlags" />QPlainTextEdit.setTextInteractionFlags (<i>self</i>, <a href="qt-textinteractionflags.html">Qt.TextInteractionFlags</a>&#160;<i>flags</i>)</h3><h3 class="fn"><a name="setUndoRedoEnabled" />QPlainTextEdit.setUndoRedoEnabled (<i>self</i>, bool&#160;<i>enable</i>)</h3><h3 class="fn"><a name="setWordWrapMode" />QPlainTextEdit.setWordWrapMode (<i>self</i>, <a href="qtextoption.html#WrapMode-enum">QTextOption.WrapMode</a>&#160;<i>policy</i>)</h3><h3 class="fn"><a name="showEvent" />QPlainTextEdit.showEvent (<i>self</i>, <a href="qshowevent.html">QShowEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#showEvent">QWidget.showEvent</a>().</p>


<h3 class="fn"><a name="tabChangesFocus" />bool QPlainTextEdit.tabChangesFocus (<i>self</i>)</h3><h3 class="fn"><a name="tabStopWidth" />int QPlainTextEdit.tabStopWidth (<i>self</i>)</h3><h3 class="fn"><a name="textCursor" /><a href="qtextcursor.html">QTextCursor</a> QPlainTextEdit.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="qplaintextedit.html">QPlainTextEdit</a>'s cursor; use <a href="qplaintextedit.html#setTextCursor">setTextCursor</a>() to update
the visible cursor.</p>
<p><b>See also</b> <a href="qplaintextedit.html#setTextCursor">setTextCursor</a>().</p>


<h3 class="fn"><a name="textInteractionFlags" /><a href="qt-textinteractionflags.html">Qt.TextInteractionFlags</a> QPlainTextEdit.textInteractionFlags (<i>self</i>)</h3><h3 class="fn"><a name="timerEvent" />QPlainTextEdit.timerEvent (<i>self</i>, <a href="qtimerevent.html">QTimerEvent</a>&#160;<i>e</i>)</h3><h3 class="fn"><a name="toPlainText" />QString QPlainTextEdit.toPlainText (<i>self</i>)</h3><h3 class="fn"><a name="undo" />QPlainTextEdit.undo (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void undo()</tt>.</p><p>Undoes the last operation.</p>
<p>If there is no operation to undo, i.e. there is no undo step in
the undo/redo history, nothing happens.</p>
<p><b>See also</b> <a href="qplaintextedit.html#redo">redo</a>().</p>


<h3 class="fn"><a name="wheelEvent" />QPlainTextEdit.wheelEvent (<i>self</i>, <a href="qwheelevent.html">QWheelEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#wheelEvent">QWidget.wheelEvent</a>().</p>
<h3 class="fn"><a name="wordWrapMode" /><a href="qtextoption.html#WrapMode-enum">QTextOption.WrapMode</a> QPlainTextEdit.wordWrapMode (<i>self</i>)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="blockCountChanged" />void blockCountChanged (int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the block count changes. The new
block count is passed in <i>newBlockCount</i>.</p>


<h3 class="fn"><a name="copyAvailable" />void copyAvailable (bool)</h3><p>This is the default overload of this signal.</p><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="qplaintextedit.html#copy">copy</a>() can be used to copy the
selection to the clipboard. If <i>yes</i> is false then <a href="qplaintextedit.html#copy">copy</a>() does nothing.</p>
<p><b>See also</b> <a href="qplaintextedit.html#selectionChanged">selectionChanged</a>().</p>


<h3 class="fn"><a name="cursorPositionChanged" />void cursorPositionChanged ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the position of the cursor
changed.</p>


<h3 class="fn"><a name="modificationChanged" />void modificationChanged (bool)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the content of the document
changes in a way that affects the modification state. If
<i>changed</i> is true, the document has been modified; otherwise
it is false.</p>
<p>For example, calling setModified(false) on a document and then
inserting text causes the signal to get emitted. If you undo that
operation, causing the document to return to its original
unmodified state, the signal will get emitted again.</p>


<h3 class="fn"><a name="redoAvailable" />void redoAvailable (bool)</h3><p>This is the default overload of this signal.</p><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 is the default overload of this signal.</p><p>This signal is emitted whenever the selection changes.</p>
<p><b>See also</b> <a href="qplaintextedit.html#copyAvailable">copyAvailable</a>().</p>


<h3 class="fn"><a name="textChanged" />void textChanged ()</h3><p>This is the default overload of this signal.</p><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 is the default overload of this signal.</p><p>This signal is emitted whenever undo operations become available
(<i>available</i> is true) or unavailable (<i>available</i> is
false).</p>


<h3 class="fn"><a name="updateRequest" />void updateRequest (const QRect&amp;,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the text document needs an update of
the specified <i>rect</i>. If the text is scrolled, <i>rect</i>
will cover the entire viewport area. If the text is scrolled
vertically, <i>dy</i> carries the amount of pixels the viewport was
scrolled.</p>
<p>The purpose of the signal is to support extra widgets in plain
text edit subclasses that e.g. show line numbers, breakpoints, or
other extra information.</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>