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