<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/widgets/qtextedit.cpp:92 --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>QTextEdit Class</title> <style type="text/css"><!-- h3.fn,span.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 Classes</font></a> | <a href="mainclasses.html"> <font color="#004faf">Main Classes</font></a> | <a href="annotated.html"> <font color="#004faf">Annotated</font></a> | <a href="groups.html"> <font color="#004faf">Grouped 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 sophisticated single-page rich text editor. <a href="#details">More...</a> <p><tt>#include <<a href="qtextedit-h.html">qtextedit.h</a>></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><div class=fn>enum <a href="#WordWrap-enum"><b>WordWrap</b></a> { NoWrap, WidgetWidth, FixedPixelWidth, FixedColumnWidth }</div></li> <li><div class=fn>enum <a href="#WrapPolicy-enum"><b>WrapPolicy</b></a> { AtWordBoundary, Anywhere, AtWhiteSpace = AtWordBoundary }</div></li> <li><div class=fn>enum <a href="#KeyboardAction-enum"><b>KeyboardAction</b></a> { ActionBackspace, ActionDelete, ActionReturn, ActionKill }</div></li> <li><div class=fn>enum <a href="#CursorAction-enum"><b>CursorAction</b></a> { MoveBackward, MoveForward, MoveWordBackward, MoveWordForward, MoveUp, MoveDown, MoveLineStart, MoveLineEnd, MoveHome, MoveEnd, MovePgUp, MovePgDown }</div></li> <li><div class=fn>enum <a href="#VerticalAlignment-enum"><b>VerticalAlignment</b></a> { AlignNormal, AlignSuperScript, AlignSubScript }</div></li> <li><div class=fn><a href="#QTextEdit"><b>QTextEdit</b></a> ( const QString & text, const QString & context = QString::null, QWidget * parent = 0, const char * name = 0 )</div></li> <li><div class=fn><a href="#QTextEdit-2"><b>QTextEdit</b></a> ( QWidget * parent = 0, const char * name = 0 )</div></li> <li><div class=fn>QString <a href="#text"><b>text</b></a> () const</div></li> <li><div class=fn>QString <a href="#text-2"><b>text</b></a> ( int para ) const</div></li> <li><div class=fn>TextFormat <a href="#textFormat"><b>textFormat</b></a> () const</div></li> <li><div class=fn>QString <a href="#context"><b>context</b></a> () const</div></li> <li><div class=fn>QString <a href="#documentTitle"><b>documentTitle</b></a> () const</div></li> <li><div class=fn>void <a href="#getSelection"><b>getSelection</b></a> ( int * paraFrom, int * indexFrom, int * paraTo, int * indexTo, int selNum = 0 ) const</div></li> <li><div class=fn>virtual bool <a href="#find"><b>find</b></a> ( const QString & expr, bool cs, bool wo, bool forward = TRUE, int * para = 0, int * index = 0 )</div></li> <li><div class=fn>int <a href="#paragraphs"><b>paragraphs</b></a> () const</div></li> <li><div class=fn>int <a href="#lines"><b>lines</b></a> () const</div></li> <li><div class=fn>int <a href="#linesOfParagraph"><b>linesOfParagraph</b></a> ( int para ) const</div></li> <li><div class=fn>int <a href="#lineOfChar"><b>lineOfChar</b></a> ( int para, int index )</div></li> <li><div class=fn>int <a href="#length"><b>length</b></a> () const</div></li> <li><div class=fn>QRect <a href="#paragraphRect"><b>paragraphRect</b></a> ( int para ) const</div></li> <li><div class=fn>int <a href="#paragraphAt"><b>paragraphAt</b></a> ( const QPoint & pos ) const</div></li> <li><div class=fn>int <a href="#charAt"><b>charAt</b></a> ( const QPoint & pos, int * para ) const</div></li> <li><div class=fn>int <a href="#paragraphLength"><b>paragraphLength</b></a> ( int para ) const</div></li> <li><div class=fn>QStyleSheet * <a href="#styleSheet"><b>styleSheet</b></a> () const</div></li> <li><div class=fn>QMimeSourceFactory * <a href="#mimeSourceFactory"><b>mimeSourceFactory</b></a> () const</div></li> <li><div class=fn>QBrush <a href="#paper"><b>paper</b></a> () const</div></li> <li><div class=fn>bool <a href="#linkUnderline"><b>linkUnderline</b></a> () const</div></li> <li><div class=fn>virtual int <a href="#heightForWidth"><b>heightForWidth</b></a> ( int w ) const</div></li> <li><div class=fn>bool <a href="#hasSelectedText"><b>hasSelectedText</b></a> () const</div></li> <li><div class=fn>QString <a href="#selectedText"><b>selectedText</b></a> () const</div></li> <li><div class=fn>bool <a href="#isUndoAvailable"><b>isUndoAvailable</b></a> () const</div></li> <li><div class=fn>bool <a href="#isRedoAvailable"><b>isRedoAvailable</b></a> () const</div></li> <li><div class=fn>WordWrap <a href="#wordWrap"><b>wordWrap</b></a> () const</div></li> <li><div class=fn>int <a href="#wrapColumnOrWidth"><b>wrapColumnOrWidth</b></a> () const</div></li> <li><div class=fn>WrapPolicy <a href="#wrapPolicy"><b>wrapPolicy</b></a> () const</div></li> <li><div class=fn>int <a href="#tabStopWidth"><b>tabStopWidth</b></a> () const</div></li> <li><div class=fn>QString <a href="#anchorAt"><b>anchorAt</b></a> ( const QPoint & pos )</div></li> <li><div class=fn>bool <a href="#isReadOnly"><b>isReadOnly</b></a> () const</div></li> <li><div class=fn>void <a href="#getCursorPosition"><b>getCursorPosition</b></a> ( int * para, int * index ) const</div></li> <li><div class=fn>bool <a href="#isModified"><b>isModified</b></a> () const</div></li> <li><div class=fn>bool <a href="#italic"><b>italic</b></a> () const</div></li> <li><div class=fn>bool <a href="#bold"><b>bold</b></a> () const</div></li> <li><div class=fn>bool <a href="#underline"><b>underline</b></a> () const</div></li> <li><div class=fn>QString <a href="#family"><b>family</b></a> () const</div></li> <li><div class=fn>int <a href="#pointSize"><b>pointSize</b></a> () const</div></li> <li><div class=fn>QColor <a href="#color"><b>color</b></a> () const</div></li> <li><div class=fn>QFont <a href="#font"><b>font</b></a> () const</div></li> <li><div class=fn>int <a href="#alignment"><b>alignment</b></a> () const</div></li> <li><div class=fn>int <a href="#undoDepth"><b>undoDepth</b></a> () const</div></li> <li><div class=fn>virtual bool <a href="#getFormat"><b>getFormat</b></a> ( int para, int index, QFont * font, QColor * color, VerticalAlignment * verticalAlignment )</div></li> <li><div class=fn>virtual bool <a href="#getParagraphFormat"><b>getParagraphFormat</b></a> ( int para, QFont * font, QColor * color, VerticalAlignment * verticalAlignment, int * alignment, QStyleSheetItem::DisplayMode * displayMode, QStyleSheetItem::ListStyle * listStyle, int * listDepth )</div></li> <li><div class=fn>bool <a href="#isOverwriteMode"><b>isOverwriteMode</b></a> () const</div></li> <li><div class=fn>QColor <a href="#paragraphBackgroundColor"><b>paragraphBackgroundColor</b></a> ( int para ) const</div></li> <li><div class=fn>bool <a href="#isUndoRedoEnabled"><b>isUndoRedoEnabled</b></a> () const</div></li> </ul> <h2>Public Slots</h2> <ul> <li><div class=fn>virtual void <a href="#setMimeSourceFactory"><b>setMimeSourceFactory</b></a> ( QMimeSourceFactory * factory )</div></li> <li><div class=fn>virtual void <a href="#setStyleSheet"><b>setStyleSheet</b></a> ( QStyleSheet * styleSheet )</div></li> <li><div class=fn>virtual void <a href="#scrollToAnchor"><b>scrollToAnchor</b></a> ( const QString & name )</div></li> <li><div class=fn>virtual void <a href="#setPaper"><b>setPaper</b></a> ( const QBrush & pap )</div></li> <li><div class=fn>virtual void <a href="#setLinkUnderline"><b>setLinkUnderline</b></a> ( bool )</div></li> <li><div class=fn>virtual void <a href="#setWordWrap"><b>setWordWrap</b></a> ( WordWrap mode )</div></li> <li><div class=fn>virtual void <a href="#setWrapColumnOrWidth"><b>setWrapColumnOrWidth</b></a> ( int )</div></li> <li><div class=fn>virtual void <a href="#setWrapPolicy"><b>setWrapPolicy</b></a> ( WrapPolicy policy )</div></li> <li><div class=fn>virtual void <a href="#copy"><b>copy</b></a> ()</div></li> <li><div class=fn>virtual void <a href="#append"><b>append</b></a> ( const QString & text )</div></li> <li><div class=fn>void <a href="#setText"><b>setText</b></a> ( const QString & txt )</div></li> <li><div class=fn>virtual void <a href="#setText-2"><b>setText</b></a> ( const QString & text, const QString & context )</div></li> <li><div class=fn>virtual void <a href="#setTextFormat"><b>setTextFormat</b></a> ( TextFormat f )</div></li> <li><div class=fn>virtual void <a href="#selectAll"><b>selectAll</b></a> ( bool select = TRUE )</div></li> <li><div class=fn>virtual void <a href="#setTabStopWidth"><b>setTabStopWidth</b></a> ( int ts )</div></li> <li><div class=fn>virtual void <a href="#zoomIn"><b>zoomIn</b></a> ( int range )</div></li> <li><div class=fn>virtual void <a href="#zoomIn-2"><b>zoomIn</b></a> ()</div></li> <li><div class=fn>virtual void <a href="#zoomOut"><b>zoomOut</b></a> ( int range )</div></li> <li><div class=fn>virtual void <a href="#zoomOut-2"><b>zoomOut</b></a> ()</div></li> <li><div class=fn>virtual void <a href="#zoomTo"><b>zoomTo</b></a> ( int size )</div></li> <li><div class=fn>virtual void <a href="#setReadOnly"><b>setReadOnly</b></a> ( bool b )</div></li> <li><div class=fn>virtual void <a href="#undo"><b>undo</b></a> ()</div></li> <li><div class=fn>virtual void <a href="#redo"><b>redo</b></a> ()</div></li> <li><div class=fn>virtual void <a href="#cut"><b>cut</b></a> ()</div></li> <li><div class=fn>virtual void <a href="#paste"><b>paste</b></a> ()</div></li> <li><div class=fn>virtual void <a href="#pasteSubType"><b>pasteSubType</b></a> ( const QCString & subtype )</div></li> <li><div class=fn>virtual void <a href="#clear"><b>clear</b></a> ()</div></li> <li><div class=fn>virtual void <a href="#del"><b>del</b></a> ()</div></li> <li><div class=fn>virtual void <a href="#indent"><b>indent</b></a> ()</div></li> <li><div class=fn>virtual void <a href="#setItalic"><b>setItalic</b></a> ( bool b )</div></li> <li><div class=fn>virtual void <a href="#setBold"><b>setBold</b></a> ( bool b )</div></li> <li><div class=fn>virtual void <a href="#setUnderline"><b>setUnderline</b></a> ( bool b )</div></li> <li><div class=fn>virtual void <a href="#setFamily"><b>setFamily</b></a> ( const QString & fontFamily )</div></li> <li><div class=fn>virtual void <a href="#setPointSize"><b>setPointSize</b></a> ( int s )</div></li> <li><div class=fn>virtual void <a href="#setColor"><b>setColor</b></a> ( const QColor & c )</div></li> <li><div class=fn>virtual void <a href="#setVerticalAlignment"><b>setVerticalAlignment</b></a> ( VerticalAlignment a )</div></li> <li><div class=fn>virtual void <a href="#setAlignment"><b>setAlignment</b></a> ( int a )</div></li> <li><div class=fn>virtual void <a href="#setParagType"><b>setParagType</b></a> ( QStyleSheetItem::DisplayMode dm, QStyleSheetItem::ListStyle listStyle )</div></li> <li><div class=fn>virtual void <a href="#setCursorPosition"><b>setCursorPosition</b></a> ( int para, int index )</div></li> <li><div class=fn>virtual void <a href="#setSelection"><b>setSelection</b></a> ( int paraFrom, int indexFrom, int paraTo, int indexTo, int selNum = 0 )</div></li> <li><div class=fn>virtual void <a href="#setSelectionAttributes"><b>setSelectionAttributes</b></a> ( int selNum, const QColor & back, bool invertText )</div></li> <li><div class=fn>virtual void <a href="#setModified"><b>setModified</b></a> ( bool m )</div></li> <li><div class=fn>virtual void <a href="#setUndoDepth"><b>setUndoDepth</b></a> ( int d )</div></li> <li><div class=fn>virtual void <a href="#ensureCursorVisible"><b>ensureCursorVisible</b></a> ()</div></li> <li><div class=fn>virtual void <a href="#placeCursor"><b>placeCursor</b></a> ( const QPoint & pos, QTextCursor * c = 0 )</div></li> <li><div class=fn>virtual void <a href="#moveCursor"><b>moveCursor</b></a> ( CursorAction action, bool select )</div></li> <li><div class=fn>virtual void <a href="#doKeyboardAction"><b>doKeyboardAction</b></a> ( KeyboardAction action )</div></li> <li><div class=fn>virtual void <a href="#removeSelectedText"><b>removeSelectedText</b></a> ( int selNum = 0 )</div></li> <li><div class=fn>virtual void <a href="#removeSelection"><b>removeSelection</b></a> ( int selNum = 0 )</div></li> <li><div class=fn>virtual void <a href="#setCurrentFont"><b>setCurrentFont</b></a> ( const QFont & f )</div></li> <li><div class=fn>virtual void <a href="#setOverwriteMode"><b>setOverwriteMode</b></a> ( bool b )</div></li> <li><div class=fn>virtual void <a href="#scrollToBottom"><b>scrollToBottom</b></a> ()</div></li> <li><div class=fn>virtual void <a href="#insert"><b>insert</b></a> ( const QString & text, bool indent = FALSE, bool checkNewLine = TRUE, bool removeSelected = TRUE )</div></li> <li><div class=fn>virtual void <a href="#insertAt"><b>insertAt</b></a> ( const QString & text, int para, int index )</div></li> <li><div class=fn>virtual void <a href="#removeParagraph"><b>removeParagraph</b></a> ( int para )</div></li> <li><div class=fn>virtual void <a href="#insertParagraph"><b>insertParagraph</b></a> ( const QString & text, int para )</div></li> <li><div class=fn>virtual void <a href="#setParagraphBackgroundColor"><b>setParagraphBackgroundColor</b></a> ( int para, const QColor & bg )</div></li> <li><div class=fn>virtual void <a href="#clearParagraphBackground"><b>clearParagraphBackground</b></a> ( int para )</div></li> <li><div class=fn>virtual void <a href="#setUndoRedoEnabled"><b>setUndoRedoEnabled</b></a> ( bool b )</div></li> </ul> <h2>Signals</h2> <ul> <li><div class=fn>void <a href="#textChanged"><b>textChanged</b></a> ()</div></li> <li><div class=fn>void <a href="#selectionChanged"><b>selectionChanged</b></a> ()</div></li> <li><div class=fn>void <a href="#copyAvailable"><b>copyAvailable</b></a> ( bool yes )</div></li> <li><div class=fn>void <a href="#undoAvailable"><b>undoAvailable</b></a> ( bool yes )</div></li> <li><div class=fn>void <a href="#redoAvailable"><b>redoAvailable</b></a> ( bool yes )</div></li> <li><div class=fn>void <a href="#currentFontChanged"><b>currentFontChanged</b></a> ( const QFont & f )</div></li> <li><div class=fn>void <a href="#currentColorChanged"><b>currentColorChanged</b></a> ( const QColor & c )</div></li> <li><div class=fn>void <a href="#currentAlignmentChanged"><b>currentAlignmentChanged</b></a> ( int a )</div></li> <li><div class=fn>void <a href="#currentVerticalAlignmentChanged"><b>currentVerticalAlignmentChanged</b></a> ( VerticalAlignment a )</div></li> <li><div class=fn>void <a href="#cursorPositionChanged"><b>cursorPositionChanged</b></a> ( QTextCursor * c )</div></li> <li><div class=fn>void <a href="#cursorPositionChanged-2"><b>cursorPositionChanged</b></a> ( int para, int pos )</div></li> <li><div class=fn>void <a href="#returnPressed"><b>returnPressed</b></a> ()</div></li> <li><div class=fn>void <a href="#modificationChanged"><b>modificationChanged</b></a> ( bool m )</div></li> </ul> <h2>Properties</h2> <ul> <li><div class=fn>QString <a href="#documentTitle-prop"><b>documentTitle</b></a> - the title of the document parsed from the text <em>(read only)</em></div></li> <li><div class=fn>bool <a href="#hasSelectedText-prop"><b>hasSelectedText</b></a> - whether some text is selected in selection 0 <em>(read only)</em></div></li> <li><div class=fn>int <a href="#length-prop"><b>length</b></a> - the number of characters in the text <em>(read only)</em></div></li> <li><div class=fn>bool <a href="#linkUnderline-prop"><b>linkUnderline</b></a> - whether hypertext links will be underlined</div></li> <li><div class=fn>bool <a href="#modified-prop"><b>modified</b></a> - whether the document has been modified by the user</div></li> <li><div class=fn>bool <a href="#overwriteMode-prop"><b>overwriteMode</b></a> - the text edit's overwrite mode</div></li> <li><div class=fn>QBrush <a href="#paper-prop"><b>paper</b></a> - the background (paper) brush</div></li> <li><div class=fn>bool <a href="#readOnly-prop"><b>readOnly</b></a> - whether the text edit is read-only</div></li> <li><div class=fn>QString <a href="#selectedText-prop"><b>selectedText</b></a> - the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0) <em>(read only)</em></div></li> <li><div class=fn>int <a href="#tabStopWidth-prop"><b>tabStopWidth</b></a> - the tab stop width in pixels</div></li> <li><div class=fn>QString <a href="#text-prop"><b>text</b></a> - the text edit's text</div></li> <li><div class=fn>TextFormat <a href="#textFormat-prop"><b>textFormat</b></a> - the text format: rich text, plain text or auto text</div></li> <li><div class=fn>int <a href="#undoDepth-prop"><b>undoDepth</b></a> - the depth of the undo history</div></li> <li><div class=fn>bool <a href="#undoRedoEnabled-prop"><b>undoRedoEnabled</b></a> - whether undo/redo is enabled</div></li> <li><div class=fn>WordWrap <a href="#wordWrap-prop"><b>wordWrap</b></a> - the word wrap mode</div></li> <li><div class=fn>int <a href="#wrapColumnOrWidth-prop"><b>wrapColumnOrWidth</b></a> - the position (in pixels or columns depending on the wrap mode) where text will be wrapped</div></li> <li><div class=fn>WrapPolicy <a href="#wrapPolicy-prop"><b>wrapPolicy</b></a> - the word wrap policy, at whitespace or anywhere</div></li> </ul> <h2>Protected Members</h2> <ul> <li><div class=fn>void <a href="#repaintChanged"><b>repaintChanged</b></a> ()</div></li> <li><div class=fn>void <a href="#updateStyles"><b>updateStyles</b></a> ()</div></li> <li><div class=fn>virtual void <a href="#keyPressEvent"><b>keyPressEvent</b></a> ( QKeyEvent * e )</div></li> <li><div class=fn>virtual bool <a href="#focusNextPrevChild"><b>focusNextPrevChild</b></a> ( bool n )</div></li> <li><div class=fn>QTextCursor * <a href="#textCursor"><b>textCursor</b></a> () const</div></li> <li><div class=fn>virtual QPopupMenu * <a href="#createPopupMenu"><b>createPopupMenu</b></a> ( const QPoint & pos )</div></li> <li><div class=fn>virtual QPopupMenu * <a href="#createPopupMenu-2"><b>createPopupMenu</b></a> ()</div></li> </ul> <hr><a name="details"></a><h2>Detailed Description</h2> The QTextEdit widget provides a sophisticated single-page rich text editor. <p> <p> QTextEdit is an advanced WYSIWYG editor supporting rich text formatting. It is optimized to handle large documents and to respond quickly to user input. <p> Internally QTextEdit works on paragraphs and characters. A paragraph is a formatted string which is word-wrapped to fit into the width of the widget. 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> 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>(). 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> The text edit documentation uses the following concepts: <ul> <li> <i>current format</i> -- this is the format at the current cursor position, <em>and</em> it is the format of the selected text if any. <li> <i>current paragraph</i> -- the paragraph which contains the cursor. </ul> <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. Text can be inserted with <a href="#insert">insert</a>(), <a href="#paste">paste</a>() and <a href="#pasteSubType">pasteSubType</a>(). 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> 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 style is set with <a href="#setParagType">setParagType</a>() and its 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. <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 <a href="#indent">indent</a>() function is used to reindent a paragraph. It is useful for code editors, for example in <em>Qt Designer</em>'s code editor <em>Ctrl+I</em> invokes the indent() function. <p> Loading and saving text is achieved using <a href="#setText">setText</a>() and <a href="#text">text</a>(), 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> ts( &file ); textEdit->setText( ts.<a href="qtextstream.html#read">read</a>() ); } </pre> <pre> <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> ts( &file ); ts << textEdit->text(); textEdit->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><a name="anchor"></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> The list of key-bindings which are implemented for editing: <ul> <li> <i> Backspace </i> -- Delete the character to the left of the cursor <li> <i> Delete </i> -- Delete the character to the right of the cursor <li> <i> Ctrl+A </i> -- Move the cursor to the beginning of the line <li> <i> Ctrl+B </i> -- Move the cursor one character left <li> <i> Ctrl+C </i> -- Copy the marked text to the clipboard (also <i>Ctrl+Insert</i> under Windows) <li> <i> Ctrl+D </i> -- Delete the character to the right of the cursor <li> <i> Ctrl+E </i> -- Move the cursor to the end of the line <li> <i> Ctrl+F </i> -- Move the cursor one character right <li> <i> Ctrl+H </i> -- Delete the character to the left of the cursor <li> <i> Ctrl+K </i> -- Delete to end of line <li> <i> Ctrl+N </i> -- Move the cursor one line down <li> <i> Ctrl+P </i> -- Move the cursor one line up <li> <i> Ctrl+V </i> -- Paste the clipboard text into line edit (also <i>Shift+Insert</i> under Windows) <li> <i> Ctrl+X </i> -- Cut the marked text, copy to clipboard (also <i>Shift+Delete</i> under Windows) <li> <i> Ctrl+Z </i> -- Undo the last operation <li> <i> Ctrl+Y </i> -- Redo the last operation <li> <i> Left Arrow </i> -- Move the cursor one character left <li> <i> Ctrl+Left Arrow </i> -- Move the cursor one word left <li> <i> Right Arrow </i> -- Move the cursor one character right <li> <i> Ctrl+Right Arrow </i> -- Move the cursor one word right <li> <i> Up Arrow </i> -- Move the cursor one line up <li> <i> Ctrl+Up Arrow </i> -- Move the cursor one word up <li> <i> Down Arrow </i> -- Move the cursor one line down <li> <i> Ctrl+Down Arrow </i> -- Move the cursor one word down <li> <i> Page Up </i> -- Move the cursor one page up <li> <i> Page Down </i> -- Move the cursor one page down <li> <i> Home </i> -- Move the cursor to the beginning of the line <li> <i> Ctrl+Home Arrow </i> -- Move the cursor to the beginning of the text <li> <i> End </i> -- Move the cursor to the end of the line <li> <i> Ctrl+End Arrow </i> -- Move the cursor to the end of the text <li> <i> Shift+Wheel</i> -- Scroll the page horizontally (the Wheel is the mouse wheel) <li> <i> Ctrl+Wheel</i> -- Zoom the text </ul> <p> To select (mark) text hold down the Shift key whilst pressing one of the movement keystrokes, for example, <i>Shift+Right Arrow</i> will select the character to the right, and <i>Shift+Ctrl+Right Arrow</i> will select the word to the right, etc. <p> 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> QTextEdit can also be used as read-only text viewer. Call <a href="#setReadOnly">setReadOnly</a>( TRUE ) to disable editing. A read-only QTextEdit provides the same functionality as the (obsolete) QTextView. (QTextView is still supplied for compatibility with old code.) <p> When QTextEdit is used read-only the key-bindings are limited to navigation, and text may only be selected with the mouse: <ul> <li> <i> Up Arrow </i> -- Move one line up <li> <i> Down Arrow </i> -- Move one line down <li> <i> Left Arrow </i> -- Move one character left <li> <i> Right Arrow </i> -- Move one character right <li> <i> Page Up </i> -- Move one (viewport) page up <li> <i> Page Down </i> -- Move one (viewport) page down <li> <i> Home </i> -- Move to the beginning of the text <li> <i> End </i> -- Move to the end of the text <li> <i> Shift+Wheel</i> -- Scroll the page horizontally (the Wheel is the mouse wheel) <li> <i> Ctrl+Wheel</i> -- Zoom the text </ul> <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><title></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> 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 <a href="helpsystem.html#online-help">online help</a> facilities to applications, and to provide a basis for rich text editors. <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="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 page up <li><tt>QTextEdit::MovePgDown</tt> - Moves the cursor one 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. </ul> <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. The following values are valid: <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. <p> The following values are valid: <ul> <li><tt>QTextEdit::AtWhiteSpace</tt> - Break lines at whitespace, e.g. spaces or newlines. <li><tt>QTextEdit::Anywhere</tt> - Break anywhere, including within words. <li><tt>QTextEdit::AtWordBoundary</tt> - Don't use this deprecated value (it is a synonym for AtWhiteSpace which you should use instead). </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 <a href="qstring.html">QString</a> & text, const <a href="qstring.html">QString</a> & context = QString::null, <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0 ) </h3> Constructs a QTextEdit with parent <em>parent</em> and name <em>name</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><img src="image.png"></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><img src="/image.png"></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><a href="target.html">Target</a></tt>, would resolve to "path/to/look/in/target.html". <p> <h3 class=fn><a name="QTextEdit-2"></a>QTextEdit::QTextEdit ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0 ) </h3> Constructs an empty QTextEdit with parent <em>parent</em> and name <em>name</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 <a href="qpoint.html">QPoint</a> & pos ) </h3> If there is an anchor at position <em>pos</em> (in contents coordinates), its name is returned, otherwise an empty string is returned. <h3 class=fn>void <a name="append"></a>QTextEdit::append ( const <a href="qstring.html">QString</a> & text )<tt> [virtual slot]</tt> </h3> Appends the text <em>text</em> to the end of the text edit. <p>Examples: <a href="clientserver-example.html#x1075">network/clientserver/client/client.cpp</a>, <a href="clientserver-example.html#x1057">network/clientserver/server/server.cpp</a>, <a href="httpd-example.html#x999">network/httpd/httpd.cpp</a> and <a href="process-example.html#x873">process/process.cpp</a>. <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 <a href="qpoint.html">QPoint</a> & pos, int * 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 null, <em>para</em> is set to this paragraph. If there is no character at <em>pos</em>, -1 is returned. <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>. <p> <h3 class=fn>void <a name="clearParagraphBackground"></a>QTextEdit::clearParagraphBackground ( int 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><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 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="helpviewer-example.html#x1435">helpviewer/helpwindow.cpp</a> and <a href="qdir-example.html#x800">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 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> * <a name="createPopupMenu"></a>QTextEdit::createPopupMenu ( const <a href="qpoint.html">QPoint</a> & pos )<tt> [virtual protected]</tt> </h3> <p> 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. <h3 class=fn><a href="qpopupmenu.html">QPopupMenu</a> * <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> 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. <h3 class=fn>void <a name="currentAlignmentChanged"></a>QTextEdit::currentAlignmentChanged ( int 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 <a href="qcolor.html">QColor</a> & 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>void <a name="currentFontChanged"></a>QTextEdit::currentFontChanged ( const <a href="qfont.html">QFont</a> & 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> 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 ( QTextCursor * c )<tt> [signal]</tt> </h3> <p> This signal is emitted if the position of the cursor changed. <em>c</em> points to the text cursor object. <p> <p>See also <a href="#setCursorPosition">setCursorPosition</a>(). <h3 class=fn>void <a name="cursorPositionChanged-2"></a>QTextEdit::cursorPositionChanged ( int para, int pos )<tt> [signal]</tt> </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> This signal is emitted if the position of the cursor 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>(). <p> <h3 class=fn>void <a name="doKeyboardAction"></a>QTextEdit::doKeyboardAction ( <a href="qtextedit.html#KeyboardAction-enum">KeyboardAction</a> 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="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 <a href="qstring.html">QString</a> & expr, bool cs, bool wo, bool forward = TRUE, int * para = 0, int * index = 0 )<tt> [virtual]</tt> </h3> Finds the next occurrence of the string, <em>expr</em>. Returns TRUE if <em>expr</em> is found; otherwise returns FALSE. <p> If <em>para</em> and <em>index</em> are both null the search begins from the start of the text. If <em>para</em> and <em>index</em> are both not null, the search begins from the <em>*</em><em>index</em> character position in the <em>*</em><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 null, the number of the paragraph in which the first character of the match was found is put into <em>*</em><em>para</em>, and the index position of that character within the paragraph is put into <em>*</em><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 null and <em>expr</em> is not found, <em>*</em><em>index</em> and <em>*</em><em>para</em> are undefined. <h3 class=fn>bool <a name="focusNextPrevChild"></a>QTextEdit::focusNextPrevChild ( bool 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> 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>(). <p> <p>Examples: <a href="qaction-application-example.html#x2040">action/application.cpp</a>, <a href="simple-application-example.html#x1938">application/application.cpp</a>, <a href="mdi-example.html#x1175">mdi/application.cpp</a> and <a href="qwerty-example.html#x658">qwerty/qwerty.cpp</a>. <h3 class=fn>void <a name="getCursorPosition"></a>QTextEdit::getCursorPosition ( int * para, int * index ) const </h3> This function sets the <em>*</em><em>para</em> and <em>*</em><em>index</em> parameters to the current cursor position. <em>para</em> and <em>index</em> must be non-null int pointers. <p> <p>See also <a href="#setCursorPosition">setCursorPosition</a>(). <h3 class=fn>bool <a name="getFormat"></a>QTextEdit::getFormat ( int para, int index, <a href="qfont.html">QFont</a> * font, <a href="qcolor.html">QColor</a> * color, <a href="qtextedit.html#VerticalAlignment-enum">VerticalAlignment</a> * verticalAlignment )<tt> [virtual]</tt> </h3> This function gets the format of the character at position <em>index</em> in paragraph <em>para</em>. Sets <em>font</em> to the character's font, <em>color</em> to the character's color and <em>verticalAlignment</em> to the character's vertical alignment. <p> Returns FALSE if <em>para</em> or <em>index</em> is out of range otherwise returns TRUE. <h3 class=fn>bool <a name="getParagraphFormat"></a>QTextEdit::getParagraphFormat ( int para, <a href="qfont.html">QFont</a> * font, <a href="qcolor.html">QColor</a> * color, <a href="qtextedit.html#VerticalAlignment-enum">VerticalAlignment</a> * verticalAlignment, int * alignment, <a href="qstylesheetitem.html#DisplayMode-enum">QStyleSheetItem::DisplayMode</a> * displayMode, <a href="qstylesheetitem.html#ListStyle-enum">QStyleSheetItem::ListStyle</a> * listStyle, int * listDepth )<tt> [virtual]</tt> </h3> This function gets the format of the paragraph <em>para</em>. Sets <em>font</em> to the paragraphs's font, <em>color</em> to the paragraph's color, <em>verticalAlignment</em> to the paragraph's vertical alignment, <em>alignment</em> to the paragraph's alignment, <em>displayMode</em> to the paragraph's display mode, <em>listStyle</em> to the paragraph's list style (if the display mode is QStyleSheetItem::DisplayListItem) and <em>listDepth</em> to the depth of the list (if the display mode is QStyleSheetItem::DisplayListItem). <p> Returns FALSE if <em>para</em> is out of range otherwise returns TRUE. <h3 class=fn>void <a name="getSelection"></a>QTextEdit::getSelection ( int * paraFrom, int * indexFrom, int * paraTo, int * indexTo, int selNum = 0 ) const </h3> If there is a selection, <em>*</em><em>paraFrom</em> is set to the number of the paragraph in which the selection begins and <em>*</em><em>paraTo</em> is set to the number of the paragraph in which the selection ends. (They could be the same.) <em>*</em><em>indexFrom</em> is set to the index at which the selection begins within <em>*</em><em>paraFrom</em>, and <em>*</em><em>indexTo</em> is set to the index at which the selection ends within <em>*</em><em>paraTo</em>. <p> If there is no selection, <em>*</em><em>paraFrom</em>, <em>*</em><em>indexFrom</em>, <em>*</em><em>paraTo</em> and <em>*</em><em>indexTo</em> are all set to -1. <p> <em>paraFrom</em>, <em>indexFrom</em>, <em>paraTo</em> and <em>indexTo</em> must be non-null int pointers. <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 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="indent"></a>QTextEdit::indent ()<tt> [virtual slot]</tt> </h3> Re-indents the current paragraph. <h3 class=fn>void <a name="insert"></a>QTextEdit::insert ( const <a href="qstring.html">QString</a> & text, bool indent = FALSE, bool checkNewLine = TRUE, bool removeSelected = TRUE )<tt> [virtual slot]</tt> </h3> Inserts <em>text</em> at the current cursor position. If <em>indent</em> is TRUE, the paragraph is re-indented. If <em>checkNewLine</em> is TRUE, newline characters in <em>text</em> result in hard line breaks (i.e. new paragraphs). If <em>checkNewLine</em> is FALSE the behaviour of the editor is undefined if the <em>text</em> contains newlines. If <em>removeSelected</em> is TRUE, any selected text (in selection 0) is removed before the text is inserted. <p> <p>See also <a href="#paste">paste</a>() and <a href="#pasteSubType">pasteSubType</a>(). <h3 class=fn>void <a name="insertAt"></a>QTextEdit::insertAt ( const <a href="qstring.html">QString</a> & text, int para, int index )<tt> [virtual slot]</tt> </h3> Inserts <em>text</em> in the paragraph <em>para</em> and position <em>index</em> <h3 class=fn>void <a name="insertParagraph"></a>QTextEdit::insertParagraph ( const <a href="qstring.html">QString</a> & text, int para )<tt> [virtual slot]</tt> </h3> Inserts <em>text</em> as the paragraph at position <em>para</em>. If <em>para</em> is -1, the text is appended. <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 whether redo is available <h3 class=fn>bool <a name="isUndoAvailable"></a>QTextEdit::isUndoAvailable () const </h3> Returns whether undo is available <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> * 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 para, int 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. <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. <p>Examples: <a href="qaction-application-example.html#x2042">action/application.cpp</a> and <a href="simple-application-example.html#x1940">application/application.cpp</a>. <h3 class=fn>int <a name="linesOfParagraph"></a>QTextEdit::linesOfParagraph ( int para ) const </h3> Returns the number of lines in paragraph <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><a href="qmimesourcefactory.html">QMimeSourceFactory</a> * <a name="mimeSourceFactory"></a>QTextEdit::mimeSourceFactory () const </h3> Returns the <a href="qmimesourcefactory.html">QMimeSourceFactory</a> which is currently used by this text edit. <p> <p>See also <a href="#setMimeSourceFactory">setMimeSourceFactory</a>(). <p>Examples: <a href="helpviewer-example.html#x1437">helpviewer/helpwindow.cpp</a> and <a href="qdir-example.html#x801">qdir/qdir.cpp</a>. <h3 class=fn>void <a name="modificationChanged"></a>QTextEdit::modificationChanged ( bool m )<tt> [signal]</tt> </h3> <p> This signal is emitted when the modification of the document 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> action, bool 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 <a href="qpoint.html">QPoint</a> & pos ) const </h3> Returns the paragraph which is at position <em>pos</em> (in contents coordinates), or -1 if there is no paragraph at <em>pos</em>. <h3 class=fn><a href="qcolor.html">QColor</a> <a name="paragraphBackgroundColor"></a>QTextEdit::paragraphBackgroundColor ( int 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 para ) const </h3> Returns the length of the paragraph <em>para</em> (number of characters) <h3 class=fn><a href="qrect.html">QRect</a> <a name="paragraphRect"></a>QTextEdit::paragraphRect ( int 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. <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 <a href="qcstring.html">QCString</a> & 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 <a href="qpoint.html">QPoint</a> & pos, QTextCursor * 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>(). <p> <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, e.g. 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 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 para )<tt> [virtual slot]</tt> </h3> Removes the paragraph <em>para</em> <h3 class=fn>void <a name="removeSelectedText"></a>QTextEdit::removeSelectedText ( int selNum = 0 )<tt> [virtual slot]</tt> </h3> Deletes the selected text (i.e. the default selection's text) of the selection <em>selNum</em> (by default, 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 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 <a href="qstring.html">QString</a> & 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><a name="target"></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 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 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>, Qt::AlignJustify and Qt::AlignCenter (which centers horizontally). <p> <p>See also <a href="#setParagType">setParagType</a>(). <p>Reimplemented in <a href="qmultilineedit.html#setAlignment">QMultiLineEdit</a>. <h3 class=fn>void <a name="setBold"></a>QTextEdit::setBold ( bool 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 <a href="qcolor.html">QColor</a> & 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>. <p>Example: <a href="actiongroup-example.html#x2010">action/actiongroup/editor.cpp</a>. <h3 class=fn>void <a name="setCurrentFont"></a>QTextEdit::setCurrentFont ( const <a href="qfont.html">QFont</a> & f )<tt> [virtual slot]</tt> </h3> <p> Sets the font of the current format to <em>f</em>. <p> <p>See also <a href="#font">font</a>(), <a href="#setPointSize">setPointSize</a>() and <a href="#setFamily">setFamily</a>(). <h3 class=fn>void <a name="setCursorPosition"></a>QTextEdit::setCursorPosition ( int para, int 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 <a href="qstring.html">QString</a> & 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 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="setMimeSourceFactory"></a>QTextEdit::setMimeSourceFactory ( <a href="qmimesourcefactory.html">QMimeSourceFactory</a> * 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 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 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 <a href="qbrush.html">QBrush</a> & 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="setParagType"></a>QTextEdit::setParagType ( <a href="qstylesheetitem.html#DisplayMode-enum">QStyleSheetItem::DisplayMode</a> dm, <a href="qstylesheetitem.html#ListStyle-enum">QStyleSheetItem::ListStyle</a> listStyle )<tt> [virtual slot]</tt> </h3> Sets the paragraph style of the current paragraph to <em>dm</em>. If <em>dm</em> is QStyleSheetItem::DisplayListItem, the type of the list item is set to <em>listStyle</em>. <p> <p>See also <a href="#setAlignment">setAlignment</a>(). <h3 class=fn>void <a name="setParagraphBackgroundColor"></a>QTextEdit::setParagraphBackgroundColor ( int para, const <a href="qcolor.html">QColor</a> & 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 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 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 paraFrom, int indexFrom, int paraTo, int indexTo, int 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>. Existing selections which have a different id (selNum) are not removed, existing selections which have the same id as <em>selNum</em> are removed. <p> Uses the selection settings of selection <em>selNum</em>. If <em>selNum</em> is 0, this is the default selection. <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 selNum, const <a href="qcolor.html">QColor</a> & back, bool 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 \selNum > 0. The default selection (\selNum == 0) gets its attributes from the <a href="qwidget.html#colorGroup">colorGroup</a>() of this widget. <h3 class=fn>void <a name="setStyleSheet"></a>QTextEdit::setStyleSheet ( <a href="qstylesheet.html">QStyleSheet</a> * 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="setTabStopWidth"></a>QTextEdit::setTabStopWidth ( int 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 <a href="qstring.html">QString</a> & 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 <a href="qstring.html">QString</a> & text, const <a href="qstring.html">QString</a> & 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 autodetects the format from <em>text</em>. <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> <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> f )<tt> [virtual slot]</tt> </h3><p>Sets the text format: rich text, plain 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 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 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 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> 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> 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> 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> * <a name="styleSheet"></a>QTextEdit::styleSheet () const </h3> Returns the <a href="qstylesheet.html">QStyleSheet</a> which is currently used in this text edit. <p> <p>See also <a href="#setStyleSheet">setStyleSheet</a>(). <p>Example: <a href="helpviewer-example.html#x1438">helpviewer/helpwindow.cpp</a>. <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 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="helpviewer-example.html#x1439">helpviewer/helpwindow.cpp</a>, <a href="qwerty-example.html#x661">qwerty/qwerty.cpp</a> and <a href="rot-example.html#x584">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. 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 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, e.g. 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 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>void <a name="updateStyles"></a>QTextEdit::updateStyles ()<tt> [protected]</tt> </h3> Updates all the rendering styles used to display the text. You will probably want to call this function after calling <a href="#setStyleSheet">setStyleSheet</a>(). <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 range )<tt> [virtual slot]</tt> </h3> Zooms in on the text by by making the base font size <em>range</em> points larger and recalculating all font sizes. 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 by making the base font size one point larger and recalculating all font sizes. This does not change the size of any images. <p> <p>See also <a href="#zoomOut">zoomOut</a>(). <p> <h3 class=fn>void <a name="zoomOut"></a>QTextEdit::zoomOut ( int 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. 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 by making the base font size one point smaller and recalculating all font sizes. 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 size )<tt> [virtual slot]</tt> </h3> Zooms the text by making the base font size <em>size</em> points and recalculating all font sizes. This does not change the size of any images. <hr><h2>Property Documentation</h2> <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><title></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> regardless of the text format. In a future version of Qt an HTML subset <em>may</em> be returned depending on the text format. <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>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 autodetects 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 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> 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>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">AtWhiteSpace</a> (the default) and <a href="#WrapPolicy-enum">Anywhere</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 © 1995-2001 <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 © 2001 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a> <td align=right><div align=right>Qt version 3.0.2</div> </table></div></address></body> </html>