[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qtextedit.cpp:205 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QTextEdit Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <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>
|
---|
| 33 |
|
---|
| 34 | <p>The QTextEdit widget provides a powerful single-page rich text editor.
|
---|
| 35 | <a href="#details">More...</a>
|
---|
| 36 | <p><tt>#include <<a href="qtextedit-h.html">qtextedit.h</a>></tt>
|
---|
| 37 | <p>Inherits <a href="qscrollview.html">QScrollView</a>.
|
---|
| 38 | <p>Inherited by <a href="qmultilineedit.html">QMultiLineEdit</a>, <a href="qtextbrowser.html">QTextBrowser</a>, and <a href="qtextview.html">QTextView</a>.
|
---|
| 39 | <p><a href="qtextedit-members.html">List of all member functions.</a>
|
---|
| 40 | <h2>Public Members</h2>
|
---|
| 41 | <ul>
|
---|
| 42 | <li class=fn>enum <a href="#WordWrap-enum"><b>WordWrap</b></a> { NoWrap, WidgetWidth, FixedPixelWidth, FixedColumnWidth }</li>
|
---|
| 43 | <li class=fn>enum <a href="#WrapPolicy-enum"><b>WrapPolicy</b></a> { AtWordBoundary, AtWhiteSpace = AtWordBoundary, Anywhere, AtWordOrDocumentBoundary }</li>
|
---|
| 44 | <li class=fn>enum <a href="#AutoFormatting-enum"><b>AutoFormatting</b></a> { AutoNone = 0, AutoBulletList = 0x00000001, AutoAll = 0xffffffff }</li>
|
---|
| 45 | <li class=fn>enum <a href="#KeyboardAction-enum"><b>KeyboardAction</b></a> { ActionBackspace, ActionDelete, ActionReturn, ActionKill, ActionWordBackspace, ActionWordDelete }</li>
|
---|
| 46 | <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>
|
---|
| 47 | <li class=fn>enum <a href="#VerticalAlignment-enum"><b>VerticalAlignment</b></a> { AlignNormal, AlignSuperScript, AlignSubScript }</li>
|
---|
| 48 | <li class=fn><a href="#QTextEdit"><b>QTextEdit</b></a> ( const QString & text, const QString & context = QString::null, QWidget * parent = 0, const char * name = 0 )</li>
|
---|
| 49 | <li class=fn><a href="#QTextEdit-2"><b>QTextEdit</b></a> ( QWidget * parent = 0, const char * name = 0 )</li>
|
---|
| 50 | <li class=fn>QString <a href="#text"><b>text</b></a> () const</li>
|
---|
| 51 | <li class=fn>QString <a href="#text-2"><b>text</b></a> ( int para ) const</li>
|
---|
| 52 | <li class=fn>TextFormat <a href="#textFormat"><b>textFormat</b></a> () const</li>
|
---|
| 53 | <li class=fn>QString <a href="#context"><b>context</b></a> () const</li>
|
---|
| 54 | <li class=fn>QString <a href="#documentTitle"><b>documentTitle</b></a> () const</li>
|
---|
| 55 | <li class=fn>void <a href="#getSelection"><b>getSelection</b></a> ( int * paraFrom, int * indexFrom, int * paraTo, int * indexTo, int selNum = 0 ) const</li>
|
---|
| 56 | <li 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 )</li>
|
---|
| 57 | <li class=fn>int <a href="#paragraphs"><b>paragraphs</b></a> () const</li>
|
---|
| 58 | <li class=fn>int <a href="#lines"><b>lines</b></a> () const</li>
|
---|
| 59 | <li class=fn>int <a href="#linesOfParagraph"><b>linesOfParagraph</b></a> ( int para ) const</li>
|
---|
| 60 | <li class=fn>int <a href="#lineOfChar"><b>lineOfChar</b></a> ( int para, int index )</li>
|
---|
| 61 | <li class=fn>int <a href="#length"><b>length</b></a> () const</li>
|
---|
| 62 | <li class=fn>QRect <a href="#paragraphRect"><b>paragraphRect</b></a> ( int para ) const</li>
|
---|
| 63 | <li class=fn>int <a href="#paragraphAt"><b>paragraphAt</b></a> ( const QPoint & pos ) const</li>
|
---|
| 64 | <li class=fn>int <a href="#charAt"><b>charAt</b></a> ( const QPoint & pos, int * para ) const</li>
|
---|
| 65 | <li class=fn>int <a href="#paragraphLength"><b>paragraphLength</b></a> ( int para ) const</li>
|
---|
| 66 | <li class=fn>QStyleSheet * <a href="#styleSheet"><b>styleSheet</b></a> () const</li>
|
---|
| 67 | <li class=fn>QMimeSourceFactory * <a href="#mimeSourceFactory"><b>mimeSourceFactory</b></a> () const</li>
|
---|
| 68 | <li class=fn>QBrush <a href="#paper"><b>paper</b></a> () const</li>
|
---|
| 69 | <li class=fn>bool <a href="#linkUnderline"><b>linkUnderline</b></a> () const</li>
|
---|
| 70 | <li class=fn>virtual int <a href="#heightForWidth"><b>heightForWidth</b></a> ( int w ) const</li>
|
---|
| 71 | <li class=fn>bool <a href="#hasSelectedText"><b>hasSelectedText</b></a> () const</li>
|
---|
| 72 | <li class=fn>QString <a href="#selectedText"><b>selectedText</b></a> () const</li>
|
---|
| 73 | <li class=fn>bool <a href="#isUndoAvailable"><b>isUndoAvailable</b></a> () const</li>
|
---|
| 74 | <li class=fn>bool <a href="#isRedoAvailable"><b>isRedoAvailable</b></a> () const</li>
|
---|
| 75 | <li class=fn>WordWrap <a href="#wordWrap"><b>wordWrap</b></a> () const</li>
|
---|
| 76 | <li class=fn>int <a href="#wrapColumnOrWidth"><b>wrapColumnOrWidth</b></a> () const</li>
|
---|
| 77 | <li class=fn>WrapPolicy <a href="#wrapPolicy"><b>wrapPolicy</b></a> () const</li>
|
---|
| 78 | <li class=fn>int <a href="#tabStopWidth"><b>tabStopWidth</b></a> () const</li>
|
---|
| 79 | <li class=fn>QString <a href="#anchorAt-2"><b>anchorAt</b></a> ( const QPoint & pos )</li>
|
---|
| 80 | <li class=fn>QString <a href="#anchorAt"><b>anchorAt</b></a> ( const QPoint & pos, AnchorAttribute attr )</li>
|
---|
| 81 | <li class=fn>bool <a href="#isReadOnly"><b>isReadOnly</b></a> () const</li>
|
---|
| 82 | <li class=fn>void <a href="#getCursorPosition"><b>getCursorPosition</b></a> ( int * para, int * index ) const</li>
|
---|
| 83 | <li class=fn>bool <a href="#isModified"><b>isModified</b></a> () const</li>
|
---|
| 84 | <li class=fn>bool <a href="#italic"><b>italic</b></a> () const</li>
|
---|
| 85 | <li class=fn>bool <a href="#bold"><b>bold</b></a> () const</li>
|
---|
| 86 | <li class=fn>bool <a href="#underline"><b>underline</b></a> () const</li>
|
---|
| 87 | <li class=fn>QString <a href="#family"><b>family</b></a> () const</li>
|
---|
| 88 | <li class=fn>int <a href="#pointSize"><b>pointSize</b></a> () const</li>
|
---|
| 89 | <li class=fn>QColor <a href="#color"><b>color</b></a> () const</li>
|
---|
| 90 | <li class=fn>QFont font () const <em>(obsolete)</em></li>
|
---|
| 91 | <li class=fn>QFont <a href="#currentFont"><b>currentFont</b></a> () const</li>
|
---|
| 92 | <li class=fn>int <a href="#alignment"><b>alignment</b></a> () const</li>
|
---|
| 93 | <li class=fn>int <a href="#undoDepth"><b>undoDepth</b></a> () const</li>
|
---|
| 94 | <li class=fn>bool <a href="#isOverwriteMode"><b>isOverwriteMode</b></a> () const</li>
|
---|
| 95 | <li class=fn>QColor <a href="#paragraphBackgroundColor"><b>paragraphBackgroundColor</b></a> ( int para ) const</li>
|
---|
| 96 | <li class=fn>bool <a href="#isUndoRedoEnabled"><b>isUndoRedoEnabled</b></a> () const</li>
|
---|
| 97 | <li class=fn>bool <a href="#tabChangesFocus"><b>tabChangesFocus</b></a> () const</li>
|
---|
| 98 | <li class=fn>void <a href="#setAutoFormatting"><b>setAutoFormatting</b></a> ( uint features )</li>
|
---|
| 99 | <li class=fn>uint <a href="#autoFormatting"><b>autoFormatting</b></a> () const</li>
|
---|
| 100 | <li class=fn>QSyntaxHighlighter * <a href="#syntaxHighlighter"><b>syntaxHighlighter</b></a> () const</li>
|
---|
| 101 | </ul>
|
---|
| 102 | <h2>Public Slots</h2>
|
---|
| 103 | <ul>
|
---|
| 104 | <li class=fn>virtual void <a href="#setMimeSourceFactory"><b>setMimeSourceFactory</b></a> ( QMimeSourceFactory * factory )</li>
|
---|
| 105 | <li class=fn>virtual void <a href="#setStyleSheet"><b>setStyleSheet</b></a> ( QStyleSheet * styleSheet )</li>
|
---|
| 106 | <li class=fn>virtual void <a href="#scrollToAnchor"><b>scrollToAnchor</b></a> ( const QString & name )</li>
|
---|
| 107 | <li class=fn>virtual void <a href="#setPaper"><b>setPaper</b></a> ( const QBrush & pap )</li>
|
---|
| 108 | <li class=fn>virtual void <a href="#setLinkUnderline"><b>setLinkUnderline</b></a> ( bool )</li>
|
---|
| 109 | <li class=fn>virtual void <a href="#setWordWrap"><b>setWordWrap</b></a> ( WordWrap mode )</li>
|
---|
| 110 | <li class=fn>virtual void <a href="#setWrapColumnOrWidth"><b>setWrapColumnOrWidth</b></a> ( int )</li>
|
---|
| 111 | <li class=fn>virtual void <a href="#setWrapPolicy"><b>setWrapPolicy</b></a> ( WrapPolicy policy )</li>
|
---|
| 112 | <li class=fn>virtual void <a href="#copy"><b>copy</b></a> ()</li>
|
---|
| 113 | <li class=fn>virtual void <a href="#append"><b>append</b></a> ( const QString & text )</li>
|
---|
| 114 | <li class=fn>void <a href="#setText"><b>setText</b></a> ( const QString & txt )</li>
|
---|
| 115 | <li class=fn>virtual void <a href="#setText-2"><b>setText</b></a> ( const QString & text, const QString & context )</li>
|
---|
| 116 | <li class=fn>virtual void <a href="#setTextFormat"><b>setTextFormat</b></a> ( TextFormat f )</li>
|
---|
| 117 | <li class=fn>virtual void <a href="#selectAll"><b>selectAll</b></a> ( bool select = TRUE )</li>
|
---|
| 118 | <li class=fn>virtual void <a href="#setTabStopWidth"><b>setTabStopWidth</b></a> ( int ts )</li>
|
---|
| 119 | <li class=fn>virtual void <a href="#zoomIn"><b>zoomIn</b></a> ( int range )</li>
|
---|
| 120 | <li class=fn>virtual void <a href="#zoomIn-2"><b>zoomIn</b></a> ()</li>
|
---|
| 121 | <li class=fn>virtual void <a href="#zoomOut"><b>zoomOut</b></a> ( int range )</li>
|
---|
| 122 | <li class=fn>virtual void <a href="#zoomOut-2"><b>zoomOut</b></a> ()</li>
|
---|
| 123 | <li class=fn>virtual void <a href="#zoomTo"><b>zoomTo</b></a> ( int size )</li>
|
---|
| 124 | <li class=fn>virtual void <a href="#sync"><b>sync</b></a> ()</li>
|
---|
| 125 | <li class=fn>virtual void <a href="#setReadOnly"><b>setReadOnly</b></a> ( bool b )</li>
|
---|
| 126 | <li class=fn>virtual void <a href="#undo"><b>undo</b></a> ()</li>
|
---|
| 127 | <li class=fn>virtual void <a href="#redo"><b>redo</b></a> ()</li>
|
---|
| 128 | <li class=fn>virtual void <a href="#cut"><b>cut</b></a> ()</li>
|
---|
| 129 | <li class=fn>virtual void <a href="#paste"><b>paste</b></a> ()</li>
|
---|
| 130 | <li class=fn>virtual void <a href="#pasteSubType"><b>pasteSubType</b></a> ( const QCString & subtype )</li>
|
---|
| 131 | <li class=fn>virtual void <a href="#clear"><b>clear</b></a> ()</li>
|
---|
| 132 | <li class=fn>virtual void <a href="#del"><b>del</b></a> ()</li>
|
---|
| 133 | <li class=fn>virtual void <a href="#setItalic"><b>setItalic</b></a> ( bool b )</li>
|
---|
| 134 | <li class=fn>virtual void <a href="#setBold"><b>setBold</b></a> ( bool b )</li>
|
---|
| 135 | <li class=fn>virtual void <a href="#setUnderline"><b>setUnderline</b></a> ( bool b )</li>
|
---|
| 136 | <li class=fn>virtual void <a href="#setFamily"><b>setFamily</b></a> ( const QString & fontFamily )</li>
|
---|
| 137 | <li class=fn>virtual void <a href="#setPointSize"><b>setPointSize</b></a> ( int s )</li>
|
---|
| 138 | <li class=fn>virtual void <a href="#setColor"><b>setColor</b></a> ( const QColor & c )</li>
|
---|
| 139 | <li class=fn>virtual void <a href="#setVerticalAlignment"><b>setVerticalAlignment</b></a> ( VerticalAlignment a )</li>
|
---|
| 140 | <li class=fn>virtual void <a href="#setAlignment"><b>setAlignment</b></a> ( int a )</li>
|
---|
| 141 | <li class=fn>virtual void <a href="#setCursorPosition"><b>setCursorPosition</b></a> ( int para, int index )</li>
|
---|
| 142 | <li class=fn>virtual void <a href="#setSelection"><b>setSelection</b></a> ( int paraFrom, int indexFrom, int paraTo, int indexTo, int selNum = 0 )</li>
|
---|
| 143 | <li class=fn>virtual void <a href="#setSelectionAttributes"><b>setSelectionAttributes</b></a> ( int selNum, const QColor & back, bool invertText )</li>
|
---|
| 144 | <li class=fn>virtual void <a href="#setModified"><b>setModified</b></a> ( bool m )</li>
|
---|
| 145 | <li class=fn>virtual void <a href="#setUndoDepth"><b>setUndoDepth</b></a> ( int d )</li>
|
---|
| 146 | <li class=fn>virtual void <a href="#ensureCursorVisible"><b>ensureCursorVisible</b></a> ()</li>
|
---|
| 147 | <li class=fn>virtual void <a href="#placeCursor"><b>placeCursor</b></a> ( const QPoint & pos, QTextCursor * c = 0 )</li>
|
---|
| 148 | <li class=fn>virtual void <a href="#moveCursor"><b>moveCursor</b></a> ( CursorAction action, bool select )</li>
|
---|
| 149 | <li class=fn>virtual void <a href="#doKeyboardAction"><b>doKeyboardAction</b></a> ( KeyboardAction action )</li>
|
---|
| 150 | <li class=fn>virtual void <a href="#removeSelectedText"><b>removeSelectedText</b></a> ( int selNum = 0 )</li>
|
---|
| 151 | <li class=fn>virtual void <a href="#removeSelection"><b>removeSelection</b></a> ( int selNum = 0 )</li>
|
---|
| 152 | <li class=fn>virtual void <a href="#setCurrentFont"><b>setCurrentFont</b></a> ( const QFont & f )</li>
|
---|
| 153 | <li class=fn>virtual void <a href="#setOverwriteMode"><b>setOverwriteMode</b></a> ( bool b )</li>
|
---|
| 154 | <li class=fn>virtual void <a href="#scrollToBottom"><b>scrollToBottom</b></a> ()</li>
|
---|
| 155 | <li class=fn>void <a href="#insert"><b>insert</b></a> ( const QString & text, uint insertionFlags = CheckNewLines | RemoveSelected )</li>
|
---|
| 156 | <li class=fn>virtual void insert ( const QString & text, bool indent, bool checkNewLine = TRUE, bool removeSelected = TRUE ) <em>(obsolete)</em></li>
|
---|
| 157 | <li class=fn>virtual void <a href="#insertAt"><b>insertAt</b></a> ( const QString & text, int para, int index )</li>
|
---|
| 158 | <li class=fn>virtual void <a href="#removeParagraph"><b>removeParagraph</b></a> ( int para )</li>
|
---|
| 159 | <li class=fn>virtual void <a href="#insertParagraph"><b>insertParagraph</b></a> ( const QString & text, int para )</li>
|
---|
| 160 | <li class=fn>virtual void <a href="#setParagraphBackgroundColor"><b>setParagraphBackgroundColor</b></a> ( int para, const QColor & bg )</li>
|
---|
| 161 | <li class=fn>virtual void <a href="#clearParagraphBackground"><b>clearParagraphBackground</b></a> ( int para )</li>
|
---|
| 162 | <li class=fn>virtual void <a href="#setUndoRedoEnabled"><b>setUndoRedoEnabled</b></a> ( bool b )</li>
|
---|
| 163 | <li class=fn>void <a href="#setTabChangesFocus"><b>setTabChangesFocus</b></a> ( bool b )</li>
|
---|
| 164 | <li class=fn>void <a href="#setMaxLogLines"><b>setMaxLogLines</b></a> ( int limit )</li>
|
---|
| 165 | <li class=fn>int <a href="#maxLogLines"><b>maxLogLines</b></a> ()</li>
|
---|
| 166 | </ul>
|
---|
| 167 | <h2>Signals</h2>
|
---|
| 168 | <ul>
|
---|
| 169 | <li class=fn>void <a href="#textChanged"><b>textChanged</b></a> ()</li>
|
---|
| 170 | <li class=fn>void <a href="#selectionChanged"><b>selectionChanged</b></a> ()</li>
|
---|
| 171 | <li class=fn>void <a href="#copyAvailable"><b>copyAvailable</b></a> ( bool yes )</li>
|
---|
| 172 | <li class=fn>void <a href="#undoAvailable"><b>undoAvailable</b></a> ( bool yes )</li>
|
---|
| 173 | <li class=fn>void <a href="#redoAvailable"><b>redoAvailable</b></a> ( bool yes )</li>
|
---|
| 174 | <li class=fn>void <a href="#currentFontChanged"><b>currentFontChanged</b></a> ( const QFont & f )</li>
|
---|
| 175 | <li class=fn>void <a href="#currentColorChanged"><b>currentColorChanged</b></a> ( const QColor & c )</li>
|
---|
| 176 | <li class=fn>void <a href="#currentAlignmentChanged"><b>currentAlignmentChanged</b></a> ( int a )</li>
|
---|
| 177 | <li class=fn>void <a href="#currentVerticalAlignmentChanged"><b>currentVerticalAlignmentChanged</b></a> ( VerticalAlignment a )</li>
|
---|
| 178 | <li class=fn>void <a href="#cursorPositionChanged"><b>cursorPositionChanged</b></a> ( int para, int pos )</li>
|
---|
| 179 | <li class=fn>void <a href="#returnPressed"><b>returnPressed</b></a> ()</li>
|
---|
| 180 | <li class=fn>void <a href="#modificationChanged"><b>modificationChanged</b></a> ( bool m )</li>
|
---|
| 181 | <li class=fn>void <a href="#clicked"><b>clicked</b></a> ( int para, int pos )</li>
|
---|
| 182 | <li class=fn>void <a href="#doubleClicked"><b>doubleClicked</b></a> ( int para, int pos )</li>
|
---|
| 183 | </ul>
|
---|
| 184 | <h2>Properties</h2>
|
---|
| 185 | <ul>
|
---|
| 186 | <li class=fn>AutoFormatting <a href="#autoFormatting-prop"><b>autoFormatting</b></a> - the enabled set of auto formatting features</li>
|
---|
| 187 | <li class=fn>QString <a href="#documentTitle-prop"><b>documentTitle</b></a> - the title of the document parsed from the text <em>(read only)</em></li>
|
---|
| 188 | <li class=fn>bool <a href="#hasSelectedText-prop"><b>hasSelectedText</b></a> - whether some text is selected in selection 0 <em>(read only)</em></li>
|
---|
| 189 | <li class=fn>int <a href="#length-prop"><b>length</b></a> - the number of characters in the text <em>(read only)</em></li>
|
---|
| 190 | <li class=fn>bool <a href="#linkUnderline-prop"><b>linkUnderline</b></a> - whether hypertext links will be underlined</li>
|
---|
| 191 | <li class=fn>bool <a href="#modified-prop"><b>modified</b></a> - whether the document has been modified by the user</li>
|
---|
| 192 | <li class=fn>bool <a href="#overwriteMode-prop"><b>overwriteMode</b></a> - the text edit's overwrite mode</li>
|
---|
| 193 | <li class=fn>QBrush <a href="#paper-prop"><b>paper</b></a> - the background (paper) brush</li>
|
---|
| 194 | <li class=fn>bool <a href="#readOnly-prop"><b>readOnly</b></a> - whether the text edit is read-only</li>
|
---|
| 195 | <li 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></li>
|
---|
| 196 | <li class=fn>bool <a href="#tabChangesFocus-prop"><b>tabChangesFocus</b></a> - whether TAB changes focus or is accepted as input</li>
|
---|
| 197 | <li class=fn>int <a href="#tabStopWidth-prop"><b>tabStopWidth</b></a> - the tab stop width in pixels</li>
|
---|
| 198 | <li class=fn>QString <a href="#text-prop"><b>text</b></a> - the text edit's text</li>
|
---|
| 199 | <li class=fn>TextFormat <a href="#textFormat-prop"><b>textFormat</b></a> - the text format: rich text, plain text, log text or auto text</li>
|
---|
| 200 | <li class=fn>int <a href="#undoDepth-prop"><b>undoDepth</b></a> - the depth of the undo history</li>
|
---|
| 201 | <li class=fn>bool <a href="#undoRedoEnabled-prop"><b>undoRedoEnabled</b></a> - whether undo/redo is enabled</li>
|
---|
| 202 | <li class=fn>WordWrap <a href="#wordWrap-prop"><b>wordWrap</b></a> - the word wrap mode</li>
|
---|
| 203 | <li 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</li>
|
---|
| 204 | <li class=fn>WrapPolicy <a href="#wrapPolicy-prop"><b>wrapPolicy</b></a> - the word wrap policy, at whitespace or anywhere</li>
|
---|
| 205 | </ul>
|
---|
| 206 | <h2>Protected Members</h2>
|
---|
| 207 | <ul>
|
---|
| 208 | <li class=fn>void <a href="#repaintChanged"><b>repaintChanged</b></a> ()</li>
|
---|
| 209 | <li class=fn>virtual void <a href="#keyPressEvent"><b>keyPressEvent</b></a> ( QKeyEvent * e )</li>
|
---|
| 210 | <li class=fn>virtual bool <a href="#focusNextPrevChild"><b>focusNextPrevChild</b></a> ( bool n )</li>
|
---|
| 211 | <li class=fn>QTextCursor * <a href="#textCursor"><b>textCursor</b></a> () const</li>
|
---|
| 212 | <li class=fn>virtual QPopupMenu * <a href="#createPopupMenu"><b>createPopupMenu</b></a> ( const QPoint & pos )</li>
|
---|
| 213 | <li class=fn>virtual QPopupMenu * createPopupMenu () <em>(obsolete)</em></li>
|
---|
| 214 | </ul>
|
---|
| 215 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 216 |
|
---|
| 217 |
|
---|
| 218 | The QTextEdit widget provides a powerful single-page rich text editor.
|
---|
| 219 | <p>
|
---|
| 220 |
|
---|
| 221 |
|
---|
| 222 | <p> <!-- toc -->
|
---|
| 223 | <ul>
|
---|
| 224 | <li><a href="#1"> Introduction and Concepts
|
---|
| 225 | </a>
|
---|
| 226 | <li><a href="#1-1"> Using QTextEdit as a Display Widget
|
---|
| 227 | </a>
|
---|
| 228 | <ul>
|
---|
| 229 | <li><a href="#1-1-1"> Read-only key bindings
|
---|
| 230 | </a>
|
---|
| 231 | <li><a href="#1-1-2"> Using QTextEdit in LogText Mode
|
---|
| 232 | </a>
|
---|
| 233 | </ul>
|
---|
| 234 | <li><a href="#1-2"> Using QTextEdit as an Editor
|
---|
| 235 | </a>
|
---|
| 236 | <ul>
|
---|
| 237 | <li><a href="#1-2-1"> Editing key bindings
|
---|
| 238 | </a>
|
---|
| 239 | </ul>
|
---|
| 240 | </ul>
|
---|
| 241 | <!-- endtoc -->
|
---|
| 242 |
|
---|
| 243 | <p> <h3> Introduction and Concepts
|
---|
| 244 | </h3>
|
---|
| 245 | <a name="1"></a><p> QTextEdit is an advanced WYSIWYG viewer/editor supporting rich
|
---|
| 246 | text formatting using HTML-style tags. It is optimized to handle
|
---|
| 247 | large documents and to respond quickly to user input.
|
---|
| 248 | <p> QTextEdit has four modes of operation:
|
---|
| 249 | <center><table cellpadding="4" cellspacing="2" border="0">
|
---|
| 250 | <tr bgcolor="#a2c511"> <th valign="top">Mode <th valign="top">Command <th valign="top">Notes
|
---|
| 251 | <tr bgcolor="#f0f0f0"> <td valign="top">Plain Text Editor <td valign="top">setTextFormat(PlainText)
|
---|
| 252 | <td valign="top">Set text with <a href="#setText">setText</a>(); <a href="#text">text</a>() returns plain text. Text
|
---|
| 253 | attributes (e.g. colors) can be set, but plain text is always
|
---|
| 254 | returned.
|
---|
| 255 | <tr bgcolor="#d0d0d0"> <td valign="top">Rich Text Editor <td valign="top">setTextFormat(RichText)
|
---|
| 256 | <td valign="top">Set text with setText(); text() returns rich text. Rich
|
---|
| 257 | text editing is fairly limited. You can't set margins or
|
---|
| 258 | insert images for example (although you can read and
|
---|
| 259 | correctly display files that have margins set and that
|
---|
| 260 | include images). This mode is mostly useful for editing small
|
---|
| 261 | amounts of rich text. <sup>1.</sup>
|
---|
| 262 | <tr bgcolor="#f0f0f0"> <td valign="top">Text Viewer <td valign="top">setReadOnly(TRUE)
|
---|
| 263 | <td valign="top">Set text with setText() or <a href="#append">append</a>() (which has no undo
|
---|
| 264 | history so is faster and uses less memory); text() returns
|
---|
| 265 | plain or rich text depending on the <a href="#textFormat">textFormat</a>(). This mode
|
---|
| 266 | can correctly display a large subset of HTML tags.
|
---|
| 267 | <tr bgcolor="#d0d0d0"> <td valign="top">Log Viewer <td valign="top">setTextFormat(LogText)
|
---|
| 268 | <td valign="top">Append text using append(). The widget is set to be read
|
---|
| 269 | only and rich text support is disabled although a few HTML
|
---|
| 270 | tags (for color, bold, italic and underline) may be used.
|
---|
| 271 | (See <a href="#logtextmode">LogText mode</a> for details.)
|
---|
| 272 | </table></center>
|
---|
| 273 | <p> <sup>1.</sup><small>A more complete API that supports setting
|
---|
| 274 | margins, images, etc., is planned for a later Qt release.</small>
|
---|
| 275 | <p> QTextEdit can be used as a syntax highlighting editor when used in
|
---|
| 276 | conjunction with <a href="qsyntaxhighlighter.html">QSyntaxHighlighter</a>.
|
---|
| 277 | <p> We recommend that you always call <a href="#setTextFormat">setTextFormat</a>() to set the mode
|
---|
| 278 | you want to use. If you use <a href="qt.html#TextFormat-enum">AutoText</a> then <a href="#setText">setText</a>() and
|
---|
| 279 | <a href="#append">append</a>() will try to determine whether the text they are given is
|
---|
| 280 | plain text or rich text. If you use <a href="qt.html#TextFormat-enum">RichText</a> then setText() and
|
---|
| 281 | append() will assume that the text they are given is rich text.
|
---|
| 282 | <a href="#insert">insert</a>() simply inserts the text it is given.
|
---|
| 283 | <p> QTextEdit works on paragraphs and characters. A paragraph is a
|
---|
| 284 | formatted string which is word-wrapped to fit into the width of
|
---|
| 285 | the widget. By default when reading plain text, one newline
|
---|
| 286 | signify a paragraph. A document consists of zero or more
|
---|
| 287 | paragraphs, indexed from 0. Characters are indexed on a
|
---|
| 288 | per-paragraph basis, also indexed from 0. The words in the
|
---|
| 289 | paragraph are aligned in accordance with the paragraph's
|
---|
| 290 | <a href="#alignment">alignment</a>(). Paragraphs are separated by hard line breaks. Each
|
---|
| 291 | character within a paragraph has its own attributes, for example,
|
---|
| 292 | font and color.
|
---|
| 293 | <p> The text edit documentation uses the following concepts:
|
---|
| 294 | <ul>
|
---|
| 295 | <li> <em>current format</em> --
|
---|
| 296 | this is the format at the current cursor position, <em>and</em> it
|
---|
| 297 | is the format of the selected text if any.
|
---|
| 298 | <li> <em>current paragraph</em> -- the paragraph which contains the
|
---|
| 299 | cursor.
|
---|
| 300 | </ul>
|
---|
| 301 | <p> QTextEdit can display images (using <a href="qmimesourcefactory.html">QMimeSourceFactory</a>), lists and
|
---|
| 302 | tables. If the text is too large to view within the text edit's
|
---|
| 303 | viewport, scrollbars will appear. The text edit can load both
|
---|
| 304 | plain text and HTML files (a subset of HTML 3.2 and 4). The
|
---|
| 305 | rendering style and the set of valid tags are defined by a
|
---|
| 306 | <a href="#styleSheet">styleSheet</a>(). Custom tags can be created and placed in a custom
|
---|
| 307 | style sheet. Change the style sheet with <a href="#setStyleSheet">setStyleSheet</a>(); see
|
---|
| 308 | <a href="qstylesheet.html">QStyleSheet</a> for details. The images identified by image tags are
|
---|
| 309 | displayed if they can be interpreted using the text edit's
|
---|
| 310 | <a href="qmimesourcefactory.html">QMimeSourceFactory</a>; see <a href="#setMimeSourceFactory">setMimeSourceFactory</a>().
|
---|
| 311 | <p> If you want a text browser with more navigation use <a href="qtextbrowser.html">QTextBrowser</a>.
|
---|
| 312 | If you just need to display a small piece of rich text use <a href="qlabel.html">QLabel</a>
|
---|
| 313 | or <a href="qsimplerichtext.html">QSimpleRichText</a>.
|
---|
| 314 | <p> If you create a new QTextEdit, and want to allow the user to edit
|
---|
| 315 | rich text, call <a href="#setTextFormat">setTextFormat</a>(Qt::RichText) to ensure that the
|
---|
| 316 | text is treated as rich text. (Rich text uses HTML tags to set
|
---|
| 317 | text formatting attributes. See QStyleSheet for information on the
|
---|
| 318 | HTML tags that are supported.). If you don't call setTextFormat()
|
---|
| 319 | explicitly the text edit will guess from the text itself whether
|
---|
| 320 | it is rich text or plain text. This means that if the text looks
|
---|
| 321 | like HTML or XML it will probably be interpreted as rich text, so
|
---|
| 322 | you should call setTextFormat(Qt::PlainText) to preserve such
|
---|
| 323 | text.
|
---|
| 324 | <p> Note that we do not intend to add a full-featured web browser
|
---|
| 325 | widget to Qt (because that would easily double Qt's size and only
|
---|
| 326 | a few applications would benefit from it). The rich
|
---|
| 327 | text support in Qt is designed to provide a fast, portable and
|
---|
| 328 | efficient way to add reasonable online help facilities to
|
---|
| 329 | applications, and to provide a basis for rich text editors.
|
---|
| 330 | <p> <h3> Using QTextEdit as a Display Widget
|
---|
| 331 | </h3>
|
---|
| 332 | <a name="1-1"></a><p> QTextEdit can display a large HTML subset, including tables and
|
---|
| 333 | images.
|
---|
| 334 | <p> The text is set or replaced using <a href="#setText">setText</a>() which deletes any
|
---|
| 335 | existing text and replaces it with the text passed in the
|
---|
| 336 | setText() call. If you call setText() with legacy HTML (with
|
---|
| 337 | <a href="#setTextFormat">setTextFormat</a>(RichText) in force), and then call <a href="#text">text</a>(), the text
|
---|
| 338 | that is returned may have different markup, but will render the
|
---|
| 339 | same. Text can be inserted with <a href="#insert">insert</a>(), <a href="#paste">paste</a>(), <a href="#pasteSubType">pasteSubType</a>()
|
---|
| 340 | and <a href="#append">append</a>(). Text that is appended does not go into the undo
|
---|
| 341 | history; this makes append() faster and consumes less memory. Text
|
---|
| 342 | can also be <a href="#cut">cut</a>(). The entire text is deleted with <a href="#clear">clear</a>() and the
|
---|
| 343 | selected text is deleted with <a href="#removeSelectedText">removeSelectedText</a>(). Selected
|
---|
| 344 | (marked) text can also be deleted with <a href="#del">del</a>() (which will delete
|
---|
| 345 | the character to the right of the cursor if no text is selected).
|
---|
| 346 | <p> Loading and saving text is achieved using <a href="#setText">setText</a>() and text(),
|
---|
| 347 | for example:
|
---|
| 348 | <pre>
|
---|
| 349 | <a href="qfile.html">QFile</a> file( fileName ); // Read the text from a file
|
---|
| 350 | if ( file.<a href="qfile.html#open">open</a>( <a href="qfile.html#open">IO_ReadOnly</a> ) ) {
|
---|
| 351 | <a href="qtextstream.html">QTextStream</a> stream( &file );
|
---|
| 352 | textEdit->setText( stream.<a href="qtextstream.html#read">read</a>() );
|
---|
| 353 | }
|
---|
| 354 |
|
---|
| 355 | <a href="qfile.html">QFile</a> file( fileName ); // Write the text to a file
|
---|
| 356 | if ( file.<a href="qfile.html#open">open</a>( <a href="qfile.html#open">IO_WriteOnly</a> ) ) {
|
---|
| 357 | <a href="qtextstream.html">QTextStream</a> stream( &file );
|
---|
| 358 | stream << textEdit->text();
|
---|
| 359 | textEdit->setModified( FALSE );
|
---|
| 360 | }
|
---|
| 361 | </pre>
|
---|
| 362 |
|
---|
| 363 | <p> By default the text edit wraps words at whitespace to fit within
|
---|
| 364 | the text edit widget. The <a href="#setWordWrap">setWordWrap</a>() function is used to
|
---|
| 365 | specify the kind of word wrap you want, or <a href="#WordWrap-enum">NoWrap</a> if you don't
|
---|
| 366 | want any wrapping. Call setWordWrap() to set a fixed pixel width
|
---|
| 367 | <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
|
---|
| 368 | <a href="#setWrapColumnOrWidth">setWrapColumnOrWidth</a>(). If you use word wrap to the widget's width
|
---|
| 369 | <a href="#WordWrap-enum">WidgetWidth</a>, you can specify whether to break on whitespace or
|
---|
| 370 | anywhere with <a href="#setWrapPolicy">setWrapPolicy</a>().
|
---|
| 371 | <p> The background color is set differently than other widgets, using
|
---|
| 372 | <a href="#setPaper">setPaper</a>(). You specify a brush style which could be a plain color
|
---|
| 373 | or a complex pixmap.
|
---|
| 374 | <p> Hypertext links are automatically underlined; this can be changed
|
---|
| 375 | with <a href="#setLinkUnderline">setLinkUnderline</a>(). The tab stop width is set with
|
---|
| 376 | <a href="#setTabStopWidth">setTabStopWidth</a>().
|
---|
| 377 | <p> The <a href="#zoomIn">zoomIn</a>() and <a href="#zoomOut">zoomOut</a>() functions can be used to resize the
|
---|
| 378 | text by increasing (decreasing for zoomOut()) the point size used.
|
---|
| 379 | Images are not affected by the zoom functions.
|
---|
| 380 | <p> The <a href="#lines">lines</a>() function returns the number of lines in the text and
|
---|
| 381 | <a href="#paragraphs">paragraphs</a>() returns the number of paragraphs. The number of lines
|
---|
| 382 | within a particular paragraph is returned by <a href="#linesOfParagraph">linesOfParagraph</a>().
|
---|
| 383 | The length of the entire text in characters is returned by
|
---|
| 384 | <a href="#length">length</a>().
|
---|
| 385 | <p> You can scroll to an anchor in the text, e.g.
|
---|
| 386 | <tt><a name="anchor"></tt> with <a href="#scrollToAnchor">scrollToAnchor</a>(). The <a href="#find">find</a>() function
|
---|
| 387 | can be used to find and select a given string within the text.
|
---|
| 388 | <p> A read-only QTextEdit provides the same functionality as the
|
---|
| 389 | (obsolete) QTextView. (QTextView is still supplied for
|
---|
| 390 | compatibility with old code.)
|
---|
| 391 | <p> <h4> Read-only key bindings
|
---|
| 392 | </h4>
|
---|
| 393 | <a name="1-1-1"></a><p> When QTextEdit is used read-only the key-bindings are limited to
|
---|
| 394 | navigation, and text may only be selected with the mouse:
|
---|
| 395 | <center><table cellpadding="4" cellspacing="2" border="0">
|
---|
| 396 | <tr bgcolor="#a2c511"> <th valign="top">Keypresses <th valign="top">Action
|
---|
| 397 | <tr bgcolor="#f0f0f0"> <td valign="top">UpArrow <td valign="top">Move one line up
|
---|
| 398 | <tr bgcolor="#d0d0d0"> <td valign="top">DownArrow <td valign="top">Move one line down
|
---|
| 399 | <tr bgcolor="#f0f0f0"> <td valign="top">LeftArrow <td valign="top">Move one character left
|
---|
| 400 | <tr bgcolor="#d0d0d0"> <td valign="top">RightArrow <td valign="top">Move one character right
|
---|
| 401 | <tr bgcolor="#f0f0f0"> <td valign="top">PageUp <td valign="top">Move one (viewport) page up
|
---|
| 402 | <tr bgcolor="#d0d0d0"> <td valign="top">PageDown <td valign="top">Move one (viewport) page down
|
---|
| 403 | <tr bgcolor="#f0f0f0"> <td valign="top">Home <td valign="top">Move to the beginning of the text
|
---|
| 404 | <tr bgcolor="#d0d0d0"> <td valign="top">End <td valign="top">Move to the end of the text
|
---|
| 405 | <tr bgcolor="#f0f0f0"> <td valign="top">Shift+Wheel
|
---|
| 406 | <td valign="top">Scroll the page horizontally (the Wheel is the mouse wheel)
|
---|
| 407 | <tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+Wheel <td valign="top">Zoom the text
|
---|
| 408 | </table></center>
|
---|
| 409 | <p> The text edit may be able to provide some meta-information. For
|
---|
| 410 | example, the <a href="#documentTitle">documentTitle</a>() function will return the text from
|
---|
| 411 | within HTML <tt><title></tt> tags.
|
---|
| 412 | <p> The text displayed in a text edit has a <em>context</em>. The context is
|
---|
| 413 | a path which the text edit's <a href="qmimesourcefactory.html">QMimeSourceFactory</a> uses to resolve
|
---|
| 414 | the locations of files and images. It is passed to the
|
---|
| 415 | <a href="#mimeSourceFactory">mimeSourceFactory</a>() when quering data. (See QTextEdit() and
|
---|
| 416 | <a href="#context">context</a>().)
|
---|
| 417 | <p> <a name="logtextmode"></a>
|
---|
| 418 | <h4> Using QTextEdit in LogText Mode
|
---|
| 419 | </h4>
|
---|
| 420 | <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
|
---|
| 421 | mode which is optimized for very large texts. Editing, word wrap,
|
---|
| 422 | and rich text support are disabled in this mode (the widget is
|
---|
| 423 | explicitly made read-only). This allows the text to be stored in a
|
---|
| 424 | different, more memory efficient manner. However, a certain degree
|
---|
| 425 | of text formatting is supported through the use of formatting tags.
|
---|
| 426 | A tag is delimited by <tt><</tt> and <tt>></tt>. The characters <tt><</tt>, <tt>></tt>
|
---|
| 427 | and <tt>&</tt> are escaped by using <tt>&lt;</tt>, <tt>&gt;</tt> and <tt>&amp;</tt>.
|
---|
| 428 | A tag pair consists of a left and a right tag (or open/close tags).
|
---|
| 429 | Left-tags mark the starting point for formatting, while right-tags
|
---|
| 430 | mark the ending point. A right-tag always start with a <tt>/</tt> before
|
---|
| 431 | the tag keyword. For example <tt><b></tt> and <tt></b></tt> are a tag pair.
|
---|
| 432 | Tags can be nested, but they have to be closed in the same order as
|
---|
| 433 | they are opened. For example, <tt><b><u></u></b></tt> is valid, while <tt><b><u></b></u></tt> will output an error message.
|
---|
| 434 | <p> By using tags it is possible to change the color, bold, italic and
|
---|
| 435 | underline settings for a piece of text. A color can be specified
|
---|
| 436 | by using the HTML font tag <tt><font color=colorname></tt>. The color
|
---|
| 437 | name can be one of the color names from the X11 color database, or
|
---|
| 438 | a RGB hex value (e.g <tt>#00ff00</tt>). Example of valid color tags:
|
---|
| 439 | <tt><font color=red></tt>, <tt><font color="light blue"></tt>, <tt><font color="#223344"></tt>. Bold, italic and underline settings can be
|
---|
| 440 | specified by the tags <tt><b></tt>, <tt><i></tt> and <tt><u></tt>. Note that a
|
---|
| 441 | tag does not necessarily have to be closed. A valid example:
|
---|
| 442 | <pre>
|
---|
| 443 | This is <font color=red>red</font> while <b>this</b> is <font color=blue>blue</font>.
|
---|
| 444 | <font color=green><font color=yellow>Yellow,</font> and <u>green</u>.
|
---|
| 445 | </pre>
|
---|
| 446 |
|
---|
| 447 | <p> Stylesheets can also be used in LogText mode. To create and use a
|
---|
| 448 | custom tag, you could do the following:
|
---|
| 449 | <pre>
|
---|
| 450 | QTextEdit * log = new QTextEdit( this );
|
---|
| 451 | log-><a href="#setTextFormat">setTextFormat</a>( Qt::<a href="qt.html#TextFormat-enum">LogText</a> );
|
---|
| 452 | <a href="qstylesheetitem.html">QStyleSheetItem</a> * item = new <a href="qstylesheetitem.html">QStyleSheetItem</a>( log-><a href="#styleSheet">styleSheet</a>(), "mytag" );
|
---|
| 453 | item-><a href="qstylesheetitem.html#setColor">setColor</a>( "red" );
|
---|
| 454 | item-><a href="qstylesheetitem.html#setFontWeight">setFontWeight</a>( QFont::Bold );
|
---|
| 455 | item-><a href="qstylesheetitem.html#setFontUnderline">setFontUnderline</a>( TRUE );
|
---|
| 456 | log-><a href="#append">append</a>( "This is a <mytag>custom tag</mytag>!" );
|
---|
| 457 | </pre>
|
---|
| 458 |
|
---|
| 459 | Note that only the color, bold, underline and italic attributes of
|
---|
| 460 | a <a href="qstylesheetitem.html">QStyleSheetItem</a> is used in LogText mode.
|
---|
| 461 | <p> Note that you can use <a href="#setMaxLogLines">setMaxLogLines</a>() to limit the number of
|
---|
| 462 | lines the widget can hold in LogText mode.
|
---|
| 463 | <p> There are a few things that you need to be aware of when the
|
---|
| 464 | widget is in this mode:
|
---|
| 465 | <ul>
|
---|
| 466 | <li> Functions that deal with rich text formatting and cursor
|
---|
| 467 | movement will not work or return anything valid.
|
---|
| 468 | <li> Lines are equivalent to paragraphs.
|
---|
| 469 | </ul>
|
---|
| 470 | <p> <h3> Using QTextEdit as an Editor
|
---|
| 471 | </h3>
|
---|
| 472 | <a name="1-2"></a><p> All the information about using QTextEdit as a display widget also
|
---|
| 473 | applies here.
|
---|
| 474 | <p> The current format's attributes are set with <a href="#setItalic">setItalic</a>(),
|
---|
| 475 | <a href="#setBold">setBold</a>(), <a href="#setUnderline">setUnderline</a>(), <a href="#setFamily">setFamily</a>() (font family),
|
---|
| 476 | <a href="#setPointSize">setPointSize</a>(), <a href="#setColor">setColor</a>() and <a href="#setCurrentFont">setCurrentFont</a>(). The current
|
---|
| 477 | paragraph's alignment is set with <a href="#setAlignment">setAlignment</a>().
|
---|
| 478 | <p> Use <a href="#setSelection">setSelection</a>() to select text. The <a href="#setSelectionAttributes">setSelectionAttributes</a>()
|
---|
| 479 | function is used to indicate how selected text should be
|
---|
| 480 | displayed. Use <a href="#hasSelectedText">hasSelectedText</a>() to find out if any text is
|
---|
| 481 | selected. The currently selected text's position is available
|
---|
| 482 | using <a href="#getSelection">getSelection</a>() and the selected text itself is returned by
|
---|
| 483 | <a href="#selectedText">selectedText</a>(). The selection can be copied to the clipboard with
|
---|
| 484 | <a href="#copy">copy</a>(), or cut to the clipboard with <a href="#cut">cut</a>(). It can be deleted with
|
---|
| 485 | <a href="#removeSelectedText">removeSelectedText</a>(). The entire text can be selected (or
|
---|
| 486 | unselected) using <a href="#selectAll">selectAll</a>(). QTextEdit supports multiple
|
---|
| 487 | selections. Most of the selection functions operate on the default
|
---|
| 488 | selection, selection 0. If the user presses a non-selecting key,
|
---|
| 489 | e.g. a cursor key without also holding down Shift, all selections
|
---|
| 490 | are cleared.
|
---|
| 491 | <p> Set and get the position of the cursor with <a href="#setCursorPosition">setCursorPosition</a>()
|
---|
| 492 | and <a href="#getCursorPosition">getCursorPosition</a>() respectively. When the cursor is moved,
|
---|
| 493 | the signals <a href="#currentFontChanged">currentFontChanged</a>(), <a href="#currentColorChanged">currentColorChanged</a>() and
|
---|
| 494 | <a href="#currentAlignmentChanged">currentAlignmentChanged</a>() are emitted to reflect the font, color
|
---|
| 495 | and alignment at the new cursor position.
|
---|
| 496 | <p> If the text changes, the <a href="#textChanged">textChanged</a>() signal is emitted, and if
|
---|
| 497 | the user inserts a new line by pressing Return or Enter,
|
---|
| 498 | <a href="#returnPressed">returnPressed</a>() is emitted. The <a href="#isModified">isModified</a>() function will return
|
---|
| 499 | TRUE if the text has been modified.
|
---|
| 500 | <p> QTextEdit provides command-based undo and redo. To set the depth
|
---|
| 501 | of the command history use <a href="#setUndoDepth">setUndoDepth</a>() which defaults to 100
|
---|
| 502 | steps. To undo or redo the last operation call <a href="#undo">undo</a>() or <a href="#redo">redo</a>().
|
---|
| 503 | The signals <a href="#undoAvailable">undoAvailable</a>() and <a href="#redoAvailable">redoAvailable</a>() indicate whether
|
---|
| 504 | the undo and redo operations can be executed.
|
---|
| 505 | <p> The indent() function is used to reindent a paragraph. It is
|
---|
| 506 | 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()
|
---|
| 507 | function.
|
---|
| 508 | <p> <h4> Editing key bindings
|
---|
| 509 | </h4>
|
---|
| 510 | <a name="1-2-1"></a><p> The list of key-bindings which are implemented for editing:
|
---|
| 511 | <center><table cellpadding="4" cellspacing="2" border="0">
|
---|
| 512 | <tr bgcolor="#a2c511"> <th valign="top">Keypresses <th valign="top">Action
|
---|
| 513 | <tr bgcolor="#f0f0f0"> <td valign="top">Backspace <td valign="top">Delete the character to the left of the cursor
|
---|
| 514 | <tr bgcolor="#d0d0d0"> <td valign="top">Delete <td valign="top">Delete the character to the right of the cursor
|
---|
| 515 | <tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+A <td valign="top">Move the cursor to the beginning of the line
|
---|
| 516 | <tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+B <td valign="top">Move the cursor one character left
|
---|
| 517 | <tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+C <td valign="top">Copy the marked text to the clipboard (also
|
---|
| 518 | Ctrl+Insert under Windows)
|
---|
| 519 | <tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+D <td valign="top">Delete the character to the right of the cursor
|
---|
| 520 | <tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+E <td valign="top">Move the cursor to the end of the line
|
---|
| 521 | <tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+F <td valign="top">Move the cursor one character right
|
---|
| 522 | <tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+H <td valign="top">Delete the character to the left of the cursor
|
---|
| 523 | <tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+K <td valign="top">Delete to end of line
|
---|
| 524 | <tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+N <td valign="top">Move the cursor one line down
|
---|
| 525 | <tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+P <td valign="top">Move the cursor one line up
|
---|
| 526 | <tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+V <td valign="top">Paste the clipboard text into line edit
|
---|
| 527 | (also Shift+Insert under Windows)
|
---|
| 528 | <tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+X <td valign="top">Cut the marked text, copy to clipboard
|
---|
| 529 | (also Shift+Delete under Windows)
|
---|
| 530 | <tr bgcolor="#f0f0f0"> <td valign="top">Ctrl+Z <td valign="top">Undo the last operation
|
---|
| 531 | <tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+Y <td valign="top">Redo the last operation
|
---|
| 532 | <tr bgcolor="#f0f0f0"> <td valign="top">LeftArrow <td valign="top">Move the cursor one character left
|
---|
| 533 | <tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+LeftArrow <td valign="top">Move the cursor one word left
|
---|
| 534 | <tr bgcolor="#f0f0f0"> <td valign="top">RightArrow <td valign="top">Move the cursor one character right
|
---|
| 535 | <tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+RightArrow <td valign="top">Move the cursor one word right
|
---|
| 536 | <tr bgcolor="#f0f0f0"> <td valign="top">UpArrow <td valign="top">Move the cursor one line up
|
---|
| 537 | <tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+UpArrow <td valign="top">Move the cursor one word up
|
---|
| 538 | <tr bgcolor="#f0f0f0"> <td valign="top">DownArrow <td valign="top">Move the cursor one line down
|
---|
| 539 | <tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+Down Arrow <td valign="top">Move the cursor one word down
|
---|
| 540 | <tr bgcolor="#f0f0f0"> <td valign="top">PageUp <td valign="top">Move the cursor one page up
|
---|
| 541 | <tr bgcolor="#d0d0d0"> <td valign="top">PageDown <td valign="top">Move the cursor one page down
|
---|
| 542 | <tr bgcolor="#f0f0f0"> <td valign="top">Home <td valign="top">Move the cursor to the beginning of the line
|
---|
| 543 | <tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+Home <td valign="top">Move the cursor to the beginning of the text
|
---|
| 544 | <tr bgcolor="#f0f0f0"> <td valign="top">End <td valign="top">Move the cursor to the end of the line
|
---|
| 545 | <tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+End <td valign="top">Move the cursor to the end of the text
|
---|
| 546 | <tr bgcolor="#f0f0f0"> <td valign="top">Shift+Wheel <td valign="top">Scroll the page horizontally
|
---|
| 547 | (the Wheel is the mouse wheel)
|
---|
| 548 | <tr bgcolor="#d0d0d0"> <td valign="top">Ctrl+Wheel <td valign="top">Zoom the text
|
---|
| 549 | </table></center>
|
---|
| 550 | <p> To select (mark) text hold down the Shift key whilst pressing one
|
---|
| 551 | of the movement keystrokes, for example, <em>Shift+Right Arrow</em>
|
---|
| 552 | will select the character to the right, and <em>Shift+Ctrl+Right Arrow</em> will select the word to the right, etc.
|
---|
| 553 | <p> By default the text edit widget operates in insert mode so all
|
---|
| 554 | text that the user enters is inserted into the text edit and any
|
---|
| 555 | text to the right of the cursor is moved out of the way. The mode
|
---|
| 556 | can be changed to overwrite, where new text overwrites any text to
|
---|
| 557 | the right of the cursor, using <a href="#setOverwriteMode">setOverwriteMode</a>().
|
---|
| 558 | <p>See also <a href="basic.html">Basic Widgets</a> and <a href="text.html">Text Related Classes</a>.
|
---|
| 559 |
|
---|
| 560 | <hr><h2>Member Type Documentation</h2>
|
---|
| 561 | <h3 class=fn><a name="AutoFormatting-enum"></a>QTextEdit::AutoFormatting</h3>
|
---|
| 562 |
|
---|
| 563 | <ul>
|
---|
| 564 | <li><tt>QTextEdit::AutoNone</tt> - Do not perform any automatic formatting
|
---|
| 565 | <li><tt>QTextEdit::AutoBulletList</tt> - Only automatically format bulletted lists
|
---|
| 566 | <li><tt>QTextEdit::AutoAll</tt> - Apply all available autoformatting
|
---|
| 567 | </ul>
|
---|
| 568 | <h3 class=fn><a name="CursorAction-enum"></a>QTextEdit::CursorAction</h3>
|
---|
| 569 |
|
---|
| 570 | <p> This enum is used by <a href="#moveCursor">moveCursor</a>() to specify in which direction
|
---|
| 571 | the cursor should be moved:
|
---|
| 572 | <ul>
|
---|
| 573 | <li><tt>QTextEdit::MoveBackward</tt> - Moves the cursor one character backward
|
---|
| 574 | <li><tt>QTextEdit::MoveWordBackward</tt> - Moves the cursor one word backward
|
---|
| 575 | <li><tt>QTextEdit::MoveForward</tt> - Moves the cursor one character forward
|
---|
| 576 | <li><tt>QTextEdit::MoveWordForward</tt> - Moves the cursor one word forward
|
---|
| 577 | <li><tt>QTextEdit::MoveUp</tt> - Moves the cursor up one line
|
---|
| 578 | <li><tt>QTextEdit::MoveDown</tt> - Moves the cursor down one line
|
---|
| 579 | <li><tt>QTextEdit::MoveLineStart</tt> - Moves the cursor to the beginning of the line
|
---|
| 580 | <li><tt>QTextEdit::MoveLineEnd</tt> - Moves the cursor to the end of the line
|
---|
| 581 | <li><tt>QTextEdit::MoveHome</tt> - Moves the cursor to the beginning of the document
|
---|
| 582 | <li><tt>QTextEdit::MoveEnd</tt> - Moves the cursor to the end of the document
|
---|
| 583 | <li><tt>QTextEdit::MovePgUp</tt> - Moves the cursor one viewport page up
|
---|
| 584 | <li><tt>QTextEdit::MovePgDown</tt> - Moves the cursor one viewport page down
|
---|
| 585 | </ul>
|
---|
| 586 | <h3 class=fn><a name="KeyboardAction-enum"></a>QTextEdit::KeyboardAction</h3>
|
---|
| 587 |
|
---|
| 588 | <p> This enum is used by <a href="#doKeyboardAction">doKeyboardAction</a>() to specify which action
|
---|
| 589 | should be executed:
|
---|
| 590 | <ul>
|
---|
| 591 | <li><tt>QTextEdit::ActionBackspace</tt> - Delete the character to the left of the
|
---|
| 592 | cursor.
|
---|
| 593 | <li><tt>QTextEdit::ActionDelete</tt> - Delete the character to the right of the
|
---|
| 594 | cursor.
|
---|
| 595 | <li><tt>QTextEdit::ActionReturn</tt> - Split the paragraph at the cursor position.
|
---|
| 596 | <li><tt>QTextEdit::ActionKill</tt> - If the cursor is not at the end of the
|
---|
| 597 | paragraph, delete the text from the cursor position until the end
|
---|
| 598 | of the paragraph. If the cursor is at the end of the paragraph,
|
---|
| 599 | delete the hard line break at the end of the paragraph: this will
|
---|
| 600 | cause this paragraph to be joined with the following paragraph.
|
---|
| 601 | <li><tt>QTextEdit::ActionWordBackspace</tt> - Delete the word to the left of the
|
---|
| 602 | cursor position.
|
---|
| 603 | <li><tt>QTextEdit::ActionWordDelete</tt> - Delete the word to the right of the
|
---|
| 604 | cursor position
|
---|
| 605 | </ul><p>
|
---|
| 606 | <h3 class=fn><a name="VerticalAlignment-enum"></a>QTextEdit::VerticalAlignment</h3>
|
---|
| 607 |
|
---|
| 608 | <p> This enum is used to set the vertical alignment of the text.
|
---|
| 609 | <ul>
|
---|
| 610 | <li><tt>QTextEdit::AlignNormal</tt> - Normal alignment
|
---|
| 611 | <li><tt>QTextEdit::AlignSuperScript</tt> - Superscript
|
---|
| 612 | <li><tt>QTextEdit::AlignSubScript</tt> - Subscript
|
---|
| 613 | </ul>
|
---|
| 614 | <h3 class=fn><a name="WordWrap-enum"></a>QTextEdit::WordWrap</h3>
|
---|
| 615 |
|
---|
| 616 | <p> This enum defines the QTextEdit's word wrap modes.
|
---|
| 617 | <ul>
|
---|
| 618 | <li><tt>QTextEdit::NoWrap</tt> - Do not wrap the text.
|
---|
| 619 | <li><tt>QTextEdit::WidgetWidth</tt> - Wrap the text at the current width of the
|
---|
| 620 | widget (this is the default). Wrapping is at whitespace by
|
---|
| 621 | default; this can be changed with <a href="#setWrapPolicy">setWrapPolicy</a>().
|
---|
| 622 | <li><tt>QTextEdit::FixedPixelWidth</tt> - Wrap the text at a fixed number of pixels
|
---|
| 623 | from the widget's left side. The number of pixels is set with
|
---|
| 624 | <a href="#wrapColumnOrWidth">wrapColumnOrWidth</a>().
|
---|
| 625 | <li><tt>QTextEdit::FixedColumnWidth</tt> - Wrap the text at a fixed number of
|
---|
| 626 | character columns from the widget's left side. The number of
|
---|
| 627 | characters is set with wrapColumnOrWidth(). This is useful if you
|
---|
| 628 | need formatted text that can also be displayed gracefully on
|
---|
| 629 | devices with monospaced fonts, for example a standard VT100
|
---|
| 630 | terminal, where you might set wrapColumnOrWidth() to 80.
|
---|
| 631 | </ul><p> <p>See also <a href="#wordWrap-prop">wordWrap</a> and <a href="#wordWrap-prop">wordWrap</a>.
|
---|
| 632 |
|
---|
| 633 | <h3 class=fn><a name="WrapPolicy-enum"></a>QTextEdit::WrapPolicy</h3>
|
---|
| 634 |
|
---|
| 635 | <p> This enum defines where text can be wrapped in word wrap mode.
|
---|
| 636 | <ul>
|
---|
| 637 | <li><tt>QTextEdit::AtWhiteSpace</tt> - Don't use this deprecated value (it is a
|
---|
| 638 | synonym for <a href="#WrapPolicy-enum">AtWordBoundary</a> which you should use instead).
|
---|
| 639 | <li><tt>QTextEdit::Anywhere</tt> - Break anywhere, including within words.
|
---|
| 640 | <li><tt>QTextEdit::AtWordBoundary</tt> - Break lines at word boundaries, e.g. spaces or
|
---|
| 641 | newlines
|
---|
| 642 | <li><tt>QTextEdit::AtWordOrDocumentBoundary</tt> - Break lines at whitespace, e.g.
|
---|
| 643 | spaces or newlines if possible. Break it anywhere otherwise.
|
---|
| 644 | </ul><p> <p>See also <a href="#wrapPolicy-prop">wrapPolicy</a>.
|
---|
| 645 |
|
---|
| 646 | <hr><h2>Member Function Documentation</h2>
|
---|
| 647 | <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 )
|
---|
| 648 | </h3>
|
---|
| 649 | Constructs a QTextEdit called <em>name</em>, with parent <em>parent</em>. The
|
---|
| 650 | text edit will display the text <em>text</em> using context <em>context</em>.
|
---|
| 651 | <p> The <em>context</em> is a path which the text edit's <a href="qmimesourcefactory.html">QMimeSourceFactory</a>
|
---|
| 652 | uses to resolve the locations of files and images. It is passed to
|
---|
| 653 | the <a href="#mimeSourceFactory">mimeSourceFactory</a>() when quering data.
|
---|
| 654 | <p> For example if the text contains an image tag,
|
---|
| 655 | <tt><img src="image.png"></tt>, and the context is "path/to/look/in", the
|
---|
| 656 | QMimeSourceFactory will try to load the image from
|
---|
| 657 | "path/to/look/in/image.png". If the tag was
|
---|
| 658 | <tt><img src="/image.png"></tt>, the context will not be used (because
|
---|
| 659 | QMimeSourceFactory recognizes that we have used an absolute path)
|
---|
| 660 | and will try to load "/image.png". The context is applied in exactly
|
---|
| 661 | the same way to <em>hrefs</em>, for example,
|
---|
| 662 | <tt><a href="target.html">Target</a></tt>, would resolve to
|
---|
| 663 | "path/to/look/in/target.html".
|
---|
| 664 |
|
---|
| 665 | <h3 class=fn><a name="QTextEdit-2"></a>QTextEdit::QTextEdit ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0 )
|
---|
| 666 | </h3>
|
---|
| 667 | Constructs an empty QTextEdit called <em>name</em>, with parent <em>parent</em>.
|
---|
| 668 |
|
---|
| 669 | <h3 class=fn>int <a name="alignment"></a>QTextEdit::alignment () const
|
---|
| 670 | </h3>
|
---|
| 671 | Returns the alignment of the current paragraph.
|
---|
| 672 | <p> <p>See also <a href="#setAlignment">setAlignment</a>().
|
---|
| 673 |
|
---|
| 674 | <h3 class=fn><a href="qstring.html">QString</a> <a name="anchorAt"></a>QTextEdit::anchorAt ( const <a href="qpoint.html">QPoint</a> & pos, <a href="qt.html#AnchorAttribute-enum">AnchorAttribute</a> attr )
|
---|
| 675 | </h3>
|
---|
| 676 | If there is an anchor at position <em>pos</em> (in contents
|
---|
| 677 | coordinates), the text for attribute <em>attr</em> is returned,
|
---|
| 678 | otherwise <a href="qstring.html#QString-null">QString::null</a> is returned.
|
---|
| 679 |
|
---|
| 680 | <h3 class=fn><a href="qstring.html">QString</a> <a name="anchorAt-2"></a>QTextEdit::anchorAt ( const <a href="qpoint.html">QPoint</a> & pos )
|
---|
| 681 | </h3>
|
---|
| 682 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 683 | <p> If there is an anchor at position <em>pos</em> (in contents
|
---|
| 684 | coordinates), its <tt>href</tt> is returned, otherwise <a href="qstring.html#QString-null">QString::null</a> is
|
---|
| 685 | returned.
|
---|
| 686 |
|
---|
| 687 | <h3 class=fn>void <a name="append"></a>QTextEdit::append ( const <a href="qstring.html">QString</a> & text )<tt> [virtual slot]</tt>
|
---|
| 688 | </h3>
|
---|
| 689 | Appends a new paragraph with <em>text</em> to the end of the text edit. Note that
|
---|
| 690 | the undo/redo history is cleared by this function, and no undo
|
---|
| 691 | history is kept for appends which makes them faster than
|
---|
| 692 | <a href="#insert">insert</a>()s. If you want to append text which is added to the
|
---|
| 693 | undo/redo history as well, use <a href="#insertParagraph">insertParagraph</a>().
|
---|
| 694 |
|
---|
| 695 | <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>.
|
---|
| 696 | <h3 class=fn>uint <a name="autoFormatting"></a>QTextEdit::autoFormatting () const
|
---|
| 697 | </h3><p>Returns the enabled set of auto formatting features.
|
---|
| 698 | See the <a href="qtextedit.html#autoFormatting-prop">"autoFormatting"</a> property for details.
|
---|
| 699 | <h3 class=fn>bool <a name="bold"></a>QTextEdit::bold () const
|
---|
| 700 | </h3>
|
---|
| 701 | Returns TRUE if the current format is bold; otherwise returns FALSE.
|
---|
| 702 | <p> <p>See also <a href="#setBold">setBold</a>().
|
---|
| 703 |
|
---|
| 704 | <h3 class=fn>int <a name="charAt"></a>QTextEdit::charAt ( const <a href="qpoint.html">QPoint</a> & pos, int * para ) const
|
---|
| 705 | </h3>
|
---|
| 706 | Returns the index of the character (relative to its paragraph) at
|
---|
| 707 | position <em>pos</em> (in contents coordinates). If <em>para</em> is not 0,
|
---|
| 708 | <em>*para</em> is set to the character's paragraph.
|
---|
| 709 |
|
---|
| 710 | <h3 class=fn>void <a name="clear"></a>QTextEdit::clear ()<tt> [virtual slot]</tt>
|
---|
| 711 | </h3>
|
---|
| 712 | Deletes all the text in the text edit.
|
---|
| 713 | <p> <p>See also <a href="#cut">cut</a>(), <a href="#removeSelectedText">removeSelectedText</a>(), and <a href="#text-prop">text</a>.
|
---|
| 714 |
|
---|
| 715 | <h3 class=fn>void <a name="clearParagraphBackground"></a>QTextEdit::clearParagraphBackground ( int para )<tt> [virtual slot]</tt>
|
---|
| 716 | </h3>
|
---|
| 717 | Clears the background color of the paragraph <em>para</em>, so that the
|
---|
| 718 | default color is used again.
|
---|
| 719 |
|
---|
| 720 | <h3 class=fn>void <a name="clicked"></a>QTextEdit::clicked ( int para, int pos )<tt> [signal]</tt>
|
---|
| 721 | </h3>
|
---|
| 722 |
|
---|
| 723 | <p> This signal is emitted when the mouse is clicked on the paragraph
|
---|
| 724 | <em>para</em> at character position <em>pos</em>.
|
---|
| 725 | <p> <p>See also <a href="#doubleClicked">doubleClicked</a>().
|
---|
| 726 |
|
---|
| 727 | <h3 class=fn><a href="qcolor.html">QColor</a> <a name="color"></a>QTextEdit::color () const
|
---|
| 728 | </h3>
|
---|
| 729 | Returns the color of the current format.
|
---|
| 730 | <p> <p>See also <a href="#setColor">setColor</a>() and <a href="#paper-prop">paper</a>.
|
---|
| 731 |
|
---|
| 732 | <h3 class=fn><a href="qstring.html">QString</a> <a name="context"></a>QTextEdit::context () const
|
---|
| 733 | </h3>
|
---|
| 734 | Returns the context of the text edit. The context is a path which
|
---|
| 735 | the text edit's <a href="qmimesourcefactory.html">QMimeSourceFactory</a> uses to resolve the locations
|
---|
| 736 | of files and images.
|
---|
| 737 | <p> <p>See also <a href="#text-prop">text</a>.
|
---|
| 738 |
|
---|
| 739 | <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>.
|
---|
| 740 | <h3 class=fn>void <a name="copy"></a>QTextEdit::copy ()<tt> [virtual slot]</tt>
|
---|
| 741 | </h3>
|
---|
| 742 | Copies any selected text (from selection 0) to the clipboard.
|
---|
| 743 | <p> <p>See also <a href="#hasSelectedText-prop">hasSelectedText</a> and <a href="#copyAvailable">copyAvailable</a>().
|
---|
| 744 |
|
---|
| 745 | <h3 class=fn>void <a name="copyAvailable"></a>QTextEdit::copyAvailable ( bool yes )<tt> [signal]</tt>
|
---|
| 746 | </h3>
|
---|
| 747 |
|
---|
| 748 | <p> This signal is emitted when text is selected or de-selected in the
|
---|
| 749 | text edit.
|
---|
| 750 | <p> When text is selected this signal will be emitted with <em>yes</em> set
|
---|
| 751 | to TRUE. If no text has been selected or if the selected text is
|
---|
| 752 | de-selected this signal is emitted with <em>yes</em> set to FALSE.
|
---|
| 753 | <p> If <em>yes</em> is TRUE then <a href="#copy">copy</a>() can be used to copy the selection to
|
---|
| 754 | the clipboard. If <em>yes</em> is FALSE then copy() does nothing.
|
---|
| 755 | <p> <p>See also <a href="#selectionChanged">selectionChanged</a>().
|
---|
| 756 |
|
---|
| 757 | <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>
|
---|
| 758 | </h3>
|
---|
| 759 | This function is called to create a right mouse button popup menu
|
---|
| 760 | at the document position <em>pos</em>. If you want to create a custom
|
---|
| 761 | popup menu, reimplement this function and return the created popup
|
---|
| 762 | menu. Ownership of the popup menu is transferred to the caller.
|
---|
| 763 | <p> <b>Warning:</b> The <a href="qpopupmenu.html">QPopupMenu</a> ID values 0-7 are reserved, and they map to the
|
---|
| 764 | standard operations. When inserting items into your custom popup menu, be
|
---|
| 765 | sure to specify ID values larger than 7.
|
---|
| 766 |
|
---|
| 767 | <h3 class=fn><a href="qpopupmenu.html">QPopupMenu</a> * <a name="createPopupMenu-2"></a>QTextEdit::createPopupMenu ()<tt> [virtual protected]</tt>
|
---|
| 768 | </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 769 | <p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
| 770 | <p> This function is called to create a right mouse button popup menu.
|
---|
| 771 | If you want to create a custom popup menu, reimplement this function
|
---|
| 772 | and return the created popup menu. Ownership of the popup menu is
|
---|
| 773 | transferred to the caller.
|
---|
| 774 | <p> This function is only called if <a href="#createPopupMenu">createPopupMenu</a>( const <a href="qpoint.html">QPoint</a> & )
|
---|
| 775 | returns 0.
|
---|
| 776 |
|
---|
| 777 | <h3 class=fn>void <a name="currentAlignmentChanged"></a>QTextEdit::currentAlignmentChanged ( int a )<tt> [signal]</tt>
|
---|
| 778 | </h3>
|
---|
| 779 |
|
---|
| 780 | <p> This signal is emitted if the alignment of the current paragraph
|
---|
| 781 | has changed.
|
---|
| 782 | <p> The new alignment is <em>a</em>.
|
---|
| 783 | <p> <p>See also <a href="#setAlignment">setAlignment</a>().
|
---|
| 784 |
|
---|
| 785 | <h3 class=fn>void <a name="currentColorChanged"></a>QTextEdit::currentColorChanged ( const <a href="qcolor.html">QColor</a> & c )<tt> [signal]</tt>
|
---|
| 786 | </h3>
|
---|
| 787 |
|
---|
| 788 | <p> This signal is emitted if the color of the current format has
|
---|
| 789 | changed.
|
---|
| 790 | <p> The new color is <em>c</em>.
|
---|
| 791 | <p> <p>See also <a href="#setColor">setColor</a>().
|
---|
| 792 |
|
---|
| 793 | <h3 class=fn><a href="qfont.html">QFont</a> <a name="currentFont"></a>QTextEdit::currentFont () const
|
---|
| 794 | </h3>
|
---|
| 795 | Returns the font of the current format.
|
---|
| 796 | <p> <p>See also <a href="#setCurrentFont">setCurrentFont</a>(), <a href="#setFamily">setFamily</a>(), and <a href="#setPointSize">setPointSize</a>().
|
---|
| 797 |
|
---|
| 798 | <h3 class=fn>void <a name="currentFontChanged"></a>QTextEdit::currentFontChanged ( const <a href="qfont.html">QFont</a> & f )<tt> [signal]</tt>
|
---|
| 799 | </h3>
|
---|
| 800 |
|
---|
| 801 | <p> This signal is emitted if the font of the current format has
|
---|
| 802 | changed.
|
---|
| 803 | <p> The new font is <em>f</em>.
|
---|
| 804 | <p> <p>See also <a href="#setCurrentFont">setCurrentFont</a>().
|
---|
| 805 |
|
---|
| 806 | <h3 class=fn>void <a name="currentVerticalAlignmentChanged"></a>QTextEdit::currentVerticalAlignmentChanged ( <a href="qtextedit.html#VerticalAlignment-enum">VerticalAlignment</a> a )<tt> [signal]</tt>
|
---|
| 807 | </h3>
|
---|
| 808 |
|
---|
| 809 | <p> This signal is emitted if the vertical alignment of the current
|
---|
| 810 | format has changed.
|
---|
| 811 | <p> The new vertical alignment is <em>a</em>.
|
---|
| 812 | <p> <p>See also <a href="#setVerticalAlignment">setVerticalAlignment</a>().
|
---|
| 813 |
|
---|
| 814 | <h3 class=fn>void <a name="cursorPositionChanged"></a>QTextEdit::cursorPositionChanged ( int para, int pos )<tt> [signal]</tt>
|
---|
| 815 | </h3>
|
---|
| 816 |
|
---|
| 817 | <p> This signal is emitted if the position of the cursor has changed.
|
---|
| 818 | <em>para</em> contains the paragraph index and <em>pos</em> contains the
|
---|
| 819 | character position within the paragraph.
|
---|
| 820 | <p> <p>See also <a href="#setCursorPosition">setCursorPosition</a>().
|
---|
| 821 |
|
---|
| 822 | <h3 class=fn>void <a name="cut"></a>QTextEdit::cut ()<tt> [virtual slot]</tt>
|
---|
| 823 | </h3>
|
---|
| 824 | Copies the selected text (from selection 0) to the clipboard and
|
---|
| 825 | deletes it from the text edit.
|
---|
| 826 | <p> If there is no selected text (in selection 0) nothing happens.
|
---|
| 827 | <p> <p>See also <a href="#copy">QTextEdit::copy</a>(), <a href="#paste">paste</a>(), and <a href="#pasteSubType">pasteSubType</a>().
|
---|
| 828 |
|
---|
| 829 | <h3 class=fn>void <a name="del"></a>QTextEdit::del ()<tt> [virtual slot]</tt>
|
---|
| 830 | </h3>
|
---|
| 831 | If there is some selected text (in selection 0) it is deleted. If
|
---|
| 832 | there is no selected text (in selection 0) the character to the
|
---|
| 833 | right of the text cursor is deleted.
|
---|
| 834 | <p> <p>See also <a href="#removeSelectedText">removeSelectedText</a>() and <a href="#cut">cut</a>().
|
---|
| 835 |
|
---|
| 836 | <h3 class=fn>void <a name="doKeyboardAction"></a>QTextEdit::doKeyboardAction ( <a href="qtextedit.html#KeyboardAction-enum">KeyboardAction</a> action )<tt> [virtual slot]</tt>
|
---|
| 837 | </h3>
|
---|
| 838 | Executes keyboard action <em>action</em>. This is normally called by a
|
---|
| 839 | key event handler.
|
---|
| 840 |
|
---|
| 841 | <h3 class=fn><a href="qstring.html">QString</a> <a name="documentTitle"></a>QTextEdit::documentTitle () const
|
---|
| 842 | </h3><p>Returns the title of the document parsed from the text.
|
---|
| 843 | See the <a href="qtextedit.html#documentTitle-prop">"documentTitle"</a> property for details.
|
---|
| 844 | <h3 class=fn>void <a name="doubleClicked"></a>QTextEdit::doubleClicked ( int para, int pos )<tt> [signal]</tt>
|
---|
| 845 | </h3>
|
---|
| 846 | <p> This signal is emitted when the mouse is double-clicked on the
|
---|
| 847 | paragraph <em>para</em> at character position <em>pos</em>.
|
---|
| 848 | <p> <p>See also <a href="#clicked">clicked</a>().
|
---|
| 849 |
|
---|
| 850 | <h3 class=fn>void <a name="ensureCursorVisible"></a>QTextEdit::ensureCursorVisible ()<tt> [virtual slot]</tt>
|
---|
| 851 | </h3>
|
---|
| 852 | Ensures that the cursor is visible by scrolling the text edit if
|
---|
| 853 | necessary.
|
---|
| 854 | <p> <p>See also <a href="#setCursorPosition">setCursorPosition</a>().
|
---|
| 855 |
|
---|
| 856 | <h3 class=fn><a href="qstring.html">QString</a> <a name="family"></a>QTextEdit::family () const
|
---|
| 857 | </h3>
|
---|
| 858 | Returns the font family of the current format.
|
---|
| 859 | <p> <p>See also <a href="#setFamily">setFamily</a>(), <a href="#setCurrentFont">setCurrentFont</a>(), and <a href="#setPointSize">setPointSize</a>().
|
---|
| 860 |
|
---|
| 861 | <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>
|
---|
| 862 | </h3>
|
---|
| 863 | Finds the next occurrence of the string, <em>expr</em>. Returns TRUE if
|
---|
| 864 | <em>expr</em> was found; otherwise returns FALSE.
|
---|
| 865 | <p> If <em>para</em> and <em>index</em> are both 0 the search begins from the
|
---|
| 866 | current cursor position. If <em>para</em> and <em>index</em> are both not 0,
|
---|
| 867 | the search begins from the <em>*index</em> character position in the
|
---|
| 868 | <em>*para</em> paragraph.
|
---|
| 869 | <p> If <em>cs</em> is TRUE the search is case sensitive, otherwise it is
|
---|
| 870 | case insensitive. If <em>wo</em> is TRUE the search looks for whole word
|
---|
| 871 | matches only; otherwise it searches for any matching text. If <em>forward</em> is TRUE (the default) the search works forward from the
|
---|
| 872 | starting position to the end of the text, otherwise it works
|
---|
| 873 | backwards to the beginning of the text.
|
---|
| 874 | <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
|
---|
| 875 | character of the match was found is put into <em>*para</em>, and the
|
---|
| 876 | index position of that character within the paragraph is put into
|
---|
| 877 | <em>*index</em>.
|
---|
| 878 | <p> If <em>expr</em> is not found the function returns FALSE. If <em>index</em>
|
---|
| 879 | and <em>para</em> are not 0 and <em>expr</em> is not found, <em>*index</em>
|
---|
| 880 | and <em>*para</em> are undefined.
|
---|
| 881 | <p> Please note that this function will make the next occurrence of
|
---|
| 882 | the string (if found) the current selection, and will thus
|
---|
| 883 | modify the cursor position.
|
---|
| 884 | <p> Using the <em>para</em> and <em>index</em> parameters will not work correctly
|
---|
| 885 | in case the document contains tables.
|
---|
| 886 |
|
---|
| 887 | <h3 class=fn>bool <a name="focusNextPrevChild"></a>QTextEdit::focusNextPrevChild ( bool n )<tt> [virtual protected]</tt>
|
---|
| 888 | </h3>
|
---|
| 889 | Reimplemented to allow tabbing through links. If <em>n</em> is TRUE the
|
---|
| 890 | tab moves the focus to the next child; if <em>n</em> is FALSE the tab
|
---|
| 891 | moves the focus to the previous child. Returns TRUE if the focus
|
---|
| 892 | was moved; otherwise returns FALSE.
|
---|
| 893 |
|
---|
| 894 | <h3 class=fn><a href="qfont.html">QFont</a> <a name="font"></a>QTextEdit::font () const
|
---|
| 895 | </h3>
|
---|
| 896 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
| 897 | <p> Returns <a href="qwidget.html#font">QScrollView::font</a>()
|
---|
| 898 | <p> <b>Warning:</b> In previous versions this function returned the font of
|
---|
| 899 | the current format. This lead to confusion. Please use
|
---|
| 900 | <a href="#currentFont">currentFont</a>() instead.
|
---|
| 901 |
|
---|
| 902 | <p>Example: <a href="qwerty-example.html#x396">qwerty/qwerty.cpp</a>.
|
---|
| 903 | <h3 class=fn>void <a name="getCursorPosition"></a>QTextEdit::getCursorPosition ( int * para, int * index ) const
|
---|
| 904 | </h3>
|
---|
| 905 | This function sets the <em>*para</em> and <em>*index</em> parameters to the
|
---|
| 906 | current cursor position. <em>para</em> and <em>index</em> must not be 0.
|
---|
| 907 | <p> <p>See also <a href="#setCursorPosition">setCursorPosition</a>().
|
---|
| 908 |
|
---|
| 909 | <h3 class=fn>void <a name="getSelection"></a>QTextEdit::getSelection ( int * paraFrom, int * indexFrom, int * paraTo, int * indexTo, int selNum = 0 ) const
|
---|
| 910 | </h3>
|
---|
| 911 | If there is a selection, <em>*paraFrom</em> is set to the number of the
|
---|
| 912 | paragraph in which the selection begins and <em>*paraTo</em> is set to
|
---|
| 913 | the number of the paragraph in which the selection ends. (They
|
---|
| 914 | could be the same.) <em>*indexFrom</em> is set to the index at which the
|
---|
| 915 | selection begins within <em>*paraFrom</em>, and <em>*indexTo</em> is set to
|
---|
| 916 | the index at which the selection ends within <em>*paraTo</em>.
|
---|
| 917 | <p> If there is no selection, <em>*paraFrom</em>, <em>*indexFrom</em>, <em>*paraTo</em>
|
---|
| 918 | and <em>*indexTo</em> are all set to -1.
|
---|
| 919 | <p> If <em>paraFrom</em>, <em>indexFrom</em>, <em>paraTo</em> or <em>indexTo</em> is 0 this
|
---|
| 920 | function does nothing.
|
---|
| 921 | <p> The <em>selNum</em> is the number of the selection (multiple selections
|
---|
| 922 | are supported). It defaults to 0 (the default selection).
|
---|
| 923 | <p> <p>See also <a href="#setSelection">setSelection</a>() and <a href="#selectedText-prop">selectedText</a>.
|
---|
| 924 |
|
---|
| 925 | <h3 class=fn>bool <a name="hasSelectedText"></a>QTextEdit::hasSelectedText () const
|
---|
| 926 | </h3><p>Returns TRUE if some text is selected in selection 0; otherwise returns FALSE.
|
---|
| 927 | See the <a href="qtextedit.html#hasSelectedText-prop">"hasSelectedText"</a> property for details.
|
---|
| 928 | <h3 class=fn>int <a name="heightForWidth"></a>QTextEdit::heightForWidth ( int w ) const<tt> [virtual]</tt>
|
---|
| 929 | </h3>
|
---|
| 930 | Returns how many pixels high the text edit needs to be to display
|
---|
| 931 | all the text if the text edit is <em>w</em> pixels wide.
|
---|
| 932 |
|
---|
| 933 | <p>Reimplemented from <a href="qwidget.html#heightForWidth">QWidget</a>.
|
---|
| 934 | <h3 class=fn>void <a name="insert"></a>QTextEdit::insert ( const <a href="qstring.html">QString</a> & text, uint insertionFlags = CheckNewLines | RemoveSelected )<tt> [slot]</tt>
|
---|
| 935 | </h3>
|
---|
| 936 | Inserts <em>text</em> at the current cursor position.
|
---|
| 937 | <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
|
---|
| 938 | line breaks (i.e. new paragraphs). If <tt>checkNewLine</tt> is not set,
|
---|
| 939 | the behaviour of the editor is undefined if the <em>text</em> contains
|
---|
| 940 | newlines. (It is not possible to change QTextEdit's newline handling
|
---|
| 941 | behavior, but you can use <a href="qstring.html#replace">QString::replace</a>() to preprocess text
|
---|
| 942 | before inserting it.) If <a href="#TextInsertionFlags-enum">RemoveSelected</a> is set, any selected
|
---|
| 943 | text (in selection 0) is removed before the text is inserted.
|
---|
| 944 | <p> The default flags are <a href="#TextInsertionFlags-enum">CheckNewLines</a> | <a href="#TextInsertionFlags-enum">RemoveSelected</a>.
|
---|
| 945 | <p> If the widget is in <a href="qt.html#TextFormat-enum">LogText</a> mode this function will do nothing.
|
---|
| 946 | <p> <p>See also <a href="#paste">paste</a>() and <a href="#pasteSubType">pasteSubType</a>().
|
---|
| 947 |
|
---|
| 948 | <h3 class=fn>void <a name="insert-2"></a>QTextEdit::insert ( const <a href="qstring.html">QString</a> & text, bool indent, bool checkNewLine = TRUE, bool removeSelected = TRUE )<tt> [virtual slot]</tt>
|
---|
| 949 | </h3>
|
---|
| 950 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
| 951 | <p>
|
---|
| 952 | <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>
|
---|
| 953 | </h3>
|
---|
| 954 | Inserts <em>text</em> in the paragraph <em>para</em> at position <em>index</em>.
|
---|
| 955 |
|
---|
| 956 | <h3 class=fn>void <a name="insertParagraph"></a>QTextEdit::insertParagraph ( const <a href="qstring.html">QString</a> & text, int para )<tt> [virtual slot]</tt>
|
---|
| 957 | </h3>
|
---|
| 958 | Inserts <em>text</em> as a new paragraph at position <em>para</em>. If <em>para</em>
|
---|
| 959 | is -1, the text is appended. Use <a href="#append">append</a>() if the append operation
|
---|
| 960 | is performance critical.
|
---|
| 961 |
|
---|
| 962 | <h3 class=fn>bool <a name="isModified"></a>QTextEdit::isModified () const
|
---|
| 963 | </h3><p>Returns TRUE if the document has been modified by the user; otherwise returns FALSE.
|
---|
| 964 | See the <a href="qtextedit.html#modified-prop">"modified"</a> property for details.
|
---|
| 965 | <h3 class=fn>bool <a name="isOverwriteMode"></a>QTextEdit::isOverwriteMode () const
|
---|
| 966 | </h3><p>Returns the text edit's overwrite mode.
|
---|
| 967 | See the <a href="qtextedit.html#overwriteMode-prop">"overwriteMode"</a> property for details.
|
---|
| 968 | <h3 class=fn>bool <a name="isReadOnly"></a>QTextEdit::isReadOnly () const
|
---|
| 969 | </h3><p>Returns TRUE if the text edit is read-only; otherwise returns FALSE.
|
---|
| 970 | See the <a href="qtextedit.html#readOnly-prop">"readOnly"</a> property for details.
|
---|
| 971 | <h3 class=fn>bool <a name="isRedoAvailable"></a>QTextEdit::isRedoAvailable () const
|
---|
| 972 | </h3>
|
---|
| 973 | Returns TRUE if redo is available; otherwise returns FALSE.
|
---|
| 974 |
|
---|
| 975 | <h3 class=fn>bool <a name="isUndoAvailable"></a>QTextEdit::isUndoAvailable () const
|
---|
| 976 | </h3>
|
---|
| 977 | Returns TRUE if undo is available; otherwise returns FALSE.
|
---|
| 978 |
|
---|
| 979 | <h3 class=fn>bool <a name="isUndoRedoEnabled"></a>QTextEdit::isUndoRedoEnabled () const
|
---|
| 980 | </h3><p>Returns TRUE if undo/redo is enabled; otherwise returns FALSE.
|
---|
| 981 | See the <a href="qtextedit.html#undoRedoEnabled-prop">"undoRedoEnabled"</a> property for details.
|
---|
| 982 | <h3 class=fn>bool <a name="italic"></a>QTextEdit::italic () const
|
---|
| 983 | </h3>
|
---|
| 984 | Returns TRUE if the current format is italic; otherwise returns FALSE.
|
---|
| 985 | <p> <p>See also <a href="#setItalic">setItalic</a>().
|
---|
| 986 |
|
---|
| 987 | <h3 class=fn>void <a name="keyPressEvent"></a>QTextEdit::keyPressEvent ( <a href="qkeyevent.html">QKeyEvent</a> * e )<tt> [virtual protected]</tt>
|
---|
| 988 | </h3>
|
---|
| 989 | Processes the key event, <em>e</em>. By default key events are used to
|
---|
| 990 | provide keyboard navigation and text editing.
|
---|
| 991 |
|
---|
| 992 | <p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget</a>.
|
---|
| 993 | <p>Reimplemented in <a href="qtextbrowser.html#keyPressEvent">QTextBrowser</a>.
|
---|
| 994 | <h3 class=fn>int <a name="length"></a>QTextEdit::length () const
|
---|
| 995 | </h3><p>Returns the number of characters in the text.
|
---|
| 996 | See the <a href="qtextedit.html#length-prop">"length"</a> property for details.
|
---|
| 997 | <h3 class=fn>int <a name="lineOfChar"></a>QTextEdit::lineOfChar ( int para, int index )
|
---|
| 998 | </h3>
|
---|
| 999 | Returns the line number of the line in paragraph <em>para</em> in which
|
---|
| 1000 | the character at position <em>index</em> appears. The <em>index</em> position is
|
---|
| 1001 | relative to the beginning of the paragraph. If there is no such
|
---|
| 1002 | paragraph or no such character at the <em>index</em> position (e.g. the
|
---|
| 1003 | index is out of range) -1 is returned.
|
---|
| 1004 |
|
---|
| 1005 | <h3 class=fn>int <a name="lines"></a>QTextEdit::lines () const
|
---|
| 1006 | </h3>
|
---|
| 1007 | Returns the number of lines in the text edit; this could be 0.
|
---|
| 1008 | <p> <b>Warning:</b> This function may be slow. Lines change all the time
|
---|
| 1009 | during word wrapping, so this function has to iterate over all the
|
---|
| 1010 | paragraphs and get the number of lines from each one individually.
|
---|
| 1011 |
|
---|
| 1012 | <h3 class=fn>int <a name="linesOfParagraph"></a>QTextEdit::linesOfParagraph ( int para ) const
|
---|
| 1013 | </h3>
|
---|
| 1014 | Returns the number of lines in paragraph <em>para</em>, or -1 if there
|
---|
| 1015 | is no paragraph with index <em>para</em>.
|
---|
| 1016 |
|
---|
| 1017 | <h3 class=fn>bool <a name="linkUnderline"></a>QTextEdit::linkUnderline () const
|
---|
| 1018 | </h3><p>Returns TRUE if hypertext links will be underlined; otherwise returns FALSE.
|
---|
| 1019 | See the <a href="qtextedit.html#linkUnderline-prop">"linkUnderline"</a> property for details.
|
---|
| 1020 | <h3 class=fn>int <a name="maxLogLines"></a>QTextEdit::maxLogLines ()<tt> [slot]</tt>
|
---|
| 1021 | </h3>
|
---|
| 1022 | 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
|
---|
| 1023 | is signified by a value of -1.
|
---|
| 1024 |
|
---|
| 1025 | <h3 class=fn><a href="qmimesourcefactory.html">QMimeSourceFactory</a> * <a name="mimeSourceFactory"></a>QTextEdit::mimeSourceFactory () const
|
---|
| 1026 | </h3>
|
---|
| 1027 | Returns the <a href="qmimesourcefactory.html">QMimeSourceFactory</a> which is being used by this text
|
---|
| 1028 | edit.
|
---|
| 1029 | <p> <p>See also <a href="#setMimeSourceFactory">setMimeSourceFactory</a>().
|
---|
| 1030 |
|
---|
| 1031 | <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>.
|
---|
| 1032 | <h3 class=fn>void <a name="modificationChanged"></a>QTextEdit::modificationChanged ( bool m )<tt> [signal]</tt>
|
---|
| 1033 | </h3>
|
---|
| 1034 |
|
---|
| 1035 | <p> This signal is emitted when the modification status of the
|
---|
| 1036 | document has changed. If <em>m</em> is TRUE, the document was modified,
|
---|
| 1037 | otherwise the modification state has been reset to unmodified.
|
---|
| 1038 | <p> <p>See also <a href="#modified-prop">modified</a>.
|
---|
| 1039 |
|
---|
| 1040 | <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>
|
---|
| 1041 | </h3>
|
---|
| 1042 | Moves the text cursor according to <em>action</em>. This is normally
|
---|
| 1043 | used by some key event handler. <em>select</em> specifies whether the
|
---|
| 1044 | text between the current cursor position and the new position
|
---|
| 1045 | should be selected.
|
---|
| 1046 |
|
---|
| 1047 | <h3 class=fn><a href="qbrush.html">QBrush</a> <a name="paper"></a>QTextEdit::paper () const
|
---|
| 1048 | </h3><p>Returns the background (paper) brush.
|
---|
| 1049 | See the <a href="qtextedit.html#paper-prop">"paper"</a> property for details.
|
---|
| 1050 | <h3 class=fn>int <a name="paragraphAt"></a>QTextEdit::paragraphAt ( const <a href="qpoint.html">QPoint</a> & pos ) const
|
---|
| 1051 | </h3>
|
---|
| 1052 | Returns the paragraph which is at position <em>pos</em> (in contents
|
---|
| 1053 | coordinates).
|
---|
| 1054 |
|
---|
| 1055 | <h3 class=fn><a href="qcolor.html">QColor</a> <a name="paragraphBackgroundColor"></a>QTextEdit::paragraphBackgroundColor ( int para ) const
|
---|
| 1056 | </h3>
|
---|
| 1057 | Returns the background color of the paragraph <em>para</em> or an
|
---|
| 1058 | invalid color if <em>para</em> is out of range or the paragraph has no
|
---|
| 1059 | background set
|
---|
| 1060 |
|
---|
| 1061 | <h3 class=fn>int <a name="paragraphLength"></a>QTextEdit::paragraphLength ( int para ) const
|
---|
| 1062 | </h3>
|
---|
| 1063 | Returns the length of the paragraph <em>para</em> (i.e. the number of
|
---|
| 1064 | characters), or -1 if there is no paragraph with index <em>para</em>.
|
---|
| 1065 | <p> This function ignores newlines.
|
---|
| 1066 |
|
---|
| 1067 | <h3 class=fn><a href="qrect.html">QRect</a> <a name="paragraphRect"></a>QTextEdit::paragraphRect ( int para ) const
|
---|
| 1068 | </h3>
|
---|
| 1069 | Returns the rectangle of the paragraph <em>para</em> in contents
|
---|
| 1070 | coordinates, or an invalid rectangle if <em>para</em> is out of range.
|
---|
| 1071 |
|
---|
| 1072 | <h3 class=fn>int <a name="paragraphs"></a>QTextEdit::paragraphs () const
|
---|
| 1073 | </h3>
|
---|
| 1074 | Returns the number of paragraphs in the text; an empty textedit is always
|
---|
| 1075 | considered to have one paragraph, so 1 is returned in this case.
|
---|
| 1076 |
|
---|
| 1077 | <h3 class=fn>void <a name="paste"></a>QTextEdit::paste ()<tt> [virtual slot]</tt>
|
---|
| 1078 | </h3>
|
---|
| 1079 | Pastes the text from the clipboard into the text edit at the
|
---|
| 1080 | current cursor position. Only plain text is pasted.
|
---|
| 1081 | <p> If there is no text in the clipboard nothing happens.
|
---|
| 1082 | <p> <p>See also <a href="#pasteSubType">pasteSubType</a>(), <a href="#cut">cut</a>(), and <a href="#copy">QTextEdit::copy</a>().
|
---|
| 1083 |
|
---|
| 1084 | <h3 class=fn>void <a name="pasteSubType"></a>QTextEdit::pasteSubType ( const <a href="qcstring.html">QCString</a> & subtype )<tt> [virtual slot]</tt>
|
---|
| 1085 | </h3>
|
---|
| 1086 | Pastes the text with format <em>subtype</em> from the clipboard into the
|
---|
| 1087 | text edit at the current cursor position. The <em>subtype</em> can be
|
---|
| 1088 | "plain" or "html".
|
---|
| 1089 | <p> If there is no text with format <em>subtype</em> in the clipboard
|
---|
| 1090 | nothing happens.
|
---|
| 1091 | <p> <p>See also <a href="#paste">paste</a>(), <a href="#cut">cut</a>(), and <a href="#copy">QTextEdit::copy</a>().
|
---|
| 1092 |
|
---|
| 1093 | <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>
|
---|
| 1094 | </h3>
|
---|
| 1095 | Places the cursor <em>c</em> at the character which is closest to position
|
---|
| 1096 | <em>pos</em> (in contents coordinates). If <em>c</em> is 0, the default text
|
---|
| 1097 | cursor is used.
|
---|
| 1098 | <p> <p>See also <a href="#setCursorPosition">setCursorPosition</a>().
|
---|
| 1099 |
|
---|
| 1100 | <h3 class=fn>int <a name="pointSize"></a>QTextEdit::pointSize () const
|
---|
| 1101 | </h3>
|
---|
| 1102 | Returns the point size of the font of the current format.
|
---|
| 1103 | <p> <p>See also <a href="#setFamily">setFamily</a>(), <a href="#setCurrentFont">setCurrentFont</a>(), and <a href="#setPointSize">setPointSize</a>().
|
---|
| 1104 |
|
---|
| 1105 | <h3 class=fn>void <a name="redo"></a>QTextEdit::redo ()<tt> [virtual slot]</tt>
|
---|
| 1106 | </h3>
|
---|
| 1107 | Redoes the last operation.
|
---|
| 1108 | <p> If there is no operation to redo, i.e. there is no redo step in
|
---|
| 1109 | the undo/redo history, nothing happens.
|
---|
| 1110 | <p> <p>See also <a href="#redoAvailable">redoAvailable</a>(), <a href="#undo">undo</a>(), and <a href="#undoDepth-prop">undoDepth</a>.
|
---|
| 1111 |
|
---|
| 1112 | <h3 class=fn>void <a name="redoAvailable"></a>QTextEdit::redoAvailable ( bool yes )<tt> [signal]</tt>
|
---|
| 1113 | </h3>
|
---|
| 1114 |
|
---|
| 1115 | <p> This signal is emitted when the availability of redo changes. If
|
---|
| 1116 | <em>yes</em> is TRUE, then <a href="#redo">redo</a>() will work until <a href="#redoAvailable">redoAvailable</a>( FALSE )
|
---|
| 1117 | is next emitted.
|
---|
| 1118 | <p> <p>See also <a href="#redo">redo</a>() and <a href="#undoDepth-prop">undoDepth</a>.
|
---|
| 1119 |
|
---|
| 1120 | <h3 class=fn>void <a name="removeParagraph"></a>QTextEdit::removeParagraph ( int para )<tt> [virtual slot]</tt>
|
---|
| 1121 | </h3>
|
---|
| 1122 | Removes the paragraph <em>para</em>.
|
---|
| 1123 |
|
---|
| 1124 | <h3 class=fn>void <a name="removeSelectedText"></a>QTextEdit::removeSelectedText ( int selNum = 0 )<tt> [virtual slot]</tt>
|
---|
| 1125 | </h3>
|
---|
| 1126 | Deletes the text of selection <em>selNum</em> (by default, the default
|
---|
| 1127 | selection, 0). If there is no selected text nothing happens.
|
---|
| 1128 | <p> <p>See also <a href="#selectedText-prop">selectedText</a> and <a href="#removeSelection">removeSelection</a>().
|
---|
| 1129 |
|
---|
| 1130 | <h3 class=fn>void <a name="removeSelection"></a>QTextEdit::removeSelection ( int selNum = 0 )<tt> [virtual slot]</tt>
|
---|
| 1131 | </h3>
|
---|
| 1132 | Removes the selection <em>selNum</em> (by default 0). This does not
|
---|
| 1133 | remove the selected text.
|
---|
| 1134 | <p> <p>See also <a href="#removeSelectedText">removeSelectedText</a>().
|
---|
| 1135 |
|
---|
| 1136 | <h3 class=fn>void <a name="repaintChanged"></a>QTextEdit::repaintChanged ()<tt> [protected]</tt>
|
---|
| 1137 | </h3>
|
---|
| 1138 | Repaints any paragraphs that have changed.
|
---|
| 1139 | <p> Although used extensively internally you shouldn't need to call
|
---|
| 1140 | this yourself.
|
---|
| 1141 |
|
---|
| 1142 | <h3 class=fn>void <a name="returnPressed"></a>QTextEdit::returnPressed ()<tt> [signal]</tt>
|
---|
| 1143 | </h3>
|
---|
| 1144 |
|
---|
| 1145 | <p> This signal is emitted if the user pressed the Return or the Enter
|
---|
| 1146 | key.
|
---|
| 1147 |
|
---|
| 1148 | <h3 class=fn>void <a name="scrollToAnchor"></a>QTextEdit::scrollToAnchor ( const <a href="qstring.html">QString</a> & name )<tt> [virtual slot]</tt>
|
---|
| 1149 | </h3>
|
---|
| 1150 | 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
|
---|
| 1151 | isn't found no scrolling will occur. An anchor is defined using
|
---|
| 1152 | the HTML anchor tag, e.g. <tt><a name="target"></tt>.
|
---|
| 1153 |
|
---|
| 1154 | <h3 class=fn>void <a name="scrollToBottom"></a>QTextEdit::scrollToBottom ()<tt> [virtual slot]</tt>
|
---|
| 1155 | </h3>
|
---|
| 1156 | Scrolls to the bottom of the document and does formatting if
|
---|
| 1157 | required.
|
---|
| 1158 |
|
---|
| 1159 | <h3 class=fn>void <a name="selectAll"></a>QTextEdit::selectAll ( bool select = TRUE )<tt> [virtual slot]</tt>
|
---|
| 1160 | </h3>
|
---|
| 1161 | If <em>select</em> is TRUE (the default), all the text is selected as
|
---|
| 1162 | selection 0. If <em>select</em> is FALSE any selected text is
|
---|
| 1163 | unselected, i.e. the default selection (selection 0) is cleared.
|
---|
| 1164 | <p> <p>See also <a href="#selectedText-prop">selectedText</a>.
|
---|
| 1165 |
|
---|
| 1166 | <h3 class=fn><a href="qstring.html">QString</a> <a name="selectedText"></a>QTextEdit::selectedText () const
|
---|
| 1167 | </h3><p>Returns the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0).
|
---|
| 1168 | See the <a href="qtextedit.html#selectedText-prop">"selectedText"</a> property for details.
|
---|
| 1169 | <h3 class=fn>void <a name="selectionChanged"></a>QTextEdit::selectionChanged ()<tt> [signal]</tt>
|
---|
| 1170 | </h3>
|
---|
| 1171 |
|
---|
| 1172 | <p> This signal is emitted whenever the selection changes.
|
---|
| 1173 | <p> <p>See also <a href="#setSelection">setSelection</a>() and <a href="#copyAvailable">copyAvailable</a>().
|
---|
| 1174 |
|
---|
| 1175 | <h3 class=fn>void <a name="setAlignment"></a>QTextEdit::setAlignment ( int a )<tt> [virtual slot]</tt>
|
---|
| 1176 | </h3>
|
---|
| 1177 | Sets the alignment of the current paragraph to <em>a</em>. Valid
|
---|
| 1178 | alignments are <a href="qt.html#AlignmentFlags-enum">Qt::AlignLeft</a>, <a href="qt.html#AlignmentFlags-enum">Qt::AlignRight</a>,
|
---|
| 1179 | <a href="qt.html#AlignmentFlags-enum">Qt::AlignJustify</a> and <a href="qt.html#AlignmentFlags-enum">Qt::AlignCenter</a> (which centers
|
---|
| 1180 | horizontally).
|
---|
| 1181 |
|
---|
| 1182 | <p>Reimplemented in <a href="qmultilineedit.html#setAlignment">QMultiLineEdit</a>.
|
---|
| 1183 | <h3 class=fn>void <a name="setAutoFormatting"></a>QTextEdit::setAutoFormatting ( uint features )
|
---|
| 1184 | </h3><p>Sets the enabled set of auto formatting features to <em>features</em>.
|
---|
| 1185 | See the <a href="qtextedit.html#autoFormatting-prop">"autoFormatting"</a> property for details.
|
---|
| 1186 | <h3 class=fn>void <a name="setBold"></a>QTextEdit::setBold ( bool b )<tt> [virtual slot]</tt>
|
---|
| 1187 | </h3>
|
---|
| 1188 | If <em>b</em> is TRUE sets the current format to bold; otherwise sets
|
---|
| 1189 | the current format to non-bold.
|
---|
| 1190 | <p> <p>See also <a href="#bold">bold</a>().
|
---|
| 1191 |
|
---|
| 1192 | <h3 class=fn>void <a name="setColor"></a>QTextEdit::setColor ( const <a href="qcolor.html">QColor</a> & c )<tt> [virtual slot]</tt>
|
---|
| 1193 | </h3>
|
---|
| 1194 | Sets the color of the current format, i.e. of the text, to <em>c</em>.
|
---|
| 1195 | <p> <p>See also <a href="#color">color</a>() and <a href="#paper-prop">paper</a>.
|
---|
| 1196 |
|
---|
| 1197 | <h3 class=fn>void <a name="setCurrentFont"></a>QTextEdit::setCurrentFont ( const <a href="qfont.html">QFont</a> & f )<tt> [virtual slot]</tt>
|
---|
| 1198 | </h3>
|
---|
| 1199 |
|
---|
| 1200 | <p> Sets the font of the current format to <em>f</em>.
|
---|
| 1201 | <p> If the widget is in <a href="qt.html#TextFormat-enum">LogText</a> mode this function will do
|
---|
| 1202 | nothing. Use <a href="qwidget.html#setFont">setFont</a>() instead.
|
---|
| 1203 | <p> <p>See also <a href="#currentFont">currentFont</a>(), <a href="#setPointSize">setPointSize</a>(), and <a href="#setFamily">setFamily</a>().
|
---|
| 1204 |
|
---|
| 1205 | <h3 class=fn>void <a name="setCursorPosition"></a>QTextEdit::setCursorPosition ( int para, int index )<tt> [virtual slot]</tt>
|
---|
| 1206 | </h3>
|
---|
| 1207 | Sets the cursor to position <em>index</em> in paragraph <em>para</em>.
|
---|
| 1208 | <p> <p>See also <a href="#getCursorPosition">getCursorPosition</a>().
|
---|
| 1209 |
|
---|
| 1210 | <h3 class=fn>void <a name="setFamily"></a>QTextEdit::setFamily ( const <a href="qstring.html">QString</a> & fontFamily )<tt> [virtual slot]</tt>
|
---|
| 1211 | </h3>
|
---|
| 1212 | Sets the font family of the current format to <em>fontFamily</em>.
|
---|
| 1213 | <p> <p>See also <a href="#family">family</a>() and <a href="#setCurrentFont">setCurrentFont</a>().
|
---|
| 1214 |
|
---|
| 1215 | <h3 class=fn>void <a name="setItalic"></a>QTextEdit::setItalic ( bool b )<tt> [virtual slot]</tt>
|
---|
| 1216 | </h3>
|
---|
| 1217 | If <em>b</em> is TRUE sets the current format to italic; otherwise sets
|
---|
| 1218 | the current format to non-italic.
|
---|
| 1219 | <p> <p>See also <a href="#italic">italic</a>().
|
---|
| 1220 |
|
---|
| 1221 | <h3 class=fn>void <a name="setLinkUnderline"></a>QTextEdit::setLinkUnderline ( bool )<tt> [virtual slot]</tt>
|
---|
| 1222 | </h3><p>Sets whether hypertext links will be underlined.
|
---|
| 1223 | See the <a href="qtextedit.html#linkUnderline-prop">"linkUnderline"</a> property for details.
|
---|
| 1224 | <h3 class=fn>void <a name="setMaxLogLines"></a>QTextEdit::setMaxLogLines ( int limit )<tt> [slot]</tt>
|
---|
| 1225 | </h3>
|
---|
| 1226 | 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
|
---|
| 1227 | signifies an unlimited number of lines.
|
---|
| 1228 | <p> <b>Warning:</b> Never use formatting tags that span more than one line
|
---|
| 1229 | when the maximum log lines is set. When lines are removed from the
|
---|
| 1230 | top of the buffer it could result in an unbalanced tag pair, i.e.
|
---|
| 1231 | the left formatting tag is removed before the right one.
|
---|
| 1232 |
|
---|
| 1233 | <h3 class=fn>void <a name="setMimeSourceFactory"></a>QTextEdit::setMimeSourceFactory ( <a href="qmimesourcefactory.html">QMimeSourceFactory</a> * factory )<tt> [virtual slot]</tt>
|
---|
| 1234 | </h3>
|
---|
| 1235 | Sets the text edit's mimesource factory to <em>factory</em>. See
|
---|
| 1236 | <a href="qmimesourcefactory.html">QMimeSourceFactory</a> for further details.
|
---|
| 1237 | <p> <p>See also <a href="#mimeSourceFactory">mimeSourceFactory</a>().
|
---|
| 1238 |
|
---|
| 1239 | <h3 class=fn>void <a name="setModified"></a>QTextEdit::setModified ( bool m )<tt> [virtual slot]</tt>
|
---|
| 1240 | </h3><p>Sets whether the document has been modified by the user to <em>m</em>.
|
---|
| 1241 | See the <a href="qtextedit.html#modified-prop">"modified"</a> property for details.
|
---|
| 1242 | <h3 class=fn>void <a name="setOverwriteMode"></a>QTextEdit::setOverwriteMode ( bool b )<tt> [virtual slot]</tt>
|
---|
| 1243 | </h3><p>Sets the text edit's overwrite mode to <em>b</em>.
|
---|
| 1244 | See the <a href="qtextedit.html#overwriteMode-prop">"overwriteMode"</a> property for details.
|
---|
| 1245 | <h3 class=fn>void <a name="setPaper"></a>QTextEdit::setPaper ( const <a href="qbrush.html">QBrush</a> & pap )<tt> [virtual slot]</tt>
|
---|
| 1246 | </h3><p>Sets the background (paper) brush to <em>pap</em>.
|
---|
| 1247 | See the <a href="qtextedit.html#paper-prop">"paper"</a> property for details.
|
---|
| 1248 | <h3 class=fn>void <a name="setParagraphBackgroundColor"></a>QTextEdit::setParagraphBackgroundColor ( int para, const <a href="qcolor.html">QColor</a> & bg )<tt> [virtual slot]</tt>
|
---|
| 1249 | </h3>
|
---|
| 1250 | Sets the background color of the paragraph <em>para</em> to <em>bg</em>.
|
---|
| 1251 |
|
---|
| 1252 | <h3 class=fn>void <a name="setPointSize"></a>QTextEdit::setPointSize ( int s )<tt> [virtual slot]</tt>
|
---|
| 1253 | </h3>
|
---|
| 1254 | Sets the point size of the current format to <em>s</em>.
|
---|
| 1255 | <p> Note that if <em>s</em> is zero or negative, the behaviour of this
|
---|
| 1256 | function is not defined.
|
---|
| 1257 | <p> <p>See also <a href="#pointSize">pointSize</a>(), <a href="#setCurrentFont">setCurrentFont</a>(), and <a href="#setFamily">setFamily</a>().
|
---|
| 1258 |
|
---|
| 1259 | <h3 class=fn>void <a name="setReadOnly"></a>QTextEdit::setReadOnly ( bool b )<tt> [virtual slot]</tt>
|
---|
| 1260 | </h3><p>Sets whether the text edit is read-only to <em>b</em>.
|
---|
| 1261 | See the <a href="qtextedit.html#readOnly-prop">"readOnly"</a> property for details.
|
---|
| 1262 | <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>
|
---|
| 1263 | </h3>
|
---|
| 1264 | Sets a selection which starts at position <em>indexFrom</em> in
|
---|
| 1265 | paragraph <em>paraFrom</em> and ends at position <em>indexTo</em> in paragraph
|
---|
| 1266 | <em>paraTo</em>.
|
---|
| 1267 | <p> Any existing selections which have a different id (<em>selNum</em>) are
|
---|
| 1268 | left alone, but if an existing selection has the same id as <em>selNum</em> it is removed and replaced by this selection.
|
---|
| 1269 | <p> Uses the selection settings of selection <em>selNum</em>. If <em>selNum</em>
|
---|
| 1270 | is 0, this is the default selection.
|
---|
| 1271 | <p> The cursor is moved to the end of the selection if <em>selNum</em> is 0,
|
---|
| 1272 | otherwise the cursor position remains unchanged.
|
---|
| 1273 | <p> <p>See also <a href="#getSelection">getSelection</a>() and <a href="#selectedText-prop">selectedText</a>.
|
---|
| 1274 |
|
---|
| 1275 | <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>
|
---|
| 1276 | </h3>
|
---|
| 1277 | Sets the background color of selection number <em>selNum</em> to <em>back</em>
|
---|
| 1278 | and specifies whether the text of this selection should be
|
---|
| 1279 | inverted with <em>invertText</em>.
|
---|
| 1280 | <p> This only works for <em>selNum</em> > 0. The default selection (<em>selNum</em> == 0) gets its attributes from the text edit's
|
---|
| 1281 | <a href="qwidget.html#colorGroup">colorGroup</a>().
|
---|
| 1282 |
|
---|
| 1283 | <h3 class=fn>void <a name="setStyleSheet"></a>QTextEdit::setStyleSheet ( <a href="qstylesheet.html">QStyleSheet</a> * styleSheet )<tt> [virtual slot]</tt>
|
---|
| 1284 | </h3>
|
---|
| 1285 | Sets the stylesheet to use with this text edit to <em>styleSheet</em>.
|
---|
| 1286 | Changes will only take effect for new text added with <a href="#setText">setText</a>() or
|
---|
| 1287 | <a href="#append">append</a>().
|
---|
| 1288 | <p> <p>See also <a href="#styleSheet">styleSheet</a>().
|
---|
| 1289 |
|
---|
| 1290 | <h3 class=fn>void <a name="setTabChangesFocus"></a>QTextEdit::setTabChangesFocus ( bool b )<tt> [slot]</tt>
|
---|
| 1291 | </h3><p>Sets whether TAB changes focus or is accepted as input to <em>b</em>.
|
---|
| 1292 | See the <a href="qtextedit.html#tabChangesFocus-prop">"tabChangesFocus"</a> property for details.
|
---|
| 1293 | <h3 class=fn>void <a name="setTabStopWidth"></a>QTextEdit::setTabStopWidth ( int ts )<tt> [virtual slot]</tt>
|
---|
| 1294 | </h3><p>Sets the tab stop width in pixels to <em>ts</em>.
|
---|
| 1295 | See the <a href="qtextedit.html#tabStopWidth-prop">"tabStopWidth"</a> property for details.
|
---|
| 1296 | <h3 class=fn>void <a name="setText"></a>QTextEdit::setText ( const <a href="qstring.html">QString</a> & txt )<tt> [slot]</tt>
|
---|
| 1297 | </h3><p>Sets the text edit's text to <em>txt</em>.
|
---|
| 1298 | See the <a href="qtextedit.html#text-prop">"text"</a> property for details.
|
---|
| 1299 | <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>
|
---|
| 1300 | </h3>
|
---|
| 1301 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 1302 | <p> Changes the text of the text edit to the string <em>text</em> and the
|
---|
| 1303 | context to <em>context</em>. Any previous text is removed.
|
---|
| 1304 | <p> <em>text</em> may be interpreted either as plain text or as rich text,
|
---|
| 1305 | depending on the <a href="#textFormat">textFormat</a>(). The default setting is <a href="qt.html#TextFormat-enum">AutoText</a>,
|
---|
| 1306 | i.e. the text edit auto-detects the format from <em>text</em>.
|
---|
| 1307 | <p> For rich text the rendering style and available tags are defined
|
---|
| 1308 | by a <a href="#styleSheet">styleSheet</a>(); see <a href="qstylesheet.html">QStyleSheet</a> for details.
|
---|
| 1309 | <p> The optional <em>context</em> is a path which the text edit's
|
---|
| 1310 | <a href="qmimesourcefactory.html">QMimeSourceFactory</a> uses to resolve the locations of files and
|
---|
| 1311 | images. (See <a href="#QTextEdit">QTextEdit::QTextEdit</a>().) It is passed to the text
|
---|
| 1312 | edit's QMimeSourceFactory when quering data.
|
---|
| 1313 | <p> Note that the undo/redo history is cleared by this function.
|
---|
| 1314 | <p> <p>See also <a href="#text-prop">text</a> and <a href="#textFormat-prop">textFormat</a>.
|
---|
| 1315 |
|
---|
| 1316 | <h3 class=fn>void <a name="setTextFormat"></a>QTextEdit::setTextFormat ( <a href="qt.html#TextFormat-enum">TextFormat</a> f )<tt> [virtual slot]</tt>
|
---|
| 1317 | </h3><p>Sets the text format: rich text, plain text, log text or auto text to <em>f</em>.
|
---|
| 1318 | See the <a href="qtextedit.html#textFormat-prop">"textFormat"</a> property for details.
|
---|
| 1319 | <h3 class=fn>void <a name="setUnderline"></a>QTextEdit::setUnderline ( bool b )<tt> [virtual slot]</tt>
|
---|
| 1320 | </h3>
|
---|
| 1321 | If <em>b</em> is TRUE sets the current format to underline; otherwise
|
---|
| 1322 | sets the current format to non-underline.
|
---|
| 1323 | <p> <p>See also <a href="#underline">underline</a>().
|
---|
| 1324 |
|
---|
| 1325 | <h3 class=fn>void <a name="setUndoDepth"></a>QTextEdit::setUndoDepth ( int d )<tt> [virtual slot]</tt>
|
---|
| 1326 | </h3><p>Sets the depth of the undo history to <em>d</em>.
|
---|
| 1327 | See the <a href="qtextedit.html#undoDepth-prop">"undoDepth"</a> property for details.
|
---|
| 1328 | <h3 class=fn>void <a name="setUndoRedoEnabled"></a>QTextEdit::setUndoRedoEnabled ( bool b )<tt> [virtual slot]</tt>
|
---|
| 1329 | </h3><p>Sets whether undo/redo is enabled to <em>b</em>.
|
---|
| 1330 | See the <a href="qtextedit.html#undoRedoEnabled-prop">"undoRedoEnabled"</a> property for details.
|
---|
| 1331 | <h3 class=fn>void <a name="setVerticalAlignment"></a>QTextEdit::setVerticalAlignment ( <a href="qtextedit.html#VerticalAlignment-enum">VerticalAlignment</a> a )<tt> [virtual slot]</tt>
|
---|
| 1332 | </h3>
|
---|
| 1333 | Sets the vertical alignment of the current format, i.e. of the
|
---|
| 1334 | text, to <em>a</em>.
|
---|
| 1335 | <p> <p>See also <a href="#color">color</a>() and <a href="#paper-prop">paper</a>.
|
---|
| 1336 |
|
---|
| 1337 | <h3 class=fn>void <a name="setWordWrap"></a>QTextEdit::setWordWrap ( <a href="qtextedit.html#WordWrap-enum">WordWrap</a> mode )<tt> [virtual slot]</tt>
|
---|
| 1338 | </h3><p>Sets the word wrap mode to <em>mode</em>.
|
---|
| 1339 | See the <a href="qtextedit.html#wordWrap-prop">"wordWrap"</a> property for details.
|
---|
| 1340 | <h3 class=fn>void <a name="setWrapColumnOrWidth"></a>QTextEdit::setWrapColumnOrWidth ( int )<tt> [virtual slot]</tt>
|
---|
| 1341 | </h3><p>Sets the position (in pixels or columns depending on the wrap mode) where text will be wrapped.
|
---|
| 1342 | See the <a href="qtextedit.html#wrapColumnOrWidth-prop">"wrapColumnOrWidth"</a> property for details.
|
---|
| 1343 | <h3 class=fn>void <a name="setWrapPolicy"></a>QTextEdit::setWrapPolicy ( <a href="qtextedit.html#WrapPolicy-enum">WrapPolicy</a> policy )<tt> [virtual slot]</tt>
|
---|
| 1344 | </h3><p>Sets the word wrap policy, at whitespace or anywhere to <em>policy</em>.
|
---|
| 1345 | See the <a href="qtextedit.html#wrapPolicy-prop">"wrapPolicy"</a> property for details.
|
---|
| 1346 | <h3 class=fn><a href="qstylesheet.html">QStyleSheet</a> * <a name="styleSheet"></a>QTextEdit::styleSheet () const
|
---|
| 1347 | </h3>
|
---|
| 1348 | Returns the <a href="qstylesheet.html">QStyleSheet</a> which is being used by this text edit.
|
---|
| 1349 | <p> <p>See also <a href="#setStyleSheet">setStyleSheet</a>().
|
---|
| 1350 |
|
---|
| 1351 | <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>.
|
---|
| 1352 | <h3 class=fn>void <a name="sync"></a>QTextEdit::sync ()<tt> [virtual slot]</tt>
|
---|
| 1353 | </h3>
|
---|
| 1354 | QTextEdit is optimized for large amounts text. One of its
|
---|
| 1355 | optimizations is to format only the visible text, formatting the rest
|
---|
| 1356 | on demand, e.g. as the user scrolls, so you don't usually need to
|
---|
| 1357 | call this function.
|
---|
| 1358 | <p> In some situations you may want to force the whole text
|
---|
| 1359 | to be formatted. For example, if after calling <a href="#setText">setText</a>(), you wanted
|
---|
| 1360 | to know the height of the document (using <a href="qscrollview.html#contentsHeight">contentsHeight</a>()), you
|
---|
| 1361 | would call this function first.
|
---|
| 1362 |
|
---|
| 1363 | <h3 class=fn><a href="qsyntaxhighlighter.html">QSyntaxHighlighter</a> * <a name="syntaxHighlighter"></a>QTextEdit::syntaxHighlighter () const
|
---|
| 1364 | </h3>
|
---|
| 1365 | Returns the <a href="qsyntaxhighlighter.html">QSyntaxHighlighter</a> set on this QTextEdit. 0 is
|
---|
| 1366 | returned if no syntax highlighter is set.
|
---|
| 1367 |
|
---|
| 1368 | <h3 class=fn>bool <a name="tabChangesFocus"></a>QTextEdit::tabChangesFocus () const
|
---|
| 1369 | </h3><p>Returns TRUE if TAB changes focus or is accepted as input; otherwise returns FALSE.
|
---|
| 1370 | See the <a href="qtextedit.html#tabChangesFocus-prop">"tabChangesFocus"</a> property for details.
|
---|
| 1371 | <h3 class=fn>int <a name="tabStopWidth"></a>QTextEdit::tabStopWidth () const
|
---|
| 1372 | </h3><p>Returns the tab stop width in pixels.
|
---|
| 1373 | See the <a href="qtextedit.html#tabStopWidth-prop">"tabStopWidth"</a> property for details.
|
---|
| 1374 | <h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QTextEdit::text () const
|
---|
| 1375 | </h3><p>Returns the text edit's text.
|
---|
| 1376 | See the <a href="qtextedit.html#text-prop">"text"</a> property for details.
|
---|
| 1377 | <h3 class=fn><a href="qstring.html">QString</a> <a name="text-2"></a>QTextEdit::text ( int para ) const
|
---|
| 1378 | </h3>
|
---|
| 1379 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 1380 | <p> Returns the text of paragraph <em>para</em>.
|
---|
| 1381 | <p> If <a href="#textFormat">textFormat</a>() is <a href="qt.html#TextFormat-enum">RichText</a> the text will contain HTML
|
---|
| 1382 | formatting tags.
|
---|
| 1383 |
|
---|
| 1384 | <h3 class=fn>void <a name="textChanged"></a>QTextEdit::textChanged ()<tt> [signal]</tt>
|
---|
| 1385 | </h3>
|
---|
| 1386 |
|
---|
| 1387 | <p> This signal is emitted whenever the text in the text edit changes.
|
---|
| 1388 | <p> <p>See also <a href="#text-prop">text</a> and <a href="#append">append</a>().
|
---|
| 1389 |
|
---|
| 1390 | <p>Examples: <a href="qwerty-example.html#x400">qwerty/qwerty.cpp</a> and <a href="rot-example.html#x1375">rot13/rot13.cpp</a>.
|
---|
| 1391 | <h3 class=fn>QTextCursor * <a name="textCursor"></a>QTextEdit::textCursor () const<tt> [protected]</tt>
|
---|
| 1392 | </h3>
|
---|
| 1393 |
|
---|
| 1394 | <p> Returns the text edit's text cursor.
|
---|
| 1395 | <p> <b>Warning:</b> QTextCursor is not in the public API, but in special
|
---|
| 1396 | circumstances you might wish to use it.
|
---|
| 1397 |
|
---|
| 1398 | <h3 class=fn><a href="qt.html#TextFormat-enum">TextFormat</a> <a name="textFormat"></a>QTextEdit::textFormat () const
|
---|
| 1399 | </h3><p>Returns the text format: rich text, plain text, log text or auto text.
|
---|
| 1400 | See the <a href="qtextedit.html#textFormat-prop">"textFormat"</a> property for details.
|
---|
| 1401 | <h3 class=fn>bool <a name="underline"></a>QTextEdit::underline () const
|
---|
| 1402 | </h3>
|
---|
| 1403 | Returns TRUE if the current format is underlined; otherwise returns
|
---|
| 1404 | FALSE.
|
---|
| 1405 | <p> <p>See also <a href="#setUnderline">setUnderline</a>().
|
---|
| 1406 |
|
---|
| 1407 | <h3 class=fn>void <a name="undo"></a>QTextEdit::undo ()<tt> [virtual slot]</tt>
|
---|
| 1408 | </h3>
|
---|
| 1409 | Undoes the last operation.
|
---|
| 1410 | <p> If there is no operation to undo, i.e. there is no undo step in
|
---|
| 1411 | the undo/redo history, nothing happens.
|
---|
| 1412 | <p> <p>See also <a href="#undoAvailable">undoAvailable</a>(), <a href="#redo">redo</a>(), and <a href="#undoDepth-prop">undoDepth</a>.
|
---|
| 1413 |
|
---|
| 1414 | <h3 class=fn>void <a name="undoAvailable"></a>QTextEdit::undoAvailable ( bool yes )<tt> [signal]</tt>
|
---|
| 1415 | </h3>
|
---|
| 1416 |
|
---|
| 1417 | <p> This signal is emitted when the availability of undo changes. If
|
---|
| 1418 | <em>yes</em> is TRUE, then <a href="#undo">undo</a>() will work until <a href="#undoAvailable">undoAvailable</a>( FALSE )
|
---|
| 1419 | is next emitted.
|
---|
| 1420 | <p> <p>See also <a href="#undo">undo</a>() and <a href="#undoDepth-prop">undoDepth</a>.
|
---|
| 1421 |
|
---|
| 1422 | <h3 class=fn>int <a name="undoDepth"></a>QTextEdit::undoDepth () const
|
---|
| 1423 | </h3><p>Returns the depth of the undo history.
|
---|
| 1424 | See the <a href="qtextedit.html#undoDepth-prop">"undoDepth"</a> property for details.
|
---|
| 1425 | <h3 class=fn><a href="qtextedit.html#WordWrap-enum">WordWrap</a> <a name="wordWrap"></a>QTextEdit::wordWrap () const
|
---|
| 1426 | </h3><p>Returns the word wrap mode.
|
---|
| 1427 | See the <a href="qtextedit.html#wordWrap-prop">"wordWrap"</a> property for details.
|
---|
| 1428 | <h3 class=fn>int <a name="wrapColumnOrWidth"></a>QTextEdit::wrapColumnOrWidth () const
|
---|
| 1429 | </h3><p>Returns the position (in pixels or columns depending on the wrap mode) where text will be wrapped.
|
---|
| 1430 | See the <a href="qtextedit.html#wrapColumnOrWidth-prop">"wrapColumnOrWidth"</a> property for details.
|
---|
| 1431 | <h3 class=fn><a href="qtextedit.html#WrapPolicy-enum">WrapPolicy</a> <a name="wrapPolicy"></a>QTextEdit::wrapPolicy () const
|
---|
| 1432 | </h3><p>Returns the word wrap policy, at whitespace or anywhere.
|
---|
| 1433 | See the <a href="qtextedit.html#wrapPolicy-prop">"wrapPolicy"</a> property for details.
|
---|
| 1434 | <h3 class=fn>void <a name="zoomIn"></a>QTextEdit::zoomIn ( int range )<tt> [virtual slot]</tt>
|
---|
| 1435 | </h3>
|
---|
| 1436 | Zooms in on the text by making the base font size <em>range</em>
|
---|
| 1437 | points larger and recalculating all font sizes to be the new size.
|
---|
| 1438 | This does not change the size of any images.
|
---|
| 1439 | <p> <p>See also <a href="#zoomOut">zoomOut</a>().
|
---|
| 1440 |
|
---|
| 1441 | <h3 class=fn>void <a name="zoomIn-2"></a>QTextEdit::zoomIn ()<tt> [virtual slot]</tt>
|
---|
| 1442 | </h3>
|
---|
| 1443 |
|
---|
| 1444 | <p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 1445 | <p> Zooms in on the text by making the base font size one point
|
---|
| 1446 | larger and recalculating all font sizes to be the new size. This
|
---|
| 1447 | does not change the size of any images.
|
---|
| 1448 | <p> <p>See also <a href="#zoomOut">zoomOut</a>().
|
---|
| 1449 |
|
---|
| 1450 | <h3 class=fn>void <a name="zoomOut"></a>QTextEdit::zoomOut ( int range )<tt> [virtual slot]</tt>
|
---|
| 1451 | </h3>
|
---|
| 1452 | Zooms out on the text by making the base font size <em>range</em> points
|
---|
| 1453 | smaller and recalculating all font sizes to be the new size. This
|
---|
| 1454 | does not change the size of any images.
|
---|
| 1455 | <p> <p>See also <a href="#zoomIn">zoomIn</a>().
|
---|
| 1456 |
|
---|
| 1457 | <h3 class=fn>void <a name="zoomOut-2"></a>QTextEdit::zoomOut ()<tt> [virtual slot]</tt>
|
---|
| 1458 | </h3>
|
---|
| 1459 |
|
---|
| 1460 | <p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 1461 | <p> Zooms out on the text by making the base font size one point
|
---|
| 1462 | smaller and recalculating all font sizes to be the new size. This
|
---|
| 1463 | does not change the size of any images.
|
---|
| 1464 | <p> <p>See also <a href="#zoomIn">zoomIn</a>().
|
---|
| 1465 |
|
---|
| 1466 | <h3 class=fn>void <a name="zoomTo"></a>QTextEdit::zoomTo ( int size )<tt> [virtual slot]</tt>
|
---|
| 1467 | </h3>
|
---|
| 1468 | Zooms the text by making the base font size <em>size</em> points and
|
---|
| 1469 | recalculating all font sizes to be the new size. This does not
|
---|
| 1470 | change the size of any images.
|
---|
| 1471 |
|
---|
| 1472 | <hr><h2>Property Documentation</h2>
|
---|
| 1473 | <h3 class=fn><a href="qtextedit.html#AutoFormatting-enum">AutoFormatting</a> <a name="autoFormatting-prop"></a>autoFormatting</h3>
|
---|
| 1474 | <p>This property holds the enabled set of auto formatting features.
|
---|
| 1475 | <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>
|
---|
| 1476 | to disable all automatic formatting.
|
---|
| 1477 | <p> Currently, the only automatic formatting feature provided is <a href="#AutoFormatting-enum">AutoBulletList</a>; future versions of Qt may offer more.
|
---|
| 1478 |
|
---|
| 1479 | <p>Set this property's value with <a href="#setAutoFormatting">setAutoFormatting</a>() and get this property's value with <a href="#autoFormatting">autoFormatting</a>().
|
---|
| 1480 | <h3 class=fn><a href="qstring.html">QString</a> <a name="documentTitle-prop"></a>documentTitle</h3>
|
---|
| 1481 | <p>This property holds the title of the document parsed from the text.
|
---|
| 1482 | <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,
|
---|
| 1483 | if present, otherwise an empty string.
|
---|
| 1484 |
|
---|
| 1485 | <p>Get this property's value with <a href="#documentTitle">documentTitle</a>().
|
---|
| 1486 | <h3 class=fn>bool <a name="hasSelectedText-prop"></a>hasSelectedText</h3>
|
---|
| 1487 | <p>This property holds whether some text is selected in selection 0.
|
---|
| 1488 | <p>
|
---|
| 1489 | <p>Get this property's value with <a href="#hasSelectedText">hasSelectedText</a>().
|
---|
| 1490 | <h3 class=fn>int <a name="length-prop"></a>length</h3>
|
---|
| 1491 | <p>This property holds the number of characters in the text.
|
---|
| 1492 | <p>
|
---|
| 1493 | <p>Get this property's value with <a href="#length">length</a>().
|
---|
| 1494 | <h3 class=fn>bool <a name="linkUnderline-prop"></a>linkUnderline</h3>
|
---|
| 1495 | <p>This property holds whether hypertext links will be underlined.
|
---|
| 1496 | <p>If TRUE (the default) hypertext links will be displayed
|
---|
| 1497 | underlined. If FALSE links will not be displayed underlined.
|
---|
| 1498 |
|
---|
| 1499 | <p>Set this property's value with <a href="#setLinkUnderline">setLinkUnderline</a>() and get this property's value with <a href="#linkUnderline">linkUnderline</a>().
|
---|
| 1500 | <h3 class=fn>bool <a name="modified-prop"></a>modified</h3>
|
---|
| 1501 | <p>This property holds whether the document has been modified by the user.
|
---|
| 1502 | <p>
|
---|
| 1503 | <p>Set this property's value with <a href="#setModified">setModified</a>() and get this property's value with <a href="#isModified">isModified</a>().
|
---|
| 1504 | <h3 class=fn>bool <a name="overwriteMode-prop"></a>overwriteMode</h3>
|
---|
| 1505 | <p>This property holds the text edit's overwrite mode.
|
---|
| 1506 | <p>If FALSE (the default) characters entered by the user are inserted
|
---|
| 1507 | with any characters to the right being moved out of the way. If
|
---|
| 1508 | TRUE, the editor is in overwrite mode, i.e. characters entered by
|
---|
| 1509 | the user overwrite any characters to the right of the cursor
|
---|
| 1510 | position.
|
---|
| 1511 |
|
---|
| 1512 | <p>Set this property's value with <a href="#setOverwriteMode">setOverwriteMode</a>() and get this property's value with <a href="#isOverwriteMode">isOverwriteMode</a>().
|
---|
| 1513 | <h3 class=fn><a href="qbrush.html">QBrush</a> <a name="paper-prop"></a>paper</h3>
|
---|
| 1514 | <p>This property holds the background (paper) brush.
|
---|
| 1515 | <p>The brush that is currently used to draw the background of the
|
---|
| 1516 | text edit. The initial setting is an empty brush.
|
---|
| 1517 |
|
---|
| 1518 | <p>Set this property's value with <a href="#setPaper">setPaper</a>() and get this property's value with <a href="#paper">paper</a>().
|
---|
| 1519 | <h3 class=fn>bool <a name="readOnly-prop"></a>readOnly</h3>
|
---|
| 1520 | <p>This property holds whether the text edit is read-only.
|
---|
| 1521 | <p>In a read-only text edit the user can only navigate through the
|
---|
| 1522 | text and select text; modifying the text is not possible.
|
---|
| 1523 | <p> This property's default is FALSE.
|
---|
| 1524 |
|
---|
| 1525 | <p>Set this property's value with <a href="#setReadOnly">setReadOnly</a>() and get this property's value with <a href="#isReadOnly">isReadOnly</a>().
|
---|
| 1526 | <h3 class=fn><a href="qstring.html">QString</a> <a name="selectedText-prop"></a>selectedText</h3>
|
---|
| 1527 | <p>This property holds the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0).
|
---|
| 1528 | <p>The text is always returned as <a href="qt.html#TextFormat-enum">PlainText</a> if the <a href="#textFormat">textFormat</a>() is
|
---|
| 1529 | <a href="qt.html#TextFormat-enum">PlainText</a> or <a href="qt.html#TextFormat-enum">AutoText</a>, otherwise it is returned as HTML.
|
---|
| 1530 | <p> <p>See also <a href="#hasSelectedText-prop">hasSelectedText</a>.
|
---|
| 1531 |
|
---|
| 1532 | <p>Get this property's value with <a href="#selectedText">selectedText</a>().
|
---|
| 1533 | <h3 class=fn>bool <a name="tabChangesFocus-prop"></a>tabChangesFocus</h3> <p>This property holds whether TAB changes focus or is accepted as input.
|
---|
| 1534 | <p>In some occasions text edits should not allow the user to input
|
---|
| 1535 | tabulators or change indentation using the TAB key, as this breaks
|
---|
| 1536 | the focus chain. The default is FALSE.
|
---|
| 1537 | <p>
|
---|
| 1538 | <p>Set this property's value with <a href="#setTabChangesFocus">setTabChangesFocus</a>() and get this property's value with <a href="#tabChangesFocus">tabChangesFocus</a>().
|
---|
| 1539 | <h3 class=fn>int <a name="tabStopWidth-prop"></a>tabStopWidth</h3>
|
---|
| 1540 | <p>This property holds the tab stop width in pixels.
|
---|
| 1541 | <p>
|
---|
| 1542 | <p>Set this property's value with <a href="#setTabStopWidth">setTabStopWidth</a>() and get this property's value with <a href="#tabStopWidth">tabStopWidth</a>().
|
---|
| 1543 | <h3 class=fn><a href="qstring.html">QString</a> <a name="text-prop"></a>text</h3>
|
---|
| 1544 | <p>This property holds the text edit's text.
|
---|
| 1545 | <p>There is no default text.
|
---|
| 1546 | <p> On setting, any previous text is deleted.
|
---|
| 1547 | <p> The text may be interpreted either as plain text or as rich text,
|
---|
| 1548 | depending on the <a href="#textFormat">textFormat</a>(). The default setting is <a href="qt.html#TextFormat-enum">AutoText</a>,
|
---|
| 1549 | i.e. the text edit auto-detects the format of the text.
|
---|
| 1550 | <p> For richtext, calling <a href="#text">text</a>() on an editable QTextEdit will cause
|
---|
| 1551 | the text to be regenerated from the textedit. This may mean that
|
---|
| 1552 | the <a href="qstring.html">QString</a> returned may not be exactly the same as the one that
|
---|
| 1553 | was set.
|
---|
| 1554 | <p> <p>See also <a href="#textFormat-prop">textFormat</a>.
|
---|
| 1555 |
|
---|
| 1556 | <p>Set this property's value with <a href="#setText">setText</a>() and get this property's value with <a href="#text">text</a>().
|
---|
| 1557 | <h3 class=fn><a href="qt.html#TextFormat-enum">TextFormat</a> <a name="textFormat-prop"></a>textFormat</h3>
|
---|
| 1558 | <p>This property holds the text format: rich text, plain text, log text or auto text.
|
---|
| 1559 | <p>The text format is one of the following:
|
---|
| 1560 | <ul>
|
---|
| 1561 | <li> PlainText - all characters, except newlines, are displayed
|
---|
| 1562 | verbatim, including spaces. Whenever a newline appears in the text
|
---|
| 1563 | the text edit inserts a hard line break and begins a new
|
---|
| 1564 | paragraph.
|
---|
| 1565 | <li> RichText - rich text rendering. The available styles are
|
---|
| 1566 | defined in the default stylesheet <a href="qstylesheet.html#defaultSheet">QStyleSheet::defaultSheet</a>().
|
---|
| 1567 | <li> LogText - optimized mode for very large texts. Supports a very
|
---|
| 1568 | limited set of formatting tags (color, bold, underline and italic
|
---|
| 1569 | settings).
|
---|
| 1570 | <li> AutoText - this is the default. The text edit autodetects which
|
---|
| 1571 | rendering style is best, <a href="qt.html#TextFormat-enum">PlainText</a> or <a href="qt.html#TextFormat-enum">RichText</a>. This is done
|
---|
| 1572 | by using the <a href="qstylesheet.html#mightBeRichText">QStyleSheet::mightBeRichText</a>() function.
|
---|
| 1573 | </ul>
|
---|
| 1574 |
|
---|
| 1575 | <p>Set this property's value with <a href="#setTextFormat">setTextFormat</a>() and get this property's value with <a href="#textFormat">textFormat</a>().
|
---|
| 1576 | <h3 class=fn>int <a name="undoDepth-prop"></a>undoDepth</h3>
|
---|
| 1577 | <p>This property holds the depth of the undo history.
|
---|
| 1578 | <p>The maximum number of steps in the undo/redo history. The default
|
---|
| 1579 | is 100.
|
---|
| 1580 | <p> <p>See also <a href="#undo">undo</a>() and <a href="#redo">redo</a>().
|
---|
| 1581 |
|
---|
| 1582 | <p>Set this property's value with <a href="#setUndoDepth">setUndoDepth</a>() and get this property's value with <a href="#undoDepth">undoDepth</a>().
|
---|
| 1583 | <h3 class=fn>bool <a name="undoRedoEnabled-prop"></a>undoRedoEnabled</h3>
|
---|
| 1584 | <p>This property holds whether undo/redo is enabled.
|
---|
| 1585 | <p>When changing this property, the undo/redo history is cleared.
|
---|
| 1586 | <p> The default is TRUE.
|
---|
| 1587 |
|
---|
| 1588 | <p>Set this property's value with <a href="#setUndoRedoEnabled">setUndoRedoEnabled</a>() and get this property's value with <a href="#isUndoRedoEnabled">isUndoRedoEnabled</a>().
|
---|
| 1589 | <h3 class=fn><a href="qtextedit.html#WordWrap-enum">WordWrap</a> <a name="wordWrap-prop"></a>wordWrap</h3>
|
---|
| 1590 | <p>This property holds the word wrap mode.
|
---|
| 1591 | <p>The default mode is <a href="#WordWrap-enum">WidgetWidth</a> which causes words to be
|
---|
| 1592 | wrapped at the right edge of the text edit. Wrapping occurs at
|
---|
| 1593 | whitespace, keeping whole words intact. If you want wrapping to
|
---|
| 1594 | occur within words use <a href="#setWrapPolicy">setWrapPolicy</a>(). If you set a wrap mode of
|
---|
| 1595 | <a href="#WordWrap-enum">FixedPixelWidth</a> or <a href="#WordWrap-enum">FixedColumnWidth</a> you should also call
|
---|
| 1596 | <a href="#setWrapColumnOrWidth">setWrapColumnOrWidth</a>() with the width you want.
|
---|
| 1597 | <p> <p>See also <a href="#WordWrap-enum">WordWrap</a>, <a href="#wrapColumnOrWidth-prop">wrapColumnOrWidth</a>, and <a href="#wrapPolicy-prop">wrapPolicy</a>.
|
---|
| 1598 |
|
---|
| 1599 | <p>Set this property's value with <a href="#setWordWrap">setWordWrap</a>() and get this property's value with <a href="#wordWrap">wordWrap</a>().
|
---|
| 1600 | <h3 class=fn>int <a name="wrapColumnOrWidth-prop"></a>wrapColumnOrWidth</h3>
|
---|
| 1601 | <p>This property holds the position (in pixels or columns depending on the wrap mode) where text will be wrapped.
|
---|
| 1602 | <p>If the wrap mode is <a href="#WordWrap-enum">FixedPixelWidth</a>, the value is the number of
|
---|
| 1603 | pixels from the left edge of the text edit at which text should be
|
---|
| 1604 | wrapped. If the wrap mode is <a href="#WordWrap-enum">FixedColumnWidth</a>, the value is the
|
---|
| 1605 | column number (in character columns) from the left edge of the
|
---|
| 1606 | text edit at which text should be wrapped.
|
---|
| 1607 | <p> <p>See also <a href="#wordWrap-prop">wordWrap</a>.
|
---|
| 1608 |
|
---|
| 1609 | <p>Set this property's value with <a href="#setWrapColumnOrWidth">setWrapColumnOrWidth</a>() and get this property's value with <a href="#wrapColumnOrWidth">wrapColumnOrWidth</a>().
|
---|
| 1610 | <h3 class=fn><a href="qtextedit.html#WrapPolicy-enum">WrapPolicy</a> <a name="wrapPolicy-prop"></a>wrapPolicy</h3>
|
---|
| 1611 | <p>This property holds the word wrap policy, at whitespace or anywhere.
|
---|
| 1612 | <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>
|
---|
| 1613 | <p> <p>See also <a href="#wordWrap-prop">wordWrap</a>.
|
---|
| 1614 |
|
---|
| 1615 | <p>Set this property's value with <a href="#setWrapPolicy">setWrapPolicy</a>() and get this property's value with <a href="#wrapPolicy">wrapPolicy</a>().
|
---|
| 1616 | <!-- eof -->
|
---|
| 1617 | <hr><p>
|
---|
| 1618 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 1619 | Copyright © 1995-2007
|
---|
| 1620 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 1621 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 1622 | <td>Copyright © 2007
|
---|
| 1623 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 1624 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 1625 | </table></div></address></body>
|
---|
| 1626 | </html>
|
---|