You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qt3/doc/html/qtextedit.html

1627 lines
107 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qtextedit.cpp:205 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QTextEdit Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QTextEdit Class Reference</h1>
<p>The QTextEdit widget provides a powerful single-page rich text editor.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qtextedit-h.html">qtextedit.h</a>&gt;</tt>
<p>Inherits <a href="qscrollview.html">QScrollView</a>.
<p>Inherited by <a href="qmultilineedit.html">QMultiLineEdit</a>, <a href="qtextbrowser.html">QTextBrowser</a>, and <a href="qtextview.html">QTextView</a>.
<p><a href="qtextedit-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn>enum <a href="#WordWrap-enum"><b>WordWrap</b></a> { NoWrap, WidgetWidth, FixedPixelWidth, FixedColumnWidth }</li>
<li class=fn>enum <a href="#WrapPolicy-enum"><b>WrapPolicy</b></a> { AtWordBoundary, AtWhiteSpace = AtWordBoundary, Anywhere, AtWordOrDocumentBoundary }</li>
<li class=fn>enum <a href="#AutoFormatting-enum"><b>AutoFormatting</b></a> { AutoNone = 0, AutoBulletList = 0x00000001, AutoAll = 0xffffffff }</li>
<li class=fn>enum <a href="#KeyboardAction-enum"><b>KeyboardAction</b></a> { ActionBackspace, ActionDelete, ActionReturn, ActionKill, ActionWordBackspace, ActionWordDelete }</li>
<li class=fn>enum <a href="#CursorAction-enum"><b>CursorAction</b></a> { MoveBackward, MoveForward, MoveWordBackward, MoveWordForward, MoveUp, MoveDown, MoveLineStart, MoveLineEnd, MoveHome, MoveEnd, MovePgUp, MovePgDown }</li>
<li class=fn>enum <a href="#VerticalAlignment-enum"><b>VerticalAlignment</b></a> { AlignNormal, AlignSuperScript, AlignSubScript }</li>
<li class=fn><a href="#QTextEdit"><b>QTextEdit</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text, const&nbsp;QString&nbsp;&amp;&nbsp;context = QString::null, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn><a href="#QTextEdit-2"><b>QTextEdit</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn>QString <a href="#text"><b>text</b></a> () const</li>
<li class=fn>QString <a href="#text-2"><b>text</b></a> ( int&nbsp;para ) const</li>
<li class=fn>TextFormat <a href="#textFormat"><b>textFormat</b></a> () const</li>
<li class=fn>QString <a href="#context"><b>context</b></a> () const</li>
<li class=fn>QString <a href="#documentTitle"><b>documentTitle</b></a> () const</li>
<li class=fn>void <a href="#getSelection"><b>getSelection</b></a> ( int&nbsp;*&nbsp;paraFrom, int&nbsp;*&nbsp;indexFrom, int&nbsp;*&nbsp;paraTo, int&nbsp;*&nbsp;indexTo, int&nbsp;selNum = 0 ) const</li>
<li class=fn>virtual bool <a href="#find"><b>find</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;expr, bool&nbsp;cs, bool&nbsp;wo, bool&nbsp;forward = TRUE, int&nbsp;*&nbsp;para = 0, int&nbsp;*&nbsp;index = 0 )</li>
<li class=fn>int <a href="#paragraphs"><b>paragraphs</b></a> () const</li>
<li class=fn>int <a href="#lines"><b>lines</b></a> () const</li>
<li class=fn>int <a href="#linesOfParagraph"><b>linesOfParagraph</b></a> ( int&nbsp;para ) const</li>
<li class=fn>int <a href="#lineOfChar"><b>lineOfChar</b></a> ( int&nbsp;para, int&nbsp;index )</li>
<li class=fn>int <a href="#length"><b>length</b></a> () const</li>
<li class=fn>QRect <a href="#paragraphRect"><b>paragraphRect</b></a> ( int&nbsp;para ) const</li>
<li class=fn>int <a href="#paragraphAt"><b>paragraphAt</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;pos ) const</li>
<li class=fn>int <a href="#charAt"><b>charAt</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;pos, int&nbsp;*&nbsp;para ) const</li>
<li class=fn>int <a href="#paragraphLength"><b>paragraphLength</b></a> ( int&nbsp;para ) const</li>
<li class=fn>QStyleSheet * <a href="#styleSheet"><b>styleSheet</b></a> () const</li>
<li class=fn>QMimeSourceFactory * <a href="#mimeSourceFactory"><b>mimeSourceFactory</b></a> () const</li>
<li class=fn>QBrush <a href="#paper"><b>paper</b></a> () const</li>
<li class=fn>bool <a href="#linkUnderline"><b>linkUnderline</b></a> () const</li>
<li class=fn>virtual int <a href="#heightForWidth"><b>heightForWidth</b></a> ( int&nbsp;w ) const</li>
<li class=fn>bool <a href="#hasSelectedText"><b>hasSelectedText</b></a> () const</li>
<li class=fn>QString <a href="#selectedText"><b>selectedText</b></a> () const</li>
<li class=fn>bool <a href="#isUndoAvailable"><b>isUndoAvailable</b></a> () const</li>
<li class=fn>bool <a href="#isRedoAvailable"><b>isRedoAvailable</b></a> () const</li>
<li class=fn>WordWrap <a href="#wordWrap"><b>wordWrap</b></a> () const</li>
<li class=fn>int <a href="#wrapColumnOrWidth"><b>wrapColumnOrWidth</b></a> () const</li>
<li class=fn>WrapPolicy <a href="#wrapPolicy"><b>wrapPolicy</b></a> () const</li>
<li class=fn>int <a href="#tabStopWidth"><b>tabStopWidth</b></a> () const</li>
<li class=fn>QString <a href="#anchorAt-2"><b>anchorAt</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;pos )</li>
<li class=fn>QString <a href="#anchorAt"><b>anchorAt</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;pos, AnchorAttribute&nbsp;attr )</li>
<li class=fn>bool <a href="#isReadOnly"><b>isReadOnly</b></a> () const</li>
<li class=fn>void <a href="#getCursorPosition"><b>getCursorPosition</b></a> ( int&nbsp;*&nbsp;para, int&nbsp;*&nbsp;index ) const</li>
<li class=fn>bool <a href="#isModified"><b>isModified</b></a> () const</li>
<li class=fn>bool <a href="#italic"><b>italic</b></a> () const</li>
<li class=fn>bool <a href="#bold"><b>bold</b></a> () const</li>
<li class=fn>bool <a href="#underline"><b>underline</b></a> () const</li>
<li class=fn>QString <a href="#family"><b>family</b></a> () const</li>
<li class=fn>int <a href="#pointSize"><b>pointSize</b></a> () const</li>
<li class=fn>QColor <a href="#color"><b>color</b></a> () const</li>
<li class=fn>QFont font () const &nbsp;<em>(obsolete)</em></li>
<li class=fn>QFont <a href="#currentFont"><b>currentFont</b></a> () const</li>
<li class=fn>int <a href="#alignment"><b>alignment</b></a> () const</li>
<li class=fn>int <a href="#undoDepth"><b>undoDepth</b></a> () const</li>
<li class=fn>bool <a href="#isOverwriteMode"><b>isOverwriteMode</b></a> () const</li>
<li class=fn>QColor <a href="#paragraphBackgroundColor"><b>paragraphBackgroundColor</b></a> ( int&nbsp;para ) const</li>
<li class=fn>bool <a href="#isUndoRedoEnabled"><b>isUndoRedoEnabled</b></a> () const</li>
<li class=fn>bool <a href="#tabChangesFocus"><b>tabChangesFocus</b></a> () const</li>
<li class=fn>void <a href="#setAutoFormatting"><b>setAutoFormatting</b></a> ( uint&nbsp;features )</li>
<li class=fn>uint <a href="#autoFormatting"><b>autoFormatting</b></a> () const</li>
<li class=fn>QSyntaxHighlighter * <a href="#syntaxHighlighter"><b>syntaxHighlighter</b></a> () const</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>virtual void <a href="#setMimeSourceFactory"><b>setMimeSourceFactory</b></a> ( QMimeSourceFactory&nbsp;*&nbsp;factory )</li>
<li class=fn>virtual void <a href="#setStyleSheet"><b>setStyleSheet</b></a> ( QStyleSheet&nbsp;*&nbsp;styleSheet )</li>
<li class=fn>virtual void <a href="#scrollToAnchor"><b>scrollToAnchor</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;name )</li>
<li class=fn>virtual void <a href="#setPaper"><b>setPaper</b></a> ( const&nbsp;QBrush&nbsp;&amp;&nbsp;pap )</li>
<li class=fn>virtual void <a href="#setLinkUnderline"><b>setLinkUnderline</b></a> ( bool )</li>
<li class=fn>virtual void <a href="#setWordWrap"><b>setWordWrap</b></a> ( WordWrap&nbsp;mode )</li>
<li class=fn>virtual void <a href="#setWrapColumnOrWidth"><b>setWrapColumnOrWidth</b></a> ( int )</li>
<li class=fn>virtual void <a href="#setWrapPolicy"><b>setWrapPolicy</b></a> ( WrapPolicy&nbsp;policy )</li>
<li class=fn>virtual void <a href="#copy"><b>copy</b></a> ()</li>
<li class=fn>virtual void <a href="#append"><b>append</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text )</li>
<li class=fn>void <a href="#setText"><b>setText</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;txt )</li>
<li class=fn>virtual void <a href="#setText-2"><b>setText</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text, const&nbsp;QString&nbsp;&amp;&nbsp;context )</li>
<li class=fn>virtual void <a href="#setTextFormat"><b>setTextFormat</b></a> ( TextFormat&nbsp;f )</li>
<li class=fn>virtual void <a href="#selectAll"><b>selectAll</b></a> ( bool&nbsp;select = TRUE )</li>
<li class=fn>virtual void <a href="#setTabStopWidth"><b>setTabStopWidth</b></a> ( int&nbsp;ts )</li>
<li class=fn>virtual void <a href="#zoomIn"><b>zoomIn</b></a> ( int&nbsp;range )</li>
<li class=fn>virtual void <a href="#zoomIn-2"><b>zoomIn</b></a> ()</li>
<li class=fn>virtual void <a href="#zoomOut"><b>zoomOut</b></a> ( int&nbsp;range )</li>
<li class=fn>virtual void <a href="#zoomOut-2"><b>zoomOut</b></a> ()</li>
<li class=fn>virtual void <a href="#zoomTo"><b>zoomTo</b></a> ( int&nbsp;size )</li>
<li class=fn>virtual void <a href="#sync"><b>sync</b></a> ()</li>
<li class=fn>virtual void <a href="#setReadOnly"><b>setReadOnly</b></a> ( bool&nbsp;b )</li>
<li class=fn>virtual void <a href="#undo"><b>undo</b></a> ()</li>
<li class=fn>virtual void <a href="#redo"><b>redo</b></a> ()</li>
<li class=fn>virtual void <a href="#cut"><b>cut</b></a> ()</li>
<li class=fn>virtual void <a href="#paste"><b>paste</b></a> ()</li>
<li class=fn>virtual void <a href="#pasteSubType"><b>pasteSubType</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;subtype )</li>
<li class=fn>virtual void <a href="#clear"><b>clear</b></a> ()</li>
<li class=fn>virtual void <a href="#del"><b>del</b></a> ()</li>
<li class=fn>virtual void <a href="#setItalic"><b>setItalic</b></a> ( bool&nbsp;b )</li>
<li class=fn>virtual void <a href="#setBold"><b>setBold</b></a> ( bool&nbsp;b )</li>
<li class=fn>virtual void <a href="#setUnderline"><b>setUnderline</b></a> ( bool&nbsp;b )</li>
<li class=fn>virtual void <a href="#setFamily"><b>setFamily</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;fontFamily )</li>
<li class=fn>virtual void <a href="#setPointSize"><b>setPointSize</b></a> ( int&nbsp;s )</li>
<li class=fn>virtual void <a href="#setColor"><b>setColor</b></a> ( const&nbsp;QColor&nbsp;&amp;&nbsp;c )</li>
<li class=fn>virtual void <a href="#setVerticalAlignment"><b>setVerticalAlignment</b></a> ( VerticalAlignment&nbsp;a )</li>
<li class=fn>virtual void <a href="#setAlignment"><b>setAlignment</b></a> ( int&nbsp;a )</li>
<li class=fn>virtual void <a href="#setCursorPosition"><b>setCursorPosition</b></a> ( int&nbsp;para, int&nbsp;index )</li>
<li class=fn>virtual void <a href="#setSelection"><b>setSelection</b></a> ( int&nbsp;paraFrom, int&nbsp;indexFrom, int&nbsp;paraTo, int&nbsp;indexTo, int&nbsp;selNum = 0 )</li>
<li class=fn>virtual void <a href="#setSelectionAttributes"><b>setSelectionAttributes</b></a> ( int&nbsp;selNum, const&nbsp;QColor&nbsp;&amp;&nbsp;back, bool&nbsp;invertText )</li>
<li class=fn>virtual void <a href="#setModified"><b>setModified</b></a> ( bool&nbsp;m )</li>
<li class=fn>virtual void <a href="#setUndoDepth"><b>setUndoDepth</b></a> ( int&nbsp;d )</li>
<li class=fn>virtual void <a href="#ensureCursorVisible"><b>ensureCursorVisible</b></a> ()</li>
<li class=fn>virtual void <a href="#placeCursor"><b>placeCursor</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;pos, QTextCursor&nbsp;*&nbsp;c = 0 )</li>
<li class=fn>virtual void <a href="#moveCursor"><b>moveCursor</b></a> ( CursorAction&nbsp;action, bool&nbsp;select )</li>
<li class=fn>virtual void <a href="#doKeyboardAction"><b>doKeyboardAction</b></a> ( KeyboardAction&nbsp;action )</li>
<li class=fn>virtual void <a href="#removeSelectedText"><b>removeSelectedText</b></a> ( int&nbsp;selNum = 0 )</li>
<li class=fn>virtual void <a href="#removeSelection"><b>removeSelection</b></a> ( int&nbsp;selNum = 0 )</li>
<li class=fn>virtual void <a href="#setCurrentFont"><b>setCurrentFont</b></a> ( const&nbsp;QFont&nbsp;&amp;&nbsp;f )</li>
<li class=fn>virtual void <a href="#setOverwriteMode"><b>setOverwriteMode</b></a> ( bool&nbsp;b )</li>
<li class=fn>virtual void <a href="#scrollToBottom"><b>scrollToBottom</b></a> ()</li>
<li class=fn>void <a href="#insert"><b>insert</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text, uint&nbsp;insertionFlags = CheckNewLines | RemoveSelected )</li>
<li class=fn>virtual void insert ( const&nbsp;QString&nbsp;&amp;&nbsp;text, bool&nbsp;indent, bool&nbsp;checkNewLine = TRUE, bool&nbsp;removeSelected = TRUE ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>virtual void <a href="#insertAt"><b>insertAt</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text, int&nbsp;para, int&nbsp;index )</li>
<li class=fn>virtual void <a href="#removeParagraph"><b>removeParagraph</b></a> ( int&nbsp;para )</li>
<li class=fn>virtual void <a href="#insertParagraph"><b>insertParagraph</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text, int&nbsp;para )</li>
<li class=fn>virtual void <a href="#setParagraphBackgroundColor"><b>setParagraphBackgroundColor</b></a> ( int&nbsp;para, const&nbsp;QColor&nbsp;&amp;&nbsp;bg )</li>
<li class=fn>virtual void <a href="#clearParagraphBackground"><b>clearParagraphBackground</b></a> ( int&nbsp;para )</li>
<li class=fn>virtual void <a href="#setUndoRedoEnabled"><b>setUndoRedoEnabled</b></a> ( bool&nbsp;b )</li>
<li class=fn>void <a href="#setTabChangesFocus"><b>setTabChangesFocus</b></a> ( bool&nbsp;b )</li>
<li class=fn>void <a href="#setMaxLogLines"><b>setMaxLogLines</b></a> ( int&nbsp;limit )</li>
<li class=fn>int <a href="#maxLogLines"><b>maxLogLines</b></a> ()</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#textChanged"><b>textChanged</b></a> ()</li>
<li class=fn>void <a href="#selectionChanged"><b>selectionChanged</b></a> ()</li>
<li class=fn>void <a href="#copyAvailable"><b>copyAvailable</b></a> ( bool&nbsp;yes )</li>
<li class=fn>void <a href="#undoAvailable"><b>undoAvailable</b></a> ( bool&nbsp;yes )</li>
<li class=fn>void <a href="#redoAvailable"><b>redoAvailable</b></a> ( bool&nbsp;yes )</li>
<li class=fn>void <a href="#currentFontChanged"><b>currentFontChanged</b></a> ( const&nbsp;QFont&nbsp;&amp;&nbsp;f )</li>
<li class=fn>void <a href="#currentColorChanged"><b>currentColorChanged</b></a> ( const&nbsp;QColor&nbsp;&amp;&nbsp;c )</li>
<li class=fn>void <a href="#currentAlignmentChanged"><b>currentAlignmentChanged</b></a> ( int&nbsp;a )</li>
<li class=fn>void <a href="#currentVerticalAlignmentChanged"><b>currentVerticalAlignmentChanged</b></a> ( VerticalAlignment&nbsp;a )</li>
<li class=fn>void <a href="#cursorPositionChanged"><b>cursorPositionChanged</b></a> ( int&nbsp;para, int&nbsp;pos )</li>
<li class=fn>void <a href="#returnPressed"><b>returnPressed</b></a> ()</li>
<li class=fn>void <a href="#modificationChanged"><b>modificationChanged</b></a> ( bool&nbsp;m )</li>
<li class=fn>void <a href="#clicked"><b>clicked</b></a> ( int&nbsp;para, int&nbsp;pos )</li>
<li class=fn>void <a href="#doubleClicked"><b>doubleClicked</b></a> ( int&nbsp;para, int&nbsp;pos )</li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>AutoFormatting <a href="#autoFormatting-prop"><b>autoFormatting</b></a>&nbsp;- the enabled set of auto formatting features</li>
<li class=fn>QString <a href="#documentTitle-prop"><b>documentTitle</b></a>&nbsp;- the title of the document parsed from the text &nbsp;<em>(read only)</em></li>
<li class=fn>bool <a href="#hasSelectedText-prop"><b>hasSelectedText</b></a>&nbsp;- whether some text is selected in selection 0 &nbsp;<em>(read only)</em></li>
<li class=fn>int <a href="#length-prop"><b>length</b></a>&nbsp;- the number of characters in the text &nbsp;<em>(read only)</em></li>
<li class=fn>bool <a href="#linkUnderline-prop"><b>linkUnderline</b></a>&nbsp;- whether hypertext links will be underlined</li>
<li class=fn>bool <a href="#modified-prop"><b>modified</b></a>&nbsp;- whether the document has been modified by the user</li>
<li class=fn>bool <a href="#overwriteMode-prop"><b>overwriteMode</b></a>&nbsp;- the text edit's overwrite mode</li>
<li class=fn>QBrush <a href="#paper-prop"><b>paper</b></a>&nbsp;- the background (paper) brush</li>
<li class=fn>bool <a href="#readOnly-prop"><b>readOnly</b></a>&nbsp;- whether the text edit is read-only</li>
<li class=fn>QString <a href="#selectedText-prop"><b>selectedText</b></a>&nbsp;- the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0) &nbsp;<em>(read only)</em></li>
<li class=fn>bool <a href="#tabChangesFocus-prop"><b>tabChangesFocus</b></a>&nbsp;- whether TAB changes focus or is accepted as input</li>
<li class=fn>int <a href="#tabStopWidth-prop"><b>tabStopWidth</b></a>&nbsp;- the tab stop width in pixels</li>
<li class=fn>QString <a href="#text-prop"><b>text</b></a>&nbsp;- the text edit's text</li>
<li class=fn>TextFormat <a href="#textFormat-prop"><b>textFormat</b></a>&nbsp;- the text format: rich text, plain text, log text or auto text</li>
<li class=fn>int <a href="#undoDepth-prop"><b>undoDepth</b></a>&nbsp;- the depth of the undo history</li>
<li class=fn>bool <a href="#undoRedoEnabled-prop"><b>undoRedoEnabled</b></a>&nbsp;- whether undo/redo is enabled</li>
<li class=fn>WordWrap <a href="#wordWrap-prop"><b>wordWrap</b></a>&nbsp;- the word wrap mode</li>
<li class=fn>int <a href="#wrapColumnOrWidth-prop"><b>wrapColumnOrWidth</b></a>&nbsp;- the position (in pixels or columns depending on the wrap mode) where text will be wrapped</li>
<li class=fn>WrapPolicy <a href="#wrapPolicy-prop"><b>wrapPolicy</b></a>&nbsp;- the word wrap policy, at whitespace or anywhere</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>void <a href="#repaintChanged"><b>repaintChanged</b></a> ()</li>
<li class=fn>virtual void <a href="#keyPressEvent"><b>keyPressEvent</b></a> ( QKeyEvent&nbsp;*&nbsp;e )</li>
<li class=fn>virtual bool <a href="#focusNextPrevChild"><b>focusNextPrevChild</b></a> ( bool&nbsp;n )</li>
<li class=fn>QTextCursor * <a href="#textCursor"><b>textCursor</b></a> () const</li>
<li class=fn>virtual QPopupMenu * <a href="#createPopupMenu"><b>createPopupMenu</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;pos )</li>
<li class=fn>virtual QPopupMenu * createPopupMenu () &nbsp;<em>(obsolete)</em></li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The QTextEdit widget provides a powerful single-page rich text editor.
<p>
<p> <!-- toc -->
<ul>
<li><a href="#1"> Introduction and Concepts
</a>
<li><a href="#1-1"> Using QTextEdit as a Display Widget
</a>
<ul>
<li><a href="#1-1-1"> Read-only key bindings
</a>
<li><a href="#1-1-2"> Using QTextEdit in LogText Mode
</a>
</ul>
<li><a href="#1-2"> Using QTextEdit as an Editor
</a>
<ul>
<li><a href="#1-2-1"> Editing key bindings
</a>
</ul>
</ul>
<!-- endtoc -->
<p> <h3> Introduction and Concepts
</h3>
<a name="1"></a><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> QTextEdit has four modes of operation:
<center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Mode <th valign="top">Command <th valign="top">Notes
<tr bgcolor="#f0f0f0"> <td valign="top">Plain Text Editor <td valign="top">setTextFormat(PlainText)
<td valign="top">Set text with <a href="#setText">setText</a>(); <a href="#text">text</a>() returns plain text. Text
attributes (e.g. colors) can be set, but plain text is always
returned.
<tr bgcolor="#d0d0d0"> <td valign="top">Rich Text Editor <td valign="top">setTextFormat(RichText)
<td valign="top">Set text with setText(); text() returns rich text. Rich
text editing is fairly limited. You can't set margins or
insert images for example (although you can read and
correctly display files that have margins set and that
include images). This mode is mostly useful for editing small
amounts of rich text. <sup>1.</sup>
<tr bgcolor="#f0f0f0"> <td valign="top">Text Viewer <td valign="top">setReadOnly(TRUE)
<td valign="top">Set text with setText() or <a href="#append">append</a>() (which has no undo
history so is faster and uses less memory); text() returns
plain or rich text depending on the <a href="#textFormat">textFormat</a>(). This mode
can correctly display a large subset of HTML tags.
<tr bgcolor="#d0d0d0"> <td valign="top">Log Viewer <td valign="top">setTextFormat(LogText)
<td valign="top">Append text using append(). The widget is set to be read
only and rich text support is disabled although a few HTML
tags (for color, bold, italic and underline) may be used.
(See <a href="#logtextmode">LogText mode</a> for details.)
</table></center>
<p> <sup>1.</sup><small>A more complete API that supports setting
margins, images, etc., is planned for a later Qt release.</small>
<p> QTextEdit can be used as a syntax highlighting editor when used in
conjunction with <a href="qsyntaxhighlighter.html">QSyntaxHighlighter</a>.
<p> We recommend that you always call <a href="#setTextFormat">setTextFormat</a>() to set the mode
you want to use. If you use <a href="qt.html#TextFormat-enum">AutoText</a> then <a href="#setText">setText</a>() and
<a href="#append">append</a>() will try to determine whether the text they are given is
plain text or rich text. If you use <a href="qt.html#TextFormat-enum">RichText</a> then setText() and
append() will assume that the text they are given is rich text.
<a href="#insert">insert</a>() simply inserts the text it is given.
<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
signify a paragraph. A document consists of zero or more
paragraphs, indexed from 0. Characters are indexed on a
per-paragraph basis, also indexed from 0. The words in the
paragraph are aligned in accordance with the paragraph's
<a href="#alignment">alignment</a>(). Paragraphs are separated by hard line breaks. Each
character within a paragraph has its own attributes, for example,
font and color.
<p> The text edit documentation uses the following concepts:
<ul>
<li> <em>current format</em> --
this is the format at the current cursor position, <em>and</em> it
is the format of the selected text if any.
<li> <em>current paragraph</em> -- the paragraph which contains the
cursor.
</ul>
<p> QTextEdit can display images (using <a href="qmimesourcefactory.html">QMimeSourceFactory</a>), 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). The
rendering style and the set of valid tags are defined by a
<a href="#styleSheet">styleSheet</a>(). Custom tags can be created and placed in a custom
style sheet. Change the style sheet with <a href="#setStyleSheet">setStyleSheet</a>(); see
<a href="qstylesheet.html">QStyleSheet</a> for details. The images identified by image tags are
displayed if they can be interpreted using the text edit's
<a href="qmimesourcefactory.html">QMimeSourceFactory</a>; see <a href="#setMimeSourceFactory">setMimeSourceFactory</a>().
<p> If you want a text browser with more navigation use <a href="qtextbrowser.html">QTextBrowser</a>.
If you just need to display a small piece of rich text use <a href="qlabel.html">QLabel</a>
or <a href="qsimplerichtext.html">QSimpleRichText</a>.
<p> If you create a new QTextEdit, and want to allow the user to edit
rich text, call <a href="#setTextFormat">setTextFormat</a>(Qt::RichText) to ensure that the
text is treated as rich text. (Rich text uses HTML tags to set
text formatting attributes. See QStyleSheet for information on the
HTML tags that are supported.). If you don't call setTextFormat()
explicitly the text edit will guess from the text itself whether
it is rich text or plain text. This means that if the text looks
like HTML or XML it will probably be interpreted as rich text, so
you should call setTextFormat(Qt::PlainText) to preserve such
text.
<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> <h3> Using QTextEdit as a Display Widget
</h3>
<a name="1-1"></a><p> QTextEdit can display a large HTML subset, including tables and
images.
<p> The text is set or replaced using <a href="#setText">setText</a>() which deletes any
existing text and replaces it with the text passed in the
setText() call. If you call setText() with legacy HTML (with
<a href="#setTextFormat">setTextFormat</a>(RichText) in force), and then call <a href="#text">text</a>(), the text
that is returned may have different markup, but will render the
same. Text can be inserted with <a href="#insert">insert</a>(), <a href="#paste">paste</a>(), <a href="#pasteSubType">pasteSubType</a>()
and <a href="#append">append</a>(). Text that is appended does not go into the undo
history; this makes append() faster and consumes less memory. Text
can also be <a href="#cut">cut</a>(). The entire text is deleted with <a href="#clear">clear</a>() and the
selected text is deleted with <a href="#removeSelectedText">removeSelectedText</a>(). Selected
(marked) text can also be deleted with <a href="#del">del</a>() (which will delete
the character to the right of the cursor if no text is selected).
<p> Loading and saving text is achieved using <a href="#setText">setText</a>() and text(),
for example:
<pre>
<a href="qfile.html">QFile</a> file( fileName ); // Read the text from a file
if ( file.<a href="qfile.html#open">open</a>( <a href="qfile.html#open">IO_ReadOnly</a> ) ) {
<a href="qtextstream.html">QTextStream</a> stream( &amp;file );
textEdit-&gt;setText( stream.<a href="qtextstream.html#read">read</a>() );
}
<a href="qfile.html">QFile</a> file( fileName ); // Write the text to a file
if ( file.<a href="qfile.html#open">open</a>( <a href="qfile.html#open">IO_WriteOnly</a> ) ) {
<a href="qtextstream.html">QTextStream</a> stream( &amp;file );
stream &lt;&lt; textEdit-&gt;text();
textEdit-&gt;setModified( FALSE );
}
</pre>
<p> By default the text edit wraps words at whitespace to fit within
the text edit widget. The <a href="#setWordWrap">setWordWrap</a>() function is used to
specify the kind of word wrap you want, or <a href="#WordWrap-enum">NoWrap</a> if you don't
want any wrapping. Call setWordWrap() to set a fixed pixel width
<a href="#WordWrap-enum">FixedPixelWidth</a>, or character column (e.g. 80 column) <a href="#WordWrap-enum">FixedColumnWidth</a> with the pixels or columns specified with
<a href="#setWrapColumnOrWidth">setWrapColumnOrWidth</a>(). If you use word wrap to the widget's width
<a href="#WordWrap-enum">WidgetWidth</a>, you can specify whether to break on whitespace or
anywhere with <a href="#setWrapPolicy">setWrapPolicy</a>().
<p> The background color is set differently than other widgets, using
<a href="#setPaper">setPaper</a>(). You specify a brush style which could be a plain color
or a complex pixmap.
<p> Hypertext links are automatically underlined; this can be changed
with <a href="#setLinkUnderline">setLinkUnderline</a>(). The tab stop width is set with
<a href="#setTabStopWidth">setTabStopWidth</a>().
<p> The <a href="#zoomIn">zoomIn</a>() and <a href="#zoomOut">zoomOut</a>() functions can be used to resize the
text by increasing (decreasing for zoomOut()) the point size used.
Images are not affected by the zoom functions.
<p> The <a href="#lines">lines</a>() function returns the number of lines in the text and
<a href="#paragraphs">paragraphs</a>() returns the number of paragraphs. The number of lines
within a particular paragraph is returned by <a href="#linesOfParagraph">linesOfParagraph</a>().
The length of the entire text in characters is returned by
<a href="#length">length</a>().
<p> You can scroll to an anchor in the text, e.g.
<tt>&lt;a name="anchor"&gt;</tt> with <a href="#scrollToAnchor">scrollToAnchor</a>(). The <a href="#find">find</a>() function
can be used to find and select a given string within the text.
<p> A read-only QTextEdit provides the same functionality as the
(obsolete) QTextView. (QTextView is still supplied for
compatibility with old code.)
<p> <h4> Read-only key bindings
</h4>
<a name="1-1-1"></a><p> When QTextEdit is used read-only the key-bindings are limited to
navigation, and text may only be selected with the mouse:
<center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Keypresses <th valign="top">Action
<tr bgcolor="#f0f0f0"> <td valign="top">UpArrow <td valign="top">Move one line up
<tr bgcolor="#d0d0d0"> <td valign="top">DownArrow <td valign="top">Move one line down
<tr bgcolor="#f0f0f0"> <td valign="top">LeftArrow <td valign="top">Move one character left
<tr bgcolor="#d0d0d0"> <td valign="top">RightArrow <td valign="top">Move one character right
<tr bgcolor="#f0f0f0"> <td valign="top">PageUp <td valign="top">Move one (viewport) page up
<tr bgcolor="#d0d0d0"> <td valign="top">PageDown <td valign="top">Move one (viewport) page down
<tr bgcolor="#f0f0f0"> <td valign="top">Home <td valign="top">Move to the beginning of the text
<tr bgcolor="#d0d0d0"> <td valign="top">End <td valign="top">Move to the end of the text
<tr bgcolor="#f0f0f0"> <td valign="top">Shift+Wheel
<td valign="top">Scroll the page horizontally (the Wheel is the mouse wheel)
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+Wheel <td valign="top">Zoom the text
</table></center>
<p> The text edit may be able to provide some meta-information. For
example, the <a href="#documentTitle">documentTitle</a>() function will return the text from
within HTML <tt>&lt;title&gt;</tt> tags.
<p> The text displayed in a text edit has a <em>context</em>. The context is
a path which the text edit's <a href="qmimesourcefactory.html">QMimeSourceFactory</a> uses to resolve
the locations of files and images. It is passed to the
<a href="#mimeSourceFactory">mimeSourceFactory</a>() when quering data. (See QTextEdit() and
<a href="#context">context</a>().)
<p> <a name="logtextmode"></a>
<h4> Using QTextEdit in LogText Mode
</h4>
<a name="1-1-2"></a><p> Setting the text format to <a href="qt.html#TextFormat-enum">LogText</a> puts the widget in a special
mode which is optimized for very large texts. Editing, word wrap,
and rich text support are disabled in this mode (the widget is
explicitly made read-only). This allows the text to be stored in a
different, more memory efficient manner. However, a certain degree
of text formatting is supported through the use of formatting tags.
A tag is delimited by <tt>&lt;</tt> and <tt>&gt;</tt>. The characters <tt>&lt;</tt>, <tt>&gt;</tt>
and <tt>&amp;</tt> are escaped by using <tt>&amp;lt;</tt>, <tt>&amp;gt;</tt> and <tt>&amp;amp;</tt>.
A tag pair consists of a left and a right tag (or open/close tags).
Left-tags mark the starting point for formatting, while right-tags
mark the ending point. A right-tag always start with a <tt>/</tt> before
the tag keyword. For example <tt>&lt;b&gt;</tt> and <tt>&lt;/b&gt;</tt> are a tag pair.
Tags can be nested, but they have to be closed in the same order as
they are opened. For example, <tt>&lt;b&gt;&lt;u&gt;&lt;/u&gt;&lt;/b&gt;</tt> is valid, while <tt>&lt;b&gt;&lt;u&gt;&lt;/b&gt;&lt;/u&gt;</tt> will output an error message.
<p> By using tags it is possible to change the color, bold, italic and
underline settings for a piece of text. A color can be specified
by using the HTML font tag <tt>&lt;font color=colorname&gt;</tt>. The color
name can be one of the color names from the X11 color database, or
a RGB hex value (e.g <tt>#00ff00</tt>). Example of valid color tags:
<tt>&lt;font color=red&gt;</tt>, <tt>&lt;font color="light blue"&gt;</tt>, <tt>&lt;font color="#223344"&gt;</tt>. Bold, italic and underline settings can be
specified by the tags <tt>&lt;b&gt;</tt>, <tt>&lt;i&gt;</tt> and <tt>&lt;u&gt;</tt>. Note that a
tag does not necessarily have to be closed. A valid example:
<pre>
This is &lt;font color=red&gt;red&lt;/font&gt; while &lt;b&gt;this&lt;/b&gt; is &lt;font color=blue&gt;blue&lt;/font&gt;.
&lt;font color=green&gt;&lt;font color=yellow&gt;Yellow,&lt;/font&gt; and &lt;u&gt;green&lt;/u&gt;.
</pre>
<p> Stylesheets can also be used in LogText mode. To create and use a
custom tag, you could do the following:
<pre>
QTextEdit * log = new QTextEdit( this );
log-&gt;<a href="#setTextFormat">setTextFormat</a>( Qt::<a href="qt.html#TextFormat-enum">LogText</a> );
<a href="qstylesheetitem.html">QStyleSheetItem</a> * item = new <a href="qstylesheetitem.html">QStyleSheetItem</a>( log-&gt;<a href="#styleSheet">styleSheet</a>(), "mytag" );
item-&gt;<a href="qstylesheetitem.html#setColor">setColor</a>( "red" );
item-&gt;<a href="qstylesheetitem.html#setFontWeight">setFontWeight</a>( QFont::Bold );
item-&gt;<a href="qstylesheetitem.html#setFontUnderline">setFontUnderline</a>( TRUE );
log-&gt;<a href="#append">append</a>( "This is a &lt;mytag&gt;custom tag&lt;/mytag&gt;!" );
</pre>
Note that only the color, bold, underline and italic attributes of
a <a href="qstylesheetitem.html">QStyleSheetItem</a> is used in LogText mode.
<p> Note that you can use <a href="#setMaxLogLines">setMaxLogLines</a>() to limit the number of
lines the widget can hold in LogText mode.
<p> There are a few things that you need to be aware of when the
widget is in this mode:
<ul>
<li> Functions that deal with rich text formatting and cursor
movement will not work or return anything valid.
<li> Lines are equivalent to paragraphs.
</ul>
<p> <h3> Using QTextEdit as an Editor
</h3>
<a name="1-2"></a><p> All the information about using QTextEdit as a display widget also
applies here.
<p> The current format's attributes are set with <a href="#setItalic">setItalic</a>(),
<a href="#setBold">setBold</a>(), <a href="#setUnderline">setUnderline</a>(), <a href="#setFamily">setFamily</a>() (font family),
<a href="#setPointSize">setPointSize</a>(), <a href="#setColor">setColor</a>() and <a href="#setCurrentFont">setCurrentFont</a>(). The current
paragraph's alignment is set with <a href="#setAlignment">setAlignment</a>().
<p> Use <a href="#setSelection">setSelection</a>() to select text. The <a href="#setSelectionAttributes">setSelectionAttributes</a>()
function is used to indicate how selected text should be
displayed. Use <a href="#hasSelectedText">hasSelectedText</a>() to find out if any text is
selected. The currently selected text's position is available
using <a href="#getSelection">getSelection</a>() and the selected text itself is returned by
<a href="#selectedText">selectedText</a>(). The selection can be copied to the clipboard with
<a href="#copy">copy</a>(), or cut to the clipboard with <a href="#cut">cut</a>(). It can be deleted with
<a href="#removeSelectedText">removeSelectedText</a>(). The entire text can be selected (or
unselected) using <a href="#selectAll">selectAll</a>(). QTextEdit supports multiple
selections. Most of the selection functions operate on the default
selection, selection 0. If the user presses a non-selecting key,
e.g. a cursor key without also holding down Shift, all selections
are cleared.
<p> Set and get the position of the cursor with <a href="#setCursorPosition">setCursorPosition</a>()
and <a href="#getCursorPosition">getCursorPosition</a>() respectively. When the cursor is moved,
the signals <a href="#currentFontChanged">currentFontChanged</a>(), <a href="#currentColorChanged">currentColorChanged</a>() and
<a href="#currentAlignmentChanged">currentAlignmentChanged</a>() are emitted to reflect the font, color
and alignment at the new cursor position.
<p> If the text changes, the <a href="#textChanged">textChanged</a>() signal is emitted, and if
the user inserts a new line by pressing Return or Enter,
<a href="#returnPressed">returnPressed</a>() is emitted. The <a href="#isModified">isModified</a>() function will return
TRUE if the text has been modified.
<p> QTextEdit provides command-based undo and redo. To set the depth
of the command history use <a href="#setUndoDepth">setUndoDepth</a>() which defaults to 100
steps. To undo or redo the last operation call <a href="#undo">undo</a>() or <a href="#redo">redo</a>().
The signals <a href="#undoAvailable">undoAvailable</a>() and <a href="#redoAvailable">redoAvailable</a>() indicate whether
the undo and redo operations can be executed.
<p> The indent() function is used to reindent a paragraph. It is
useful for code editors, for example in <a href="designer-manual.html">Qt Designer</a>'s code editor <em>Ctrl+I</em> invokes the indent()
function.
<p> <h4> Editing key bindings
</h4>
<a name="1-2-1"></a><p> The list of key-bindings which are implemented for editing:
<center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Keypresses <th valign="top">Action
<tr bgcolor="#f0f0f0"> <td valign="top">Backspace <td valign="top">Delete the character to the left of the cursor
<tr bgcolor="#d0d0d0"> <td valign="top">Delete <td valign="top">Delete the character to the right of the cursor
<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+A <td valign="top">Move the cursor to the beginning of the line
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+B <td valign="top">Move the cursor one character left
<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+C <td valign="top">Copy the marked text to the clipboard (also
Ctrl+Insert under Windows)
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+D <td valign="top">Delete the character to the right of the cursor
<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+E <td valign="top">Move the cursor to the end of the line
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+F <td valign="top">Move the cursor one character right
<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+H <td valign="top">Delete the character to the left of the cursor
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+K <td valign="top">Delete to end of line
<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+N <td valign="top">Move the cursor one line down
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+P <td valign="top">Move the cursor one line up
<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+V <td valign="top">Paste the clipboard text into line edit
(also Shift+Insert under Windows)
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+X <td valign="top">Cut the marked text, copy to clipboard
(also Shift+Delete under Windows)
<tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+Z <td valign="top">Undo the last operation
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+Y <td valign="top">Redo the last operation
<tr bgcolor="#f0f0f0"> <td valign="top">LeftArrow <td valign="top">Move the cursor one character left
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+LeftArrow <td valign="top">Move the cursor one word left
<tr bgcolor="#f0f0f0"> <td valign="top">RightArrow <td valign="top">Move the cursor one character right
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+RightArrow <td valign="top">Move the cursor one word right
<tr bgcolor="#f0f0f0"> <td valign="top">UpArrow <td valign="top">Move the cursor one line up
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+UpArrow <td valign="top">Move the cursor one word up
<tr bgcolor="#f0f0f0"> <td valign="top">DownArrow <td valign="top">Move the cursor one line down
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+Down Arrow <td valign="top">Move the cursor one word down
<tr bgcolor="#f0f0f0"> <td valign="top">PageUp <td valign="top">Move the cursor one page up
<tr bgcolor="#d0d0d0"> <td valign="top">PageDown <td valign="top">Move the cursor one page down
<tr bgcolor="#f0f0f0"> <td valign="top">Home <td valign="top">Move the cursor to the beginning of the line
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+Home <td valign="top">Move the cursor to the beginning of the text
<tr bgcolor="#f0f0f0"> <td valign="top">End <td valign="top">Move the cursor to the end of the line
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+End <td valign="top">Move the cursor to the end of the text
<tr bgcolor="#f0f0f0"> <td valign="top">Shift+Wheel <td valign="top">Scroll the page horizontally
(the Wheel is the mouse wheel)
<tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+Wheel <td valign="top">Zoom the text
</table></center>
<p> To select (mark) text hold down the Shift key whilst pressing one
of the movement keystrokes, for example, <em>Shift+Right Arrow</em>
will select the character to the right, and <em>Shift+Ctrl+Right Arrow</em> will select the word to the right, etc.
<p> By default the text edit widget operates in insert mode so all
text that the user enters is inserted into the text edit and any
text to the right of the cursor is moved out of the way. The mode
can be changed to overwrite, where new text overwrites any text to
the right of the cursor, using <a href="#setOverwriteMode">setOverwriteMode</a>().
<p>See also <a href="basic.html">Basic Widgets</a> and <a href="text.html">Text Related Classes</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="AutoFormatting-enum"></a>QTextEdit::AutoFormatting</h3>
<ul>
<li><tt>QTextEdit::AutoNone</tt> - Do not perform any automatic formatting
<li><tt>QTextEdit::AutoBulletList</tt> - Only automatically format bulletted lists
<li><tt>QTextEdit::AutoAll</tt> - Apply all available autoformatting
</ul>
<h3 class=fn><a name="CursorAction-enum"></a>QTextEdit::CursorAction</h3>
<p> This enum is used by <a href="#moveCursor">moveCursor</a>() to specify in which direction
the cursor should be moved:
<ul>
<li><tt>QTextEdit::MoveBackward</tt> - Moves the cursor one character backward
<li><tt>QTextEdit::MoveWordBackward</tt> - Moves the cursor one word backward
<li><tt>QTextEdit::MoveForward</tt> - Moves the cursor one character forward
<li><tt>QTextEdit::MoveWordForward</tt> - Moves the cursor one word forward
<li><tt>QTextEdit::MoveUp</tt> - Moves the cursor up one line
<li><tt>QTextEdit::MoveDown</tt> - Moves the cursor down one line
<li><tt>QTextEdit::MoveLineStart</tt> - Moves the cursor to the beginning of the line
<li><tt>QTextEdit::MoveLineEnd</tt> - Moves the cursor to the end of the line
<li><tt>QTextEdit::MoveHome</tt> - Moves the cursor to the beginning of the document
<li><tt>QTextEdit::MoveEnd</tt> - Moves the cursor to the end of the document
<li><tt>QTextEdit::MovePgUp</tt> - Moves the cursor one viewport page up
<li><tt>QTextEdit::MovePgDown</tt> - Moves the cursor one viewport page down
</ul>
<h3 class=fn><a name="KeyboardAction-enum"></a>QTextEdit::KeyboardAction</h3>
<p> This enum is used by <a href="#doKeyboardAction">doKeyboardAction</a>() to specify which action
should be executed:
<ul>
<li><tt>QTextEdit::ActionBackspace</tt> - Delete the character to the left of the
cursor.
<li><tt>QTextEdit::ActionDelete</tt> - Delete the character to the right of the
cursor.
<li><tt>QTextEdit::ActionReturn</tt> - Split the paragraph at the cursor position.
<li><tt>QTextEdit::ActionKill</tt> - If the cursor is not at the end of the
paragraph, delete the text from the cursor position until the end
of the paragraph. If the cursor is at the end of the paragraph,
delete the hard line break at the end of the paragraph: this will
cause this paragraph to be joined with the following paragraph.
<li><tt>QTextEdit::ActionWordBackspace</tt> - Delete the word to the left of the
cursor position.
<li><tt>QTextEdit::ActionWordDelete</tt> - Delete the word to the right of the
cursor position
</ul><p>
<h3 class=fn><a name="VerticalAlignment-enum"></a>QTextEdit::VerticalAlignment</h3>
<p> This enum is used to set the vertical alignment of the text.
<ul>
<li><tt>QTextEdit::AlignNormal</tt> - Normal alignment
<li><tt>QTextEdit::AlignSuperScript</tt> - Superscript
<li><tt>QTextEdit::AlignSubScript</tt> - Subscript
</ul>
<h3 class=fn><a name="WordWrap-enum"></a>QTextEdit::WordWrap</h3>
<p> This enum defines the QTextEdit's word wrap modes.
<ul>
<li><tt>QTextEdit::NoWrap</tt> - Do not wrap the text.
<li><tt>QTextEdit::WidgetWidth</tt> - Wrap the text at the current width of the
widget (this is the default). Wrapping is at whitespace by
default; this can be changed with <a href="#setWrapPolicy">setWrapPolicy</a>().
<li><tt>QTextEdit::FixedPixelWidth</tt> - Wrap the text at a fixed number of pixels
from the widget's left side. The number of pixels is set with
<a href="#wrapColumnOrWidth">wrapColumnOrWidth</a>().
<li><tt>QTextEdit::FixedColumnWidth</tt> - Wrap the text at a fixed number of
character columns from the widget's left side. The number of
characters is set with wrapColumnOrWidth(). This is useful if you
need formatted text that can also be displayed gracefully on
devices with monospaced fonts, for example a standard VT100
terminal, where you might set wrapColumnOrWidth() to 80.
</ul><p> <p>See also <a href="#wordWrap-prop">wordWrap</a> and <a href="#wordWrap-prop">wordWrap</a>.
<h3 class=fn><a name="WrapPolicy-enum"></a>QTextEdit::WrapPolicy</h3>
<p> This enum defines where text can be wrapped in word wrap mode.
<ul>
<li><tt>QTextEdit::AtWhiteSpace</tt> - Don't use this deprecated value (it is a
synonym for <a href="#WrapPolicy-enum">AtWordBoundary</a> which you should use instead).
<li><tt>QTextEdit::Anywhere</tt> - Break anywhere, including within words.
<li><tt>QTextEdit::AtWordBoundary</tt> - Break lines at word boundaries, e.g. spaces or
newlines
<li><tt>QTextEdit::AtWordOrDocumentBoundary</tt> - Break lines at whitespace, e.g.
spaces or newlines if possible. Break it anywhere otherwise.
</ul><p> <p>See also <a href="#wrapPolicy-prop">wrapPolicy</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QTextEdit"></a>QTextEdit::QTextEdit ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;context = QString::null, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a QTextEdit called <em>name</em>, with parent <em>parent</em>. The
text edit will display the text <em>text</em> using context <em>context</em>.
<p> The <em>context</em> is a path which the text edit's <a href="qmimesourcefactory.html">QMimeSourceFactory</a>
uses to resolve the locations of files and images. It is passed to
the <a href="#mimeSourceFactory">mimeSourceFactory</a>() when quering data.
<p> For example if the text contains an image tag,
<tt>&lt;img src="image.png"&gt;</tt>, and the context is "path/to/look/in", the
QMimeSourceFactory will try to load the image from
"path/to/look/in/image.png". If the tag was
<tt>&lt;img src="/image.png"&gt;</tt>, the context will not be used (because
QMimeSourceFactory recognizes that we have used an absolute path)
and will try to load "/image.png". The context is applied in exactly
the same way to <em>hrefs</em>, for example,
<tt>&lt;a href="target.html"&gt;Target&lt;/a&gt;</tt>, would resolve to
"path/to/look/in/target.html".
<h3 class=fn><a name="QTextEdit-2"></a>QTextEdit::QTextEdit ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs an empty QTextEdit called <em>name</em>, with parent <em>parent</em>.
<h3 class=fn>int <a name="alignment"></a>QTextEdit::alignment () const
</h3>
Returns the alignment of the current paragraph.
<p> <p>See also <a href="#setAlignment">setAlignment</a>().
<h3 class=fn><a href="qstring.html">QString</a> <a name="anchorAt"></a>QTextEdit::anchorAt ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos, <a href="qt.html#AnchorAttribute-enum">AnchorAttribute</a>&nbsp;attr )
</h3>
If there is an anchor at position <em>pos</em> (in contents
coordinates), the text for attribute <em>attr</em> is returned,
otherwise <a href="qstring.html#QString-null">QString::null</a> is returned.
<h3 class=fn><a href="qstring.html">QString</a> <a name="anchorAt-2"></a>QTextEdit::anchorAt ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> If there is an anchor at position <em>pos</em> (in contents
coordinates), its <tt>href</tt> is returned, otherwise <a href="qstring.html#QString-null">QString::null</a> is
returned.
<h3 class=fn>void <a name="append"></a>QTextEdit::append ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text )<tt> [virtual slot]</tt>
</h3>
Appends a new paragraph with <em>text</em> to the end of the text edit. Note that
the undo/redo history is cleared by this function, and no undo
history is kept for appends which makes them faster than
<a href="#insert">insert</a>()s. If you want to append text which is added to the
undo/redo history as well, use <a href="#insertParagraph">insertParagraph</a>().
<p>Examples: <a href="clientserver-example.html#x805">network/clientserver/client/client.cpp</a>, <a href="clientserver-example.html#x786">network/clientserver/server/server.cpp</a>, <a href="httpd-example.html#x734">network/httpd/httpd.cpp</a>, and <a href="process-example.html#x103">process/process.cpp</a>.
<h3 class=fn>uint <a name="autoFormatting"></a>QTextEdit::autoFormatting () const
</h3><p>Returns the enabled set of auto formatting features.
See the <a href="qtextedit.html#autoFormatting-prop">"autoFormatting"</a> property for details.
<h3 class=fn>bool <a name="bold"></a>QTextEdit::bold () const
</h3>
Returns TRUE if the current format is bold; otherwise returns FALSE.
<p> <p>See also <a href="#setBold">setBold</a>().
<h3 class=fn>int <a name="charAt"></a>QTextEdit::charAt ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos, int&nbsp;*&nbsp;para ) const
</h3>
Returns the index of the character (relative to its paragraph) at
position <em>pos</em> (in contents coordinates). If <em>para</em> is not 0,
<em>*para</em> is set to the character's paragraph.
<h3 class=fn>void <a name="clear"></a>QTextEdit::clear ()<tt> [virtual slot]</tt>
</h3>
Deletes all the text in the text edit.
<p> <p>See also <a href="#cut">cut</a>(), <a href="#removeSelectedText">removeSelectedText</a>(), and <a href="#text-prop">text</a>.
<h3 class=fn>void <a name="clearParagraphBackground"></a>QTextEdit::clearParagraphBackground ( int&nbsp;para )<tt> [virtual slot]</tt>
</h3>
Clears the background color of the paragraph <em>para</em>, so that the
default color is used again.
<h3 class=fn>void <a name="clicked"></a>QTextEdit::clicked ( int&nbsp;para, int&nbsp;pos )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the mouse is clicked on the paragraph
<em>para</em> at character position <em>pos</em>.
<p> <p>See also <a href="#doubleClicked">doubleClicked</a>().
<h3 class=fn><a href="qcolor.html">QColor</a> <a name="color"></a>QTextEdit::color () const
</h3>
Returns the color of the current format.
<p> <p>See also <a href="#setColor">setColor</a>() and <a href="#paper-prop">paper</a>.
<h3 class=fn><a href="qstring.html">QString</a> <a name="context"></a>QTextEdit::context () const
</h3>
Returns the context of the text edit. The context is a path which
the text edit's <a href="qmimesourcefactory.html">QMimeSourceFactory</a> uses to resolve the locations
of files and images.
<p> <p>See also <a href="#text-prop">text</a>.
<p>Examples: <a href="qaction-application-example.html#x1164">action/application.cpp</a>, <a href="simple-application-example.html#x1582">application/application.cpp</a>, <a href="helpviewer-example.html#x1028">helpviewer/helpwindow.cpp</a>, <a href="mdi-example.html#x2068">mdi/application.cpp</a>, and <a href="qdir-example.html#x1843">qdir/qdir.cpp</a>.
<h3 class=fn>void <a name="copy"></a>QTextEdit::copy ()<tt> [virtual slot]</tt>
</h3>
Copies any selected text (from selection 0) to the clipboard.
<p> <p>See also <a href="#hasSelectedText-prop">hasSelectedText</a> and <a href="#copyAvailable">copyAvailable</a>().
<h3 class=fn>void <a name="copyAvailable"></a>QTextEdit::copyAvailable ( bool&nbsp;yes )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when text is selected or de-selected in the
text edit.
<p> When text is selected this signal will be emitted with <em>yes</em> set
to TRUE. If no text has been selected or if the selected text is
de-selected this signal is emitted with <em>yes</em> set to FALSE.
<p> If <em>yes</em> is TRUE then <a href="#copy">copy</a>() can be used to copy the selection to
the clipboard. If <em>yes</em> is FALSE then copy() does nothing.
<p> <p>See also <a href="#selectionChanged">selectionChanged</a>().
<h3 class=fn><a href="qpopupmenu.html">QPopupMenu</a>&nbsp;* <a name="createPopupMenu"></a>QTextEdit::createPopupMenu ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos )<tt> [virtual protected]</tt>
</h3>
This function is called to create a right mouse button popup menu
at the document position <em>pos</em>. If you want to create a custom
popup menu, reimplement this function and return the created popup
menu. Ownership of the popup menu is transferred to the caller.
<p> <b>Warning:</b> The <a href="qpopupmenu.html">QPopupMenu</a> ID values 0-7 are reserved, and they map to the
standard operations. When inserting items into your custom popup menu, be
sure to specify ID values larger than 7.
<h3 class=fn><a href="qpopupmenu.html">QPopupMenu</a>&nbsp;* <a name="createPopupMenu-2"></a>QTextEdit::createPopupMenu ()<tt> [virtual protected]</tt>
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> This function is called to create a right mouse button popup menu.
If you want to create a custom popup menu, reimplement this function
and return the created popup menu. Ownership of the popup menu is
transferred to the caller.
<p> This function is only called if <a href="#createPopupMenu">createPopupMenu</a>( const <a href="qpoint.html">QPoint</a> & )
returns 0.
<h3 class=fn>void <a name="currentAlignmentChanged"></a>QTextEdit::currentAlignmentChanged ( int&nbsp;a )<tt> [signal]</tt>
</h3>
<p> This signal is emitted if the alignment of the current paragraph
has changed.
<p> The new alignment is <em>a</em>.
<p> <p>See also <a href="#setAlignment">setAlignment</a>().
<h3 class=fn>void <a name="currentColorChanged"></a>QTextEdit::currentColorChanged ( const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;c )<tt> [signal]</tt>
</h3>
<p> This signal is emitted if the color of the current format has
changed.
<p> The new color is <em>c</em>.
<p> <p>See also <a href="#setColor">setColor</a>().
<h3 class=fn><a href="qfont.html">QFont</a> <a name="currentFont"></a>QTextEdit::currentFont () const
</h3>
Returns the font of the current format.
<p> <p>See also <a href="#setCurrentFont">setCurrentFont</a>(), <a href="#setFamily">setFamily</a>(), and <a href="#setPointSize">setPointSize</a>().
<h3 class=fn>void <a name="currentFontChanged"></a>QTextEdit::currentFontChanged ( const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;f )<tt> [signal]</tt>
</h3>
<p> This signal is emitted if the font of the current format has
changed.
<p> The new font is <em>f</em>.
<p> <p>See also <a href="#setCurrentFont">setCurrentFont</a>().
<h3 class=fn>void <a name="currentVerticalAlignmentChanged"></a>QTextEdit::currentVerticalAlignmentChanged ( <a href="qtextedit.html#VerticalAlignment-enum">VerticalAlignment</a>&nbsp;a )<tt> [signal]</tt>
</h3>
<p> This signal is emitted if the vertical alignment of the current
format has changed.
<p> The new vertical alignment is <em>a</em>.
<p> <p>See also <a href="#setVerticalAlignment">setVerticalAlignment</a>().
<h3 class=fn>void <a name="cursorPositionChanged"></a>QTextEdit::cursorPositionChanged ( int&nbsp;para, int&nbsp;pos )<tt> [signal]</tt>
</h3>
<p> This signal is emitted if the position of the cursor has changed.
<em>para</em> contains the paragraph index and <em>pos</em> contains the
character position within the paragraph.
<p> <p>See also <a href="#setCursorPosition">setCursorPosition</a>().
<h3 class=fn>void <a name="cut"></a>QTextEdit::cut ()<tt> [virtual slot]</tt>
</h3>
Copies the selected text (from selection 0) to the clipboard and
deletes it from the text edit.
<p> If there is no selected text (in selection 0) nothing happens.
<p> <p>See also <a href="#copy">QTextEdit::copy</a>(), <a href="#paste">paste</a>(), and <a href="#pasteSubType">pasteSubType</a>().
<h3 class=fn>void <a name="del"></a>QTextEdit::del ()<tt> [virtual slot]</tt>
</h3>
If there is some selected text (in selection 0) it is deleted. If
there is no selected text (in selection 0) the character to the
right of the text cursor is deleted.
<p> <p>See also <a href="#removeSelectedText">removeSelectedText</a>() and <a href="#cut">cut</a>().
<h3 class=fn>void <a name="doKeyboardAction"></a>QTextEdit::doKeyboardAction ( <a href="qtextedit.html#KeyboardAction-enum">KeyboardAction</a>&nbsp;action )<tt> [virtual slot]</tt>
</h3>
Executes keyboard action <em>action</em>. This is normally called by a
key event handler.
<h3 class=fn><a href="qstring.html">QString</a> <a name="documentTitle"></a>QTextEdit::documentTitle () const
</h3><p>Returns the title of the document parsed from the text.
See the <a href="qtextedit.html#documentTitle-prop">"documentTitle"</a> property for details.
<h3 class=fn>void <a name="doubleClicked"></a>QTextEdit::doubleClicked ( int&nbsp;para, int&nbsp;pos )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the mouse is double-clicked on the
paragraph <em>para</em> at character position <em>pos</em>.
<p> <p>See also <a href="#clicked">clicked</a>().
<h3 class=fn>void <a name="ensureCursorVisible"></a>QTextEdit::ensureCursorVisible ()<tt> [virtual slot]</tt>
</h3>
Ensures that the cursor is visible by scrolling the text edit if
necessary.
<p> <p>See also <a href="#setCursorPosition">setCursorPosition</a>().
<h3 class=fn><a href="qstring.html">QString</a> <a name="family"></a>QTextEdit::family () const
</h3>
Returns the font family of the current format.
<p> <p>See also <a href="#setFamily">setFamily</a>(), <a href="#setCurrentFont">setCurrentFont</a>(), and <a href="#setPointSize">setPointSize</a>().
<h3 class=fn>bool <a name="find"></a>QTextEdit::find ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;expr, bool&nbsp;cs, bool&nbsp;wo, bool&nbsp;forward = TRUE, int&nbsp;*&nbsp;para = 0, int&nbsp;*&nbsp;index = 0 )<tt> [virtual]</tt>
</h3>
Finds the next occurrence of the string, <em>expr</em>. Returns TRUE if
<em>expr</em> was found; otherwise returns FALSE.
<p> If <em>para</em> and <em>index</em> are both 0 the search begins from the
current cursor position. If <em>para</em> and <em>index</em> are both not 0,
the search begins from the <em>*index</em> character position in the
<em>*para</em> paragraph.
<p> If <em>cs</em> is TRUE the search is case sensitive, otherwise it is
case insensitive. If <em>wo</em> is TRUE the search looks for whole word
matches only; otherwise it searches for any matching text. If <em>forward</em> is TRUE (the default) the search works forward from the
starting position to the end of the text, otherwise it works
backwards to the beginning of the text.
<p> If <em>expr</em> is found the function returns TRUE. If <em>index</em> and <em>para</em> are not 0, the number of the paragraph in which the first
character of the match was found is put into <em>*para</em>, and the
index position of that character within the paragraph is put into
<em>*index</em>.
<p> If <em>expr</em> is not found the function returns FALSE. If <em>index</em>
and <em>para</em> are not 0 and <em>expr</em> is not found, <em>*index</em>
and <em>*para</em> are undefined.
<p> Please note that this function will make the next occurrence of
the string (if found) the current selection, and will thus
modify the cursor position.
<p> Using the <em>para</em> and <em>index</em> parameters will not work correctly
in case the document contains tables.
<h3 class=fn>bool <a name="focusNextPrevChild"></a>QTextEdit::focusNextPrevChild ( bool&nbsp;n )<tt> [virtual protected]</tt>
</h3>
Reimplemented to allow tabbing through links. If <em>n</em> is TRUE the
tab moves the focus to the next child; if <em>n</em> is FALSE the tab
moves the focus to the previous child. Returns TRUE if the focus
was moved; otherwise returns FALSE.
<h3 class=fn><a href="qfont.html">QFont</a> <a name="font"></a>QTextEdit::font () const
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Returns <a href="qwidget.html#font">QScrollView::font</a>()
<p> <b>Warning:</b> In previous versions this function returned the font of
the current format. This lead to confusion. Please use
<a href="#currentFont">currentFont</a>() instead.
<p>Example: <a href="qwerty-example.html#x396">qwerty/qwerty.cpp</a>.
<h3 class=fn>void <a name="getCursorPosition"></a>QTextEdit::getCursorPosition ( int&nbsp;*&nbsp;para, int&nbsp;*&nbsp;index ) const
</h3>
This function sets the <em>*para</em> and <em>*index</em> parameters to the
current cursor position. <em>para</em> and <em>index</em> must not be 0.
<p> <p>See also <a href="#setCursorPosition">setCursorPosition</a>().
<h3 class=fn>void <a name="getSelection"></a>QTextEdit::getSelection ( int&nbsp;*&nbsp;paraFrom, int&nbsp;*&nbsp;indexFrom, int&nbsp;*&nbsp;paraTo, int&nbsp;*&nbsp;indexTo, int&nbsp;selNum = 0 ) const
</h3>
If there is a selection, <em>*paraFrom</em> is set to the number of the
paragraph in which the selection begins and <em>*paraTo</em> is set to
the number of the paragraph in which the selection ends. (They
could be the same.) <em>*indexFrom</em> is set to the index at which the
selection begins within <em>*paraFrom</em>, and <em>*indexTo</em> is set to
the index at which the selection ends within <em>*paraTo</em>.
<p> If there is no selection, <em>*paraFrom</em>, <em>*indexFrom</em>, <em>*paraTo</em>
and <em>*indexTo</em> are all set to -1.
<p> If <em>paraFrom</em>, <em>indexFrom</em>, <em>paraTo</em> or <em>indexTo</em> is 0 this
function does nothing.
<p> The <em>selNum</em> is the number of the selection (multiple selections
are supported). It defaults to 0 (the default selection).
<p> <p>See also <a href="#setSelection">setSelection</a>() and <a href="#selectedText-prop">selectedText</a>.
<h3 class=fn>bool <a name="hasSelectedText"></a>QTextEdit::hasSelectedText () const
</h3><p>Returns TRUE if some text is selected in selection 0; otherwise returns FALSE.
See the <a href="qtextedit.html#hasSelectedText-prop">"hasSelectedText"</a> property for details.
<h3 class=fn>int <a name="heightForWidth"></a>QTextEdit::heightForWidth ( int&nbsp;w ) const<tt> [virtual]</tt>
</h3>
Returns how many pixels high the text edit needs to be to display
all the text if the text edit is <em>w</em> pixels wide.
<p>Reimplemented from <a href="qwidget.html#heightForWidth">QWidget</a>.
<h3 class=fn>void <a name="insert"></a>QTextEdit::insert ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, uint&nbsp;insertionFlags = CheckNewLines | RemoveSelected )<tt> [slot]</tt>
</h3>
Inserts <em>text</em> at the current cursor position.
<p> The <em>insertionFlags</em> define how the text is inserted. If <a href="#TextInsertionFlags-enum">RedoIndentation</a> is set, the paragraph is re-indented. If <a href="#TextInsertionFlags-enum">CheckNewLines</a> is set, newline characters in <em>text</em> result in hard
line breaks (i.e. new paragraphs). If <tt>checkNewLine</tt> is not set,
the behaviour of the editor is undefined if the <em>text</em> contains
newlines. (It is not possible to change QTextEdit's newline handling
behavior, but you can use <a href="qstring.html#replace">QString::replace</a>() to preprocess text
before inserting it.) If <a href="#TextInsertionFlags-enum">RemoveSelected</a> is set, any selected
text (in selection 0) is removed before the text is inserted.
<p> The default flags are <a href="#TextInsertionFlags-enum">CheckNewLines</a> | <a href="#TextInsertionFlags-enum">RemoveSelected</a>.
<p> If the widget is in <a href="qt.html#TextFormat-enum">LogText</a> mode this function will do nothing.
<p> <p>See also <a href="#paste">paste</a>() and <a href="#pasteSubType">pasteSubType</a>().
<h3 class=fn>void <a name="insert-2"></a>QTextEdit::insert ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, bool&nbsp;indent, bool&nbsp;checkNewLine = TRUE, bool&nbsp;removeSelected = TRUE )<tt> [virtual slot]</tt>
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p>
<h3 class=fn>void <a name="insertAt"></a>QTextEdit::insertAt ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, int&nbsp;para, int&nbsp;index )<tt> [virtual slot]</tt>
</h3>
Inserts <em>text</em> in the paragraph <em>para</em> at position <em>index</em>.
<h3 class=fn>void <a name="insertParagraph"></a>QTextEdit::insertParagraph ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, int&nbsp;para )<tt> [virtual slot]</tt>
</h3>
Inserts <em>text</em> as a new paragraph at position <em>para</em>. If <em>para</em>
is -1, the text is appended. Use <a href="#append">append</a>() if the append operation
is performance critical.
<h3 class=fn>bool <a name="isModified"></a>QTextEdit::isModified () const
</h3><p>Returns TRUE if the document has been modified by the user; otherwise returns FALSE.
See the <a href="qtextedit.html#modified-prop">"modified"</a> property for details.
<h3 class=fn>bool <a name="isOverwriteMode"></a>QTextEdit::isOverwriteMode () const
</h3><p>Returns the text edit's overwrite mode.
See the <a href="qtextedit.html#overwriteMode-prop">"overwriteMode"</a> property for details.
<h3 class=fn>bool <a name="isReadOnly"></a>QTextEdit::isReadOnly () const
</h3><p>Returns TRUE if the text edit is read-only; otherwise returns FALSE.
See the <a href="qtextedit.html#readOnly-prop">"readOnly"</a> property for details.
<h3 class=fn>bool <a name="isRedoAvailable"></a>QTextEdit::isRedoAvailable () const
</h3>
Returns TRUE if redo is available; otherwise returns FALSE.
<h3 class=fn>bool <a name="isUndoAvailable"></a>QTextEdit::isUndoAvailable () const
</h3>
Returns TRUE if undo is available; otherwise returns FALSE.
<h3 class=fn>bool <a name="isUndoRedoEnabled"></a>QTextEdit::isUndoRedoEnabled () const
</h3><p>Returns TRUE if undo/redo is enabled; otherwise returns FALSE.
See the <a href="qtextedit.html#undoRedoEnabled-prop">"undoRedoEnabled"</a> property for details.
<h3 class=fn>bool <a name="italic"></a>QTextEdit::italic () const
</h3>
Returns TRUE if the current format is italic; otherwise returns FALSE.
<p> <p>See also <a href="#setItalic">setItalic</a>().
<h3 class=fn>void <a name="keyPressEvent"></a>QTextEdit::keyPressEvent ( <a href="qkeyevent.html">QKeyEvent</a>&nbsp;*&nbsp;e )<tt> [virtual protected]</tt>
</h3>
Processes the key event, <em>e</em>. By default key events are used to
provide keyboard navigation and text editing.
<p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget</a>.
<p>Reimplemented in <a href="qtextbrowser.html#keyPressEvent">QTextBrowser</a>.
<h3 class=fn>int <a name="length"></a>QTextEdit::length () const
</h3><p>Returns the number of characters in the text.
See the <a href="qtextedit.html#length-prop">"length"</a> property for details.
<h3 class=fn>int <a name="lineOfChar"></a>QTextEdit::lineOfChar ( int&nbsp;para, int&nbsp;index )
</h3>
Returns the line number of the line in paragraph <em>para</em> in which
the character at position <em>index</em> appears. The <em>index</em> position is
relative to the beginning of the paragraph. If there is no such
paragraph or no such character at the <em>index</em> position (e.g. the
index is out of range) -1 is returned.
<h3 class=fn>int <a name="lines"></a>QTextEdit::lines () const
</h3>
Returns the number of lines in the text edit; this could be 0.
<p> <b>Warning:</b> This function may be slow. Lines change all the time
during word wrapping, so this function has to iterate over all the
paragraphs and get the number of lines from each one individually.
<h3 class=fn>int <a name="linesOfParagraph"></a>QTextEdit::linesOfParagraph ( int&nbsp;para ) const
</h3>
Returns the number of lines in paragraph <em>para</em>, or -1 if there
is no paragraph with index <em>para</em>.
<h3 class=fn>bool <a name="linkUnderline"></a>QTextEdit::linkUnderline () const
</h3><p>Returns TRUE if hypertext links will be underlined; otherwise returns FALSE.
See the <a href="qtextedit.html#linkUnderline-prop">"linkUnderline"</a> property for details.
<h3 class=fn>int <a name="maxLogLines"></a>QTextEdit::maxLogLines ()<tt> [slot]</tt>
</h3>
Returns the maximum number of lines QTextEdit can hold in <a href="qt.html#TextFormat-enum">LogText</a> mode. By default the number of lines is unlimited, which
is signified by a value of -1.
<h3 class=fn><a href="qmimesourcefactory.html">QMimeSourceFactory</a>&nbsp;* <a name="mimeSourceFactory"></a>QTextEdit::mimeSourceFactory () const
</h3>
Returns the <a href="qmimesourcefactory.html">QMimeSourceFactory</a> which is being used by this text
edit.
<p> <p>See also <a href="#setMimeSourceFactory">setMimeSourceFactory</a>().
<p>Examples: <a href="qaction-application-example.html#x1166">action/application.cpp</a>, <a href="simple-application-example.html#x1584">application/application.cpp</a>, <a href="helpviewer-example.html#x1030">helpviewer/helpwindow.cpp</a>, <a href="mdi-example.html#x2070">mdi/application.cpp</a>, and <a href="qdir-example.html#x1844">qdir/qdir.cpp</a>.
<h3 class=fn>void <a name="modificationChanged"></a>QTextEdit::modificationChanged ( bool&nbsp;m )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the modification status of the
document has changed. If <em>m</em> is TRUE, the document was modified,
otherwise the modification state has been reset to unmodified.
<p> <p>See also <a href="#modified-prop">modified</a>.
<h3 class=fn>void <a name="moveCursor"></a>QTextEdit::moveCursor ( <a href="qtextedit.html#CursorAction-enum">CursorAction</a>&nbsp;action, bool&nbsp;select )<tt> [virtual slot]</tt>
</h3>
Moves the text cursor according to <em>action</em>. This is normally
used by some key event handler. <em>select</em> specifies whether the
text between the current cursor position and the new position
should be selected.
<h3 class=fn><a href="qbrush.html">QBrush</a> <a name="paper"></a>QTextEdit::paper () const
</h3><p>Returns the background (paper) brush.
See the <a href="qtextedit.html#paper-prop">"paper"</a> property for details.
<h3 class=fn>int <a name="paragraphAt"></a>QTextEdit::paragraphAt ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos ) const
</h3>
Returns the paragraph which is at position <em>pos</em> (in contents
coordinates).
<h3 class=fn><a href="qcolor.html">QColor</a> <a name="paragraphBackgroundColor"></a>QTextEdit::paragraphBackgroundColor ( int&nbsp;para ) const
</h3>
Returns the background color of the paragraph <em>para</em> or an
invalid color if <em>para</em> is out of range or the paragraph has no
background set
<h3 class=fn>int <a name="paragraphLength"></a>QTextEdit::paragraphLength ( int&nbsp;para ) const
</h3>
Returns the length of the paragraph <em>para</em> (i.e. the number of
characters), or -1 if there is no paragraph with index <em>para</em>.
<p> This function ignores newlines.
<h3 class=fn><a href="qrect.html">QRect</a> <a name="paragraphRect"></a>QTextEdit::paragraphRect ( int&nbsp;para ) const
</h3>
Returns the rectangle of the paragraph <em>para</em> in contents
coordinates, or an invalid rectangle if <em>para</em> is out of range.
<h3 class=fn>int <a name="paragraphs"></a>QTextEdit::paragraphs () const
</h3>
Returns the number of paragraphs in the text; an empty textedit is always
considered to have one paragraph, so 1 is returned in this case.
<h3 class=fn>void <a name="paste"></a>QTextEdit::paste ()<tt> [virtual slot]</tt>
</h3>
Pastes the text from the clipboard into the text edit at the
current cursor position. Only plain text is pasted.
<p> If there is no text in the clipboard nothing happens.
<p> <p>See also <a href="#pasteSubType">pasteSubType</a>(), <a href="#cut">cut</a>(), and <a href="#copy">QTextEdit::copy</a>().
<h3 class=fn>void <a name="pasteSubType"></a>QTextEdit::pasteSubType ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;subtype )<tt> [virtual slot]</tt>
</h3>
Pastes the text with format <em>subtype</em> from the clipboard into the
text edit at the current cursor position. The <em>subtype</em> can be
"plain" or "html".
<p> If there is no text with format <em>subtype</em> in the clipboard
nothing happens.
<p> <p>See also <a href="#paste">paste</a>(), <a href="#cut">cut</a>(), and <a href="#copy">QTextEdit::copy</a>().
<h3 class=fn>void <a name="placeCursor"></a>QTextEdit::placeCursor ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos, QTextCursor&nbsp;*&nbsp;c = 0 )<tt> [virtual slot]</tt>
</h3>
Places the cursor <em>c</em> at the character which is closest to position
<em>pos</em> (in contents coordinates). If <em>c</em> is 0, the default text
cursor is used.
<p> <p>See also <a href="#setCursorPosition">setCursorPosition</a>().
<h3 class=fn>int <a name="pointSize"></a>QTextEdit::pointSize () const
</h3>
Returns the point size of the font of the current format.
<p> <p>See also <a href="#setFamily">setFamily</a>(), <a href="#setCurrentFont">setCurrentFont</a>(), and <a href="#setPointSize">setPointSize</a>().
<h3 class=fn>void <a name="redo"></a>QTextEdit::redo ()<tt> [virtual slot]</tt>
</h3>
Redoes the last operation.
<p> If there is no operation to redo, i.e. there is no redo step in
the undo/redo history, nothing happens.
<p> <p>See also <a href="#redoAvailable">redoAvailable</a>(), <a href="#undo">undo</a>(), and <a href="#undoDepth-prop">undoDepth</a>.
<h3 class=fn>void <a name="redoAvailable"></a>QTextEdit::redoAvailable ( bool&nbsp;yes )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the availability of redo changes. If
<em>yes</em> is TRUE, then <a href="#redo">redo</a>() will work until <a href="#redoAvailable">redoAvailable</a>( FALSE )
is next emitted.
<p> <p>See also <a href="#redo">redo</a>() and <a href="#undoDepth-prop">undoDepth</a>.
<h3 class=fn>void <a name="removeParagraph"></a>QTextEdit::removeParagraph ( int&nbsp;para )<tt> [virtual slot]</tt>
</h3>
Removes the paragraph <em>para</em>.
<h3 class=fn>void <a name="removeSelectedText"></a>QTextEdit::removeSelectedText ( int&nbsp;selNum = 0 )<tt> [virtual slot]</tt>
</h3>
Deletes the text of selection <em>selNum</em> (by default, the default
selection, 0). If there is no selected text nothing happens.
<p> <p>See also <a href="#selectedText-prop">selectedText</a> and <a href="#removeSelection">removeSelection</a>().
<h3 class=fn>void <a name="removeSelection"></a>QTextEdit::removeSelection ( int&nbsp;selNum = 0 )<tt> [virtual slot]</tt>
</h3>
Removes the selection <em>selNum</em> (by default 0). This does not
remove the selected text.
<p> <p>See also <a href="#removeSelectedText">removeSelectedText</a>().
<h3 class=fn>void <a name="repaintChanged"></a>QTextEdit::repaintChanged ()<tt> [protected]</tt>
</h3>
Repaints any paragraphs that have changed.
<p> Although used extensively internally you shouldn't need to call
this yourself.
<h3 class=fn>void <a name="returnPressed"></a>QTextEdit::returnPressed ()<tt> [signal]</tt>
</h3>
<p> This signal is emitted if the user pressed the Return or the Enter
key.
<h3 class=fn>void <a name="scrollToAnchor"></a>QTextEdit::scrollToAnchor ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;name )<tt> [virtual slot]</tt>
</h3>
Scrolls the text edit to make the text at the anchor called <em>name</em> visible, if it can be found in the document. If the anchor
isn't found no scrolling will occur. An anchor is defined using
the HTML anchor tag, e.g. <tt>&lt;a name="target"&gt;</tt>.
<h3 class=fn>void <a name="scrollToBottom"></a>QTextEdit::scrollToBottom ()<tt> [virtual slot]</tt>
</h3>
Scrolls to the bottom of the document and does formatting if
required.
<h3 class=fn>void <a name="selectAll"></a>QTextEdit::selectAll ( bool&nbsp;select = TRUE )<tt> [virtual slot]</tt>
</h3>
If <em>select</em> is TRUE (the default), all the text is selected as
selection 0. If <em>select</em> is FALSE any selected text is
unselected, i.e. the default selection (selection 0) is cleared.
<p> <p>See also <a href="#selectedText-prop">selectedText</a>.
<h3 class=fn><a href="qstring.html">QString</a> <a name="selectedText"></a>QTextEdit::selectedText () const
</h3><p>Returns the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0).
See the <a href="qtextedit.html#selectedText-prop">"selectedText"</a> property for details.
<h3 class=fn>void <a name="selectionChanged"></a>QTextEdit::selectionChanged ()<tt> [signal]</tt>
</h3>
<p> This signal is emitted whenever the selection changes.
<p> <p>See also <a href="#setSelection">setSelection</a>() and <a href="#copyAvailable">copyAvailable</a>().
<h3 class=fn>void <a name="setAlignment"></a>QTextEdit::setAlignment ( int&nbsp;a )<tt> [virtual slot]</tt>
</h3>
Sets the alignment of the current paragraph to <em>a</em>. Valid
alignments are <a href="qt.html#AlignmentFlags-enum">Qt::AlignLeft</a>, <a href="qt.html#AlignmentFlags-enum">Qt::AlignRight</a>,
<a href="qt.html#AlignmentFlags-enum">Qt::AlignJustify</a> and <a href="qt.html#AlignmentFlags-enum">Qt::AlignCenter</a> (which centers
horizontally).
<p>Reimplemented in <a href="qmultilineedit.html#setAlignment">QMultiLineEdit</a>.
<h3 class=fn>void <a name="setAutoFormatting"></a>QTextEdit::setAutoFormatting ( uint&nbsp;features )
</h3><p>Sets the enabled set of auto formatting features to <em>features</em>.
See the <a href="qtextedit.html#autoFormatting-prop">"autoFormatting"</a> property for details.
<h3 class=fn>void <a name="setBold"></a>QTextEdit::setBold ( bool&nbsp;b )<tt> [virtual slot]</tt>
</h3>
If <em>b</em> is TRUE sets the current format to bold; otherwise sets
the current format to non-bold.
<p> <p>See also <a href="#bold">bold</a>().
<h3 class=fn>void <a name="setColor"></a>QTextEdit::setColor ( const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;c )<tt> [virtual slot]</tt>
</h3>
Sets the color of the current format, i.e. of the text, to <em>c</em>.
<p> <p>See also <a href="#color">color</a>() and <a href="#paper-prop">paper</a>.
<h3 class=fn>void <a name="setCurrentFont"></a>QTextEdit::setCurrentFont ( const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;f )<tt> [virtual slot]</tt>
</h3>
<p> Sets the font of the current format to <em>f</em>.
<p> If the widget is in <a href="qt.html#TextFormat-enum">LogText</a> mode this function will do
nothing. Use <a href="qwidget.html#setFont">setFont</a>() instead.
<p> <p>See also <a href="#currentFont">currentFont</a>(), <a href="#setPointSize">setPointSize</a>(), and <a href="#setFamily">setFamily</a>().
<h3 class=fn>void <a name="setCursorPosition"></a>QTextEdit::setCursorPosition ( int&nbsp;para, int&nbsp;index )<tt> [virtual slot]</tt>
</h3>
Sets the cursor to position <em>index</em> in paragraph <em>para</em>.
<p> <p>See also <a href="#getCursorPosition">getCursorPosition</a>().
<h3 class=fn>void <a name="setFamily"></a>QTextEdit::setFamily ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;fontFamily )<tt> [virtual slot]</tt>
</h3>
Sets the font family of the current format to <em>fontFamily</em>.
<p> <p>See also <a href="#family">family</a>() and <a href="#setCurrentFont">setCurrentFont</a>().
<h3 class=fn>void <a name="setItalic"></a>QTextEdit::setItalic ( bool&nbsp;b )<tt> [virtual slot]</tt>
</h3>
If <em>b</em> is TRUE sets the current format to italic; otherwise sets
the current format to non-italic.
<p> <p>See also <a href="#italic">italic</a>().
<h3 class=fn>void <a name="setLinkUnderline"></a>QTextEdit::setLinkUnderline ( bool )<tt> [virtual slot]</tt>
</h3><p>Sets whether hypertext links will be underlined.
See the <a href="qtextedit.html#linkUnderline-prop">"linkUnderline"</a> property for details.
<h3 class=fn>void <a name="setMaxLogLines"></a>QTextEdit::setMaxLogLines ( int&nbsp;limit )<tt> [slot]</tt>
</h3>
Sets the maximum number of lines a QTextEdit can hold in <a href="qt.html#TextFormat-enum">LogText</a> mode to <em>limit</em>. If <em>limit</em> is -1 (the default), this
signifies an unlimited number of lines.
<p> <b>Warning:</b> Never use formatting tags that span more than one line
when the maximum log lines is set. When lines are removed from the
top of the buffer it could result in an unbalanced tag pair, i.e.
the left formatting tag is removed before the right one.
<h3 class=fn>void <a name="setMimeSourceFactory"></a>QTextEdit::setMimeSourceFactory ( <a href="qmimesourcefactory.html">QMimeSourceFactory</a>&nbsp;*&nbsp;factory )<tt> [virtual slot]</tt>
</h3>
Sets the text edit's mimesource factory to <em>factory</em>. See
<a href="qmimesourcefactory.html">QMimeSourceFactory</a> for further details.
<p> <p>See also <a href="#mimeSourceFactory">mimeSourceFactory</a>().
<h3 class=fn>void <a name="setModified"></a>QTextEdit::setModified ( bool&nbsp;m )<tt> [virtual slot]</tt>
</h3><p>Sets whether the document has been modified by the user to <em>m</em>.
See the <a href="qtextedit.html#modified-prop">"modified"</a> property for details.
<h3 class=fn>void <a name="setOverwriteMode"></a>QTextEdit::setOverwriteMode ( bool&nbsp;b )<tt> [virtual slot]</tt>
</h3><p>Sets the text edit's overwrite mode to <em>b</em>.
See the <a href="qtextedit.html#overwriteMode-prop">"overwriteMode"</a> property for details.
<h3 class=fn>void <a name="setPaper"></a>QTextEdit::setPaper ( const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;pap )<tt> [virtual slot]</tt>
</h3><p>Sets the background (paper) brush to <em>pap</em>.
See the <a href="qtextedit.html#paper-prop">"paper"</a> property for details.
<h3 class=fn>void <a name="setParagraphBackgroundColor"></a>QTextEdit::setParagraphBackgroundColor ( int&nbsp;para, const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;bg )<tt> [virtual slot]</tt>
</h3>
Sets the background color of the paragraph <em>para</em> to <em>bg</em>.
<h3 class=fn>void <a name="setPointSize"></a>QTextEdit::setPointSize ( int&nbsp;s )<tt> [virtual slot]</tt>
</h3>
Sets the point size of the current format to <em>s</em>.
<p> Note that if <em>s</em> is zero or negative, the behaviour of this
function is not defined.
<p> <p>See also <a href="#pointSize">pointSize</a>(), <a href="#setCurrentFont">setCurrentFont</a>(), and <a href="#setFamily">setFamily</a>().
<h3 class=fn>void <a name="setReadOnly"></a>QTextEdit::setReadOnly ( bool&nbsp;b )<tt> [virtual slot]</tt>
</h3><p>Sets whether the text edit is read-only to <em>b</em>.
See the <a href="qtextedit.html#readOnly-prop">"readOnly"</a> property for details.
<h3 class=fn>void <a name="setSelection"></a>QTextEdit::setSelection ( int&nbsp;paraFrom, int&nbsp;indexFrom, int&nbsp;paraTo, int&nbsp;indexTo, int&nbsp;selNum = 0 )<tt> [virtual slot]</tt>
</h3>
Sets a selection which starts at position <em>indexFrom</em> in
paragraph <em>paraFrom</em> and ends at position <em>indexTo</em> in paragraph
<em>paraTo</em>.
<p> Any existing selections which have a different id (<em>selNum</em>) are
left alone, but if an existing selection has the same id as <em>selNum</em> it is removed and replaced by this selection.
<p> Uses the selection settings of selection <em>selNum</em>. If <em>selNum</em>
is 0, this is the default selection.
<p> The cursor is moved to the end of the selection if <em>selNum</em> is 0,
otherwise the cursor position remains unchanged.
<p> <p>See also <a href="#getSelection">getSelection</a>() and <a href="#selectedText-prop">selectedText</a>.
<h3 class=fn>void <a name="setSelectionAttributes"></a>QTextEdit::setSelectionAttributes ( int&nbsp;selNum, const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;back, bool&nbsp;invertText )<tt> [virtual slot]</tt>
</h3>
Sets the background color of selection number <em>selNum</em> to <em>back</em>
and specifies whether the text of this selection should be
inverted with <em>invertText</em>.
<p> This only works for <em>selNum</em> > 0. The default selection (<em>selNum</em> == 0) gets its attributes from the text edit's
<a href="qwidget.html#colorGroup">colorGroup</a>().
<h3 class=fn>void <a name="setStyleSheet"></a>QTextEdit::setStyleSheet ( <a href="qstylesheet.html">QStyleSheet</a>&nbsp;*&nbsp;styleSheet )<tt> [virtual slot]</tt>
</h3>
Sets the stylesheet to use with this text edit to <em>styleSheet</em>.
Changes will only take effect for new text added with <a href="#setText">setText</a>() or
<a href="#append">append</a>().
<p> <p>See also <a href="#styleSheet">styleSheet</a>().
<h3 class=fn>void <a name="setTabChangesFocus"></a>QTextEdit::setTabChangesFocus ( bool&nbsp;b )<tt> [slot]</tt>
</h3><p>Sets whether TAB changes focus or is accepted as input to <em>b</em>.
See the <a href="qtextedit.html#tabChangesFocus-prop">"tabChangesFocus"</a> property for details.
<h3 class=fn>void <a name="setTabStopWidth"></a>QTextEdit::setTabStopWidth ( int&nbsp;ts )<tt> [virtual slot]</tt>
</h3><p>Sets the tab stop width in pixels to <em>ts</em>.
See the <a href="qtextedit.html#tabStopWidth-prop">"tabStopWidth"</a> property for details.
<h3 class=fn>void <a name="setText"></a>QTextEdit::setText ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;txt )<tt> [slot]</tt>
</h3><p>Sets the text edit's text to <em>txt</em>.
See the <a href="qtextedit.html#text-prop">"text"</a> property for details.
<h3 class=fn>void <a name="setText-2"></a>QTextEdit::setText ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;context )<tt> [virtual slot]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Changes the text of the text edit to the string <em>text</em> and the
context to <em>context</em>. Any previous text is removed.
<p> <em>text</em> may be interpreted either as plain text or as rich text,
depending on the <a href="#textFormat">textFormat</a>(). The default setting is <a href="qt.html#TextFormat-enum">AutoText</a>,
i.e. the text edit auto-detects the format from <em>text</em>.
<p> For rich text the rendering style and available tags are defined
by a <a href="#styleSheet">styleSheet</a>(); see <a href="qstylesheet.html">QStyleSheet</a> for details.
<p> The optional <em>context</em> is a path which the text edit's
<a href="qmimesourcefactory.html">QMimeSourceFactory</a> uses to resolve the locations of files and
images. (See <a href="#QTextEdit">QTextEdit::QTextEdit</a>().) It is passed to the text
edit's QMimeSourceFactory when quering data.
<p> Note that the undo/redo history is cleared by this function.
<p> <p>See also <a href="#text-prop">text</a> and <a href="#textFormat-prop">textFormat</a>.
<h3 class=fn>void <a name="setTextFormat"></a>QTextEdit::setTextFormat ( <a href="qt.html#TextFormat-enum">TextFormat</a>&nbsp;f )<tt> [virtual slot]</tt>
</h3><p>Sets the text format: rich text, plain text, log text or auto text to <em>f</em>.
See the <a href="qtextedit.html#textFormat-prop">"textFormat"</a> property for details.
<h3 class=fn>void <a name="setUnderline"></a>QTextEdit::setUnderline ( bool&nbsp;b )<tt> [virtual slot]</tt>
</h3>
If <em>b</em> is TRUE sets the current format to underline; otherwise
sets the current format to non-underline.
<p> <p>See also <a href="#underline">underline</a>().
<h3 class=fn>void <a name="setUndoDepth"></a>QTextEdit::setUndoDepth ( int&nbsp;d )<tt> [virtual slot]</tt>
</h3><p>Sets the depth of the undo history to <em>d</em>.
See the <a href="qtextedit.html#undoDepth-prop">"undoDepth"</a> property for details.
<h3 class=fn>void <a name="setUndoRedoEnabled"></a>QTextEdit::setUndoRedoEnabled ( bool&nbsp;b )<tt> [virtual slot]</tt>
</h3><p>Sets whether undo/redo is enabled to <em>b</em>.
See the <a href="qtextedit.html#undoRedoEnabled-prop">"undoRedoEnabled"</a> property for details.
<h3 class=fn>void <a name="setVerticalAlignment"></a>QTextEdit::setVerticalAlignment ( <a href="qtextedit.html#VerticalAlignment-enum">VerticalAlignment</a>&nbsp;a )<tt> [virtual slot]</tt>
</h3>
Sets the vertical alignment of the current format, i.e. of the
text, to <em>a</em>.
<p> <p>See also <a href="#color">color</a>() and <a href="#paper-prop">paper</a>.
<h3 class=fn>void <a name="setWordWrap"></a>QTextEdit::setWordWrap ( <a href="qtextedit.html#WordWrap-enum">WordWrap</a>&nbsp;mode )<tt> [virtual slot]</tt>
</h3><p>Sets the word wrap mode to <em>mode</em>.
See the <a href="qtextedit.html#wordWrap-prop">"wordWrap"</a> property for details.
<h3 class=fn>void <a name="setWrapColumnOrWidth"></a>QTextEdit::setWrapColumnOrWidth ( int )<tt> [virtual slot]</tt>
</h3><p>Sets the position (in pixels or columns depending on the wrap mode) where text will be wrapped.
See the <a href="qtextedit.html#wrapColumnOrWidth-prop">"wrapColumnOrWidth"</a> property for details.
<h3 class=fn>void <a name="setWrapPolicy"></a>QTextEdit::setWrapPolicy ( <a href="qtextedit.html#WrapPolicy-enum">WrapPolicy</a>&nbsp;policy )<tt> [virtual slot]</tt>
</h3><p>Sets the word wrap policy, at whitespace or anywhere to <em>policy</em>.
See the <a href="qtextedit.html#wrapPolicy-prop">"wrapPolicy"</a> property for details.
<h3 class=fn><a href="qstylesheet.html">QStyleSheet</a>&nbsp;* <a name="styleSheet"></a>QTextEdit::styleSheet () const
</h3>
Returns the <a href="qstylesheet.html">QStyleSheet</a> which is being used by this text edit.
<p> <p>See also <a href="#setStyleSheet">setStyleSheet</a>().
<p>Examples: <a href="qaction-application-example.html#x1169">action/application.cpp</a>, <a href="simple-application-example.html#x1587">application/application.cpp</a>, <a href="helpviewer-example.html#x1031">helpviewer/helpwindow.cpp</a>, and <a href="mdi-example.html#x2072">mdi/application.cpp</a>.
<h3 class=fn>void <a name="sync"></a>QTextEdit::sync ()<tt> [virtual slot]</tt>
</h3>
QTextEdit is optimized for large amounts text. One of its
optimizations is to format only the visible text, formatting the rest
on demand, e.g. as the user scrolls, so you don't usually need to
call this function.
<p> In some situations you may want to force the whole text
to be formatted. For example, if after calling <a href="#setText">setText</a>(), you wanted
to know the height of the document (using <a href="qscrollview.html#contentsHeight">contentsHeight</a>()), you
would call this function first.
<h3 class=fn><a href="qsyntaxhighlighter.html">QSyntaxHighlighter</a>&nbsp;* <a name="syntaxHighlighter"></a>QTextEdit::syntaxHighlighter () const
</h3>
Returns the <a href="qsyntaxhighlighter.html">QSyntaxHighlighter</a> set on this QTextEdit. 0 is
returned if no syntax highlighter is set.
<h3 class=fn>bool <a name="tabChangesFocus"></a>QTextEdit::tabChangesFocus () const
</h3><p>Returns TRUE if TAB changes focus or is accepted as input; otherwise returns FALSE.
See the <a href="qtextedit.html#tabChangesFocus-prop">"tabChangesFocus"</a> property for details.
<h3 class=fn>int <a name="tabStopWidth"></a>QTextEdit::tabStopWidth () const
</h3><p>Returns the tab stop width in pixels.
See the <a href="qtextedit.html#tabStopWidth-prop">"tabStopWidth"</a> property for details.
<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QTextEdit::text () const
</h3><p>Returns the text edit's text.
See the <a href="qtextedit.html#text-prop">"text"</a> property for details.
<h3 class=fn><a href="qstring.html">QString</a> <a name="text-2"></a>QTextEdit::text ( int&nbsp;para ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the text of paragraph <em>para</em>.
<p> If <a href="#textFormat">textFormat</a>() is <a href="qt.html#TextFormat-enum">RichText</a> the text will contain HTML
formatting tags.
<h3 class=fn>void <a name="textChanged"></a>QTextEdit::textChanged ()<tt> [signal]</tt>
</h3>
<p> This signal is emitted whenever the text in the text edit changes.
<p> <p>See also <a href="#text-prop">text</a> and <a href="#append">append</a>().
<p>Examples: <a href="qwerty-example.html#x400">qwerty/qwerty.cpp</a> and <a href="rot-example.html#x1375">rot13/rot13.cpp</a>.
<h3 class=fn>QTextCursor * <a name="textCursor"></a>QTextEdit::textCursor () const<tt> [protected]</tt>
</h3>
<p> Returns the text edit's text cursor.
<p> <b>Warning:</b> QTextCursor is not in the public API, but in special
circumstances you might wish to use it.
<h3 class=fn><a href="qt.html#TextFormat-enum">TextFormat</a> <a name="textFormat"></a>QTextEdit::textFormat () const
</h3><p>Returns the text format: rich text, plain text, log text or auto text.
See the <a href="qtextedit.html#textFormat-prop">"textFormat"</a> property for details.
<h3 class=fn>bool <a name="underline"></a>QTextEdit::underline () const
</h3>
Returns TRUE if the current format is underlined; otherwise returns
FALSE.
<p> <p>See also <a href="#setUnderline">setUnderline</a>().
<h3 class=fn>void <a name="undo"></a>QTextEdit::undo ()<tt> [virtual slot]</tt>
</h3>
Undoes the last operation.
<p> If there is no operation to undo, i.e. there is no undo step in
the undo/redo history, nothing happens.
<p> <p>See also <a href="#undoAvailable">undoAvailable</a>(), <a href="#redo">redo</a>(), and <a href="#undoDepth-prop">undoDepth</a>.
<h3 class=fn>void <a name="undoAvailable"></a>QTextEdit::undoAvailable ( bool&nbsp;yes )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the availability of undo changes. If
<em>yes</em> is TRUE, then <a href="#undo">undo</a>() will work until <a href="#undoAvailable">undoAvailable</a>( FALSE )
is next emitted.
<p> <p>See also <a href="#undo">undo</a>() and <a href="#undoDepth-prop">undoDepth</a>.
<h3 class=fn>int <a name="undoDepth"></a>QTextEdit::undoDepth () const
</h3><p>Returns the depth of the undo history.
See the <a href="qtextedit.html#undoDepth-prop">"undoDepth"</a> property for details.
<h3 class=fn><a href="qtextedit.html#WordWrap-enum">WordWrap</a> <a name="wordWrap"></a>QTextEdit::wordWrap () const
</h3><p>Returns the word wrap mode.
See the <a href="qtextedit.html#wordWrap-prop">"wordWrap"</a> property for details.
<h3 class=fn>int <a name="wrapColumnOrWidth"></a>QTextEdit::wrapColumnOrWidth () const
</h3><p>Returns the position (in pixels or columns depending on the wrap mode) where text will be wrapped.
See the <a href="qtextedit.html#wrapColumnOrWidth-prop">"wrapColumnOrWidth"</a> property for details.
<h3 class=fn><a href="qtextedit.html#WrapPolicy-enum">WrapPolicy</a> <a name="wrapPolicy"></a>QTextEdit::wrapPolicy () const
</h3><p>Returns the word wrap policy, at whitespace or anywhere.
See the <a href="qtextedit.html#wrapPolicy-prop">"wrapPolicy"</a> property for details.
<h3 class=fn>void <a name="zoomIn"></a>QTextEdit::zoomIn ( int&nbsp;range )<tt> [virtual slot]</tt>
</h3>
Zooms in on the text by making the base font size <em>range</em>
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="#zoomOut">zoomOut</a>().
<h3 class=fn>void <a name="zoomIn-2"></a>QTextEdit::zoomIn ()<tt> [virtual slot]</tt>
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Zooms in on the text by making the base font size one point
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="#zoomOut">zoomOut</a>().
<h3 class=fn>void <a name="zoomOut"></a>QTextEdit::zoomOut ( int&nbsp;range )<tt> [virtual slot]</tt>
</h3>
Zooms out on the text by making the base font size <em>range</em> 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="#zoomIn">zoomIn</a>().
<h3 class=fn>void <a name="zoomOut-2"></a>QTextEdit::zoomOut ()<tt> [virtual slot]</tt>
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Zooms out on the text by making the base font size one point
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="#zoomIn">zoomIn</a>().
<h3 class=fn>void <a name="zoomTo"></a>QTextEdit::zoomTo ( int&nbsp;size )<tt> [virtual slot]</tt>
</h3>
Zooms the text by making the base font size <em>size</em> points and
recalculating all font sizes to be the new size. This does not
change the size of any images.
<hr><h2>Property Documentation</h2>
<h3 class=fn><a href="qtextedit.html#AutoFormatting-enum">AutoFormatting</a> <a name="autoFormatting-prop"></a>autoFormatting</h3>
<p>This property holds the enabled set of auto formatting features.
<p>The value can be any combination of the values in the <a href="#AutoFormatting-enum">AutoFormatting</a> enum. The default is <a href="#AutoFormatting-enum">AutoAll</a>. Choose <a href="#AutoFormatting-enum">AutoNone</a>
to disable all automatic formatting.
<p> Currently, the only automatic formatting feature provided is <a href="#AutoFormatting-enum">AutoBulletList</a>; future versions of Qt may offer more.
<p>Set this property's value with <a href="#setAutoFormatting">setAutoFormatting</a>() and get this property's value with <a href="#autoFormatting">autoFormatting</a>().
<h3 class=fn><a href="qstring.html">QString</a> <a name="documentTitle-prop"></a>documentTitle</h3>
<p>This property holds the title of the document parsed from the text.
<p>For <a href="qt.html#TextFormat-enum">PlainText</a> the title will be an empty string. For <a href="qt.html#TextFormat-enum">RichText</a> the title will be the text between the <tt>&lt;title&gt;</tt> tags,
if present, otherwise an empty string.
<p>Get this property's value with <a href="#documentTitle">documentTitle</a>().
<h3 class=fn>bool <a name="hasSelectedText-prop"></a>hasSelectedText</h3>
<p>This property holds whether some text is selected in selection 0.
<p>
<p>Get this property's value with <a href="#hasSelectedText">hasSelectedText</a>().
<h3 class=fn>int <a name="length-prop"></a>length</h3>
<p>This property holds the number of characters in the text.
<p>
<p>Get this property's value with <a href="#length">length</a>().
<h3 class=fn>bool <a name="linkUnderline-prop"></a>linkUnderline</h3>
<p>This property holds whether hypertext links will be underlined.
<p>If TRUE (the default) hypertext links will be displayed
underlined. If FALSE links will not be displayed underlined.
<p>Set this property's value with <a href="#setLinkUnderline">setLinkUnderline</a>() and get this property's value with <a href="#linkUnderline">linkUnderline</a>().
<h3 class=fn>bool <a name="modified-prop"></a>modified</h3>
<p>This property holds whether the document has been modified by the user.
<p>
<p>Set this property's value with <a href="#setModified">setModified</a>() and get this property's value with <a href="#isModified">isModified</a>().
<h3 class=fn>bool <a name="overwriteMode-prop"></a>overwriteMode</h3>
<p>This property holds the text edit's overwrite mode.
<p>If FALSE (the default) characters entered by the user are inserted
with any characters to the right being moved out of the way. If
TRUE, the editor is in overwrite mode, i.e. characters entered by
the user overwrite any characters to the right of the cursor
position.
<p>Set this property's value with <a href="#setOverwriteMode">setOverwriteMode</a>() and get this property's value with <a href="#isOverwriteMode">isOverwriteMode</a>().
<h3 class=fn><a href="qbrush.html">QBrush</a> <a name="paper-prop"></a>paper</h3>
<p>This property holds the background (paper) brush.
<p>The brush that is currently used to draw the background of the
text edit. The initial setting is an empty brush.
<p>Set this property's value with <a href="#setPaper">setPaper</a>() and get this property's value with <a href="#paper">paper</a>().
<h3 class=fn>bool <a name="readOnly-prop"></a>readOnly</h3>
<p>This property holds whether the text edit is read-only.
<p>In a read-only text edit the user can only navigate through the
text and select text; modifying the text is not possible.
<p> This property's default is FALSE.
<p>Set this property's value with <a href="#setReadOnly">setReadOnly</a>() and get this property's value with <a href="#isReadOnly">isReadOnly</a>().
<h3 class=fn><a href="qstring.html">QString</a> <a name="selectedText-prop"></a>selectedText</h3>
<p>This property holds the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0).
<p>The text is always returned as <a href="qt.html#TextFormat-enum">PlainText</a> if the <a href="#textFormat">textFormat</a>() is
<a href="qt.html#TextFormat-enum">PlainText</a> or <a href="qt.html#TextFormat-enum">AutoText</a>, otherwise it is returned as HTML.
<p> <p>See also <a href="#hasSelectedText-prop">hasSelectedText</a>.
<p>Get this property's value with <a href="#selectedText">selectedText</a>().
<h3 class=fn>bool <a name="tabChangesFocus-prop"></a>tabChangesFocus</h3> <p>This property holds whether TAB changes focus or is accepted as input.
<p>In some occasions text edits should not allow the user to input
tabulators or change indentation using the TAB key, as this breaks
the focus chain. The default is FALSE.
<p>
<p>Set this property's value with <a href="#setTabChangesFocus">setTabChangesFocus</a>() and get this property's value with <a href="#tabChangesFocus">tabChangesFocus</a>().
<h3 class=fn>int <a name="tabStopWidth-prop"></a>tabStopWidth</h3>
<p>This property holds the tab stop width in pixels.
<p>
<p>Set this property's value with <a href="#setTabStopWidth">setTabStopWidth</a>() and get this property's value with <a href="#tabStopWidth">tabStopWidth</a>().
<h3 class=fn><a href="qstring.html">QString</a> <a name="text-prop"></a>text</h3>
<p>This property holds the text edit's text.
<p>There is no default text.
<p> On setting, any previous text is deleted.
<p> The text may be interpreted either as plain text or as rich text,
depending on the <a href="#textFormat">textFormat</a>(). The default setting is <a href="qt.html#TextFormat-enum">AutoText</a>,
i.e. the text edit auto-detects the format of the text.
<p> For richtext, calling <a href="#text">text</a>() on an editable QTextEdit will cause
the text to be regenerated from the textedit. This may mean that
the <a href="qstring.html">QString</a> returned may not be exactly the same as the one that
was set.
<p> <p>See also <a href="#textFormat-prop">textFormat</a>.
<p>Set this property's value with <a href="#setText">setText</a>() and get this property's value with <a href="#text">text</a>().
<h3 class=fn><a href="qt.html#TextFormat-enum">TextFormat</a> <a name="textFormat-prop"></a>textFormat</h3>
<p>This property holds the text format: rich text, plain text, log text or auto text.
<p>The text format is one of the following:
<ul>
<li> PlainText - all characters, except newlines, are displayed
verbatim, including spaces. Whenever a newline appears in the text
the text edit inserts a hard line break and begins a new
paragraph.
<li> RichText - rich text rendering. The available styles are
defined in the default stylesheet <a href="qstylesheet.html#defaultSheet">QStyleSheet::defaultSheet</a>().
<li> LogText - optimized mode for very large texts. Supports a very
limited set of formatting tags (color, bold, underline and italic
settings).
<li> AutoText - this is the default. The text edit autodetects which
rendering style is best, <a href="qt.html#TextFormat-enum">PlainText</a> or <a href="qt.html#TextFormat-enum">RichText</a>. This is done
by using the <a href="qstylesheet.html#mightBeRichText">QStyleSheet::mightBeRichText</a>() function.
</ul>
<p>Set this property's value with <a href="#setTextFormat">setTextFormat</a>() and get this property's value with <a href="#textFormat">textFormat</a>().
<h3 class=fn>int <a name="undoDepth-prop"></a>undoDepth</h3>
<p>This property holds the depth of the undo history.
<p>The maximum number of steps in the undo/redo history. The default
is 100.
<p> <p>See also <a href="#undo">undo</a>() and <a href="#redo">redo</a>().
<p>Set this property's value with <a href="#setUndoDepth">setUndoDepth</a>() and get this property's value with <a href="#undoDepth">undoDepth</a>().
<h3 class=fn>bool <a name="undoRedoEnabled-prop"></a>undoRedoEnabled</h3>
<p>This property holds whether undo/redo is enabled.
<p>When changing this property, the undo/redo history is cleared.
<p> The default is TRUE.
<p>Set this property's value with <a href="#setUndoRedoEnabled">setUndoRedoEnabled</a>() and get this property's value with <a href="#isUndoRedoEnabled">isUndoRedoEnabled</a>().
<h3 class=fn><a href="qtextedit.html#WordWrap-enum">WordWrap</a> <a name="wordWrap-prop"></a>wordWrap</h3>
<p>This property holds the word wrap mode.
<p>The default mode is <a href="#WordWrap-enum">WidgetWidth</a> which causes words to be
wrapped at the right edge of the text edit. Wrapping occurs at
whitespace, keeping whole words intact. If you want wrapping to
occur within words use <a href="#setWrapPolicy">setWrapPolicy</a>(). If you set a wrap mode of
<a href="#WordWrap-enum">FixedPixelWidth</a> or <a href="#WordWrap-enum">FixedColumnWidth</a> you should also call
<a href="#setWrapColumnOrWidth">setWrapColumnOrWidth</a>() with the width you want.
<p> <p>See also <a href="#WordWrap-enum">WordWrap</a>, <a href="#wrapColumnOrWidth-prop">wrapColumnOrWidth</a>, and <a href="#wrapPolicy-prop">wrapPolicy</a>.
<p>Set this property's value with <a href="#setWordWrap">setWordWrap</a>() and get this property's value with <a href="#wordWrap">wordWrap</a>().
<h3 class=fn>int <a name="wrapColumnOrWidth-prop"></a>wrapColumnOrWidth</h3>
<p>This property holds the position (in pixels or columns depending on the wrap mode) where text will be wrapped.
<p>If the wrap mode is <a href="#WordWrap-enum">FixedPixelWidth</a>, the value is the number of
pixels from the left edge of the text edit at which text should be
wrapped. If the wrap mode is <a href="#WordWrap-enum">FixedColumnWidth</a>, the value is the
column number (in character columns) from the left edge of the
text edit at which text should be wrapped.
<p> <p>See also <a href="#wordWrap-prop">wordWrap</a>.
<p>Set this property's value with <a href="#setWrapColumnOrWidth">setWrapColumnOrWidth</a>() and get this property's value with <a href="#wrapColumnOrWidth">wrapColumnOrWidth</a>().
<h3 class=fn><a href="qtextedit.html#WrapPolicy-enum">WrapPolicy</a> <a name="wrapPolicy-prop"></a>wrapPolicy</h3>
<p>This property holds the word wrap policy, at whitespace or anywhere.
<p>Defines where text can be wrapped when word wrap mode is not <a href="#WordWrap-enum">NoWrap</a>. The choices are <a href="#WrapPolicy-enum">AtWordBoundary</a> (the default), <a href="#WrapPolicy-enum">Anywhere</a> and <a href="#WrapPolicy-enum">AtWordOrDocumentBoundary</a>
<p> <p>See also <a href="#wordWrap-prop">wordWrap</a>.
<p>Set this property's value with <a href="#setWrapPolicy">setWrapPolicy</a>() and get this property's value with <a href="#wrapPolicy">wrapPolicy</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>