You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/man/man3/tqtextedit.3qt

1453 lines
73 KiB

'\" t
.TH QTextEdit 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QTextEdit \- Powerful single-page rich text editor
.SH SYNOPSIS
\fC#include <ntqtextedit.h>\fR
.PP
Inherits QScrollView.
.PP
Inherited by QMultiLineEdit, QTextBrowser, and QTextView.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "enum \fBWordWrap\fR { NoWrap, WidgetWidth, FixedPixelWidth, FixedColumnWidth }"
.br
.ti -1c
.BI "enum \fBWrapPolicy\fR { AtWordBoundary, AtWhiteSpace = AtWordBoundary, Anywhere, AtWordOrDocumentBoundary }"
.br
.ti -1c
.BI "enum \fBAutoFormatting\fR { AutoNone = 0, AutoBulletList = 0x00000001, AutoAll = 0xffffffff }"
.br
.ti -1c
.BI "enum \fBKeyboardAction\fR { ActionBackspace, ActionDelete, ActionReturn, ActionKill, ActionWordBackspace, ActionWordDelete }"
.br
.ti -1c
.BI "enum \fBCursorAction\fR { MoveBackward, MoveForward, MoveWordBackward, MoveWordForward, MoveUp, MoveDown, MoveLineStart, MoveLineEnd, MoveHome, MoveEnd, MovePgUp, MovePgDown }"
.br
.ti -1c
.BI "enum \fBVerticalAlignment\fR { AlignNormal, AlignSuperScript, AlignSubScript }"
.br
.ti -1c
.BI "\fBQTextEdit\fR ( const TQString & text, const TQString & context = TQString::null, TQWidget * parent = 0, const char * name = 0 )"
.br
.ti -1c
.BI "\fBQTextEdit\fR ( TQWidget * parent = 0, const char * name = 0 )"
.br
.ti -1c
.BI "TQString \fBtext\fR () const"
.br
.ti -1c
.BI "TQString \fBtext\fR ( int para ) const"
.br
.ti -1c
.BI "TextFormat \fBtextFormat\fR () const"
.br
.ti -1c
.BI "TQString \fBcontext\fR () const"
.br
.ti -1c
.BI "TQString \fBdocumentTitle\fR () const"
.br
.ti -1c
.BI "void \fBgetSelection\fR ( int * paraFrom, int * indexFrom, int * paraTo, int * indexTo, int selNum = 0 ) const"
.br
.ti -1c
.BI "virtual bool \fBfind\fR ( const TQString & expr, bool cs, bool wo, bool forward = TRUE, int * para = 0, int * index = 0 )"
.br
.ti -1c
.BI "int \fBparagraphs\fR () const"
.br
.ti -1c
.BI "int \fBlines\fR () const"
.br
.ti -1c
.BI "int \fBlinesOfParagraph\fR ( int para ) const"
.br
.ti -1c
.BI "int \fBlineOfChar\fR ( int para, int index )"
.br
.ti -1c
.BI "int \fBlength\fR () const"
.br
.ti -1c
.BI "QRect \fBparagraphRect\fR ( int para ) const"
.br
.ti -1c
.BI "int \fBparagraphAt\fR ( const QPoint & pos ) const"
.br
.ti -1c
.BI "int \fBcharAt\fR ( const QPoint & pos, int * para ) const"
.br
.ti -1c
.BI "int \fBparagraphLength\fR ( int para ) const"
.br
.ti -1c
.BI "QStyleSheet * \fBstyleSheet\fR () const"
.br
.ti -1c
.BI "QMimeSourceFactory * \fBmimeSourceFactory\fR () const"
.br
.ti -1c
.BI "QBrush \fBpaper\fR () const"
.br
.ti -1c
.BI "bool \fBlinkUnderline\fR () const"
.br
.ti -1c
.BI "virtual int \fBheightForWidth\fR ( int w ) const"
.br
.ti -1c
.BI "bool \fBhasSelectedText\fR () const"
.br
.ti -1c
.BI "TQString \fBselectedText\fR () const"
.br
.ti -1c
.BI "bool \fBisUndoAvailable\fR () const"
.br
.ti -1c
.BI "bool \fBisRedoAvailable\fR () const"
.br
.ti -1c
.BI "WordWrap \fBwordWrap\fR () const"
.br
.ti -1c
.BI "int \fBwrapColumnOrWidth\fR () const"
.br
.ti -1c
.BI "WrapPolicy \fBwrapPolicy\fR () const"
.br
.ti -1c
.BI "int \fBtabStopWidth\fR () const"
.br
.ti -1c
.BI "TQString \fBanchorAt\fR ( const QPoint & pos )"
.br
.ti -1c
.BI "TQString \fBanchorAt\fR ( const QPoint & pos, AnchorAttribute attr )"
.br
.ti -1c
.BI "bool \fBisReadOnly\fR () const"
.br
.ti -1c
.BI "void \fBgetCursorPosition\fR ( int * para, int * index ) const"
.br
.ti -1c
.BI "bool \fBisModified\fR () const"
.br
.ti -1c
.BI "bool \fBitalic\fR () const"
.br
.ti -1c
.BI "bool \fBbold\fR () const"
.br
.ti -1c
.BI "bool \fBunderline\fR () const"
.br
.ti -1c
.BI "TQString \fBfamily\fR () const"
.br
.ti -1c
.BI "int \fBpointSize\fR () const"
.br
.ti -1c
.BI "TQColor \fBcolor\fR () const"
.br
.ti -1c
.BI "QFont font () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "QFont \fBcurrentFont\fR () const"
.br
.ti -1c
.BI "int \fBalignment\fR () const"
.br
.ti -1c
.BI "int \fBundoDepth\fR () const"
.br
.ti -1c
.BI "bool \fBisOverwriteMode\fR () const"
.br
.ti -1c
.BI "TQColor \fBparagraphBackgroundColor\fR ( int para ) const"
.br
.ti -1c
.BI "bool \fBisUndoRedoEnabled\fR () const"
.br
.ti -1c
.BI "bool \fBtabChangesFocus\fR () const"
.br
.ti -1c
.BI "void \fBsetAutoFormatting\fR ( uint features )"
.br
.ti -1c
.BI "uint \fBautoFormatting\fR () const"
.br
.ti -1c
.BI "QSyntaxHighlighter * \fBsyntaxHighlighter\fR () const"
.br
.in -1c
.SS "Public Slots"
.in +1c
.ti -1c
.BI "virtual void \fBsetMimeSourceFactory\fR ( QMimeSourceFactory * factory )"
.br
.ti -1c
.BI "virtual void \fBsetStyleSheet\fR ( QStyleSheet * styleSheet )"
.br
.ti -1c
.BI "virtual void \fBscrollToAnchor\fR ( const TQString & name )"
.br
.ti -1c
.BI "virtual void \fBsetPaper\fR ( const QBrush & pap )"
.br
.ti -1c
.BI "virtual void \fBsetLinkUnderline\fR ( bool )"
.br
.ti -1c
.BI "virtual void \fBsetWordWrap\fR ( WordWrap mode )"
.br
.ti -1c
.BI "virtual void \fBsetWrapColumnOrWidth\fR ( int )"
.br
.ti -1c
.BI "virtual void \fBsetWrapPolicy\fR ( WrapPolicy policy )"
.br
.ti -1c
.BI "virtual void \fBcopy\fR ()"
.br
.ti -1c
.BI "virtual void \fBappend\fR ( const TQString & text )"
.br
.ti -1c
.BI "void \fBsetText\fR ( const TQString & txt )"
.br
.ti -1c
.BI "virtual void \fBsetText\fR ( const TQString & text, const TQString & context )"
.br
.ti -1c
.BI "virtual void \fBsetTextFormat\fR ( TextFormat f )"
.br
.ti -1c
.BI "virtual void \fBselectAll\fR ( bool select = TRUE )"
.br
.ti -1c
.BI "virtual void \fBsetTabStopWidth\fR ( int ts )"
.br
.ti -1c
.BI "virtual void \fBzoomIn\fR ( int range )"
.br
.ti -1c
.BI "virtual void \fBzoomIn\fR ()"
.br
.ti -1c
.BI "virtual void \fBzoomOut\fR ( int range )"
.br
.ti -1c
.BI "virtual void \fBzoomOut\fR ()"
.br
.ti -1c
.BI "virtual void \fBzoomTo\fR ( int size )"
.br
.ti -1c
.BI "virtual void \fBsync\fR ()"
.br
.ti -1c
.BI "virtual void \fBsetReadOnly\fR ( bool b )"
.br
.ti -1c
.BI "virtual void \fBundo\fR ()"
.br
.ti -1c
.BI "virtual void \fBredo\fR ()"
.br
.ti -1c
.BI "virtual void \fBcut\fR ()"
.br
.ti -1c
.BI "virtual void \fBpaste\fR ()"
.br
.ti -1c
.BI "virtual void \fBpasteSubType\fR ( const QCString & subtype )"
.br
.ti -1c
.BI "virtual void \fBclear\fR ()"
.br
.ti -1c
.BI "virtual void \fBdel\fR ()"
.br
.ti -1c
.BI "virtual void \fBsetItalic\fR ( bool b )"
.br
.ti -1c
.BI "virtual void \fBsetBold\fR ( bool b )"
.br
.ti -1c
.BI "virtual void \fBsetUnderline\fR ( bool b )"
.br
.ti -1c
.BI "virtual void \fBsetFamily\fR ( const TQString & fontFamily )"
.br
.ti -1c
.BI "virtual void \fBsetPointSize\fR ( int s )"
.br
.ti -1c
.BI "virtual void \fBsetColor\fR ( const TQColor & c )"
.br
.ti -1c
.BI "virtual void \fBsetVerticalAlignment\fR ( VerticalAlignment a )"
.br
.ti -1c
.BI "virtual void \fBsetAlignment\fR ( int a )"
.br
.ti -1c
.BI "virtual void \fBsetCursorPosition\fR ( int para, int index )"
.br
.ti -1c
.BI "virtual void \fBsetSelection\fR ( int paraFrom, int indexFrom, int paraTo, int indexTo, int selNum = 0 )"
.br
.ti -1c
.BI "virtual void \fBsetSelectionAttributes\fR ( int selNum, const TQColor & back, bool invertText )"
.br
.ti -1c
.BI "virtual void \fBsetModified\fR ( bool m )"
.br
.ti -1c
.BI "virtual void \fBsetUndoDepth\fR ( int d )"
.br
.ti -1c
.BI "virtual void \fBensureCursorVisible\fR ()"
.br
.ti -1c
.BI "virtual void \fBplaceCursor\fR ( const QPoint & pos, QTextCursor * c = 0 )"
.br
.ti -1c
.BI "virtual void \fBmoveCursor\fR ( CursorAction action, bool select )"
.br
.ti -1c
.BI "virtual void \fBdoKeyboardAction\fR ( KeyboardAction action )"
.br
.ti -1c
.BI "virtual void \fBremoveSelectedText\fR ( int selNum = 0 )"
.br
.ti -1c
.BI "virtual void \fBremoveSelection\fR ( int selNum = 0 )"
.br
.ti -1c
.BI "virtual void \fBsetCurrentFont\fR ( const QFont & f )"
.br
.ti -1c
.BI "virtual void \fBsetOverwriteMode\fR ( bool b )"
.br
.ti -1c
.BI "virtual void \fBscrollToBottom\fR ()"
.br
.ti -1c
.BI "void \fBinsert\fR ( const TQString & text, uint insertionFlags = CheckNewLines | RemoveSelected )"
.br
.ti -1c
.BI "virtual void insert ( const TQString & text, bool indent, bool checkNewLine = TRUE, bool removeSelected = TRUE ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "virtual void \fBinsertAt\fR ( const TQString & text, int para, int index )"
.br
.ti -1c
.BI "virtual void \fBremoveParagraph\fR ( int para )"
.br
.ti -1c
.BI "virtual void \fBinsertParagraph\fR ( const TQString & text, int para )"
.br
.ti -1c
.BI "virtual void \fBsetParagraphBackgroundColor\fR ( int para, const TQColor & bg )"
.br
.ti -1c
.BI "virtual void \fBclearParagraphBackground\fR ( int para )"
.br
.ti -1c
.BI "virtual void \fBsetUndoRedoEnabled\fR ( bool b )"
.br
.ti -1c
.BI "void \fBsetTabChangesFocus\fR ( bool b )"
.br
.ti -1c
.BI "void \fBsetMaxLogLines\fR ( int limit )"
.br
.ti -1c
.BI "int \fBmaxLogLines\fR ()"
.br
.in -1c
.SS "Signals"
.in +1c
.ti -1c
.BI "void \fBtextChanged\fR ()"
.br
.ti -1c
.BI "void \fBselectionChanged\fR ()"
.br
.ti -1c
.BI "void \fBcopyAvailable\fR ( bool yes )"
.br
.ti -1c
.BI "void \fBundoAvailable\fR ( bool yes )"
.br
.ti -1c
.BI "void \fBredoAvailable\fR ( bool yes )"
.br
.ti -1c
.BI "void \fBcurrentFontChanged\fR ( const QFont & f )"
.br
.ti -1c
.BI "void \fBcurrentColorChanged\fR ( const TQColor & c )"
.br
.ti -1c
.BI "void \fBcurrentAlignmentChanged\fR ( int a )"
.br
.ti -1c
.BI "void \fBcurrentVerticalAlignmentChanged\fR ( VerticalAlignment a )"
.br
.ti -1c
.BI "void \fBcursorPositionChanged\fR ( int para, int pos )"
.br
.ti -1c
.BI "void \fBreturnPressed\fR ()"
.br
.ti -1c
.BI "void \fBmodificationChanged\fR ( bool m )"
.br
.ti -1c
.BI "void \fBclicked\fR ( int para, int pos )"
.br
.ti -1c
.BI "void \fBdoubleClicked\fR ( int para, int pos )"
.br
.in -1c
.SS "Properties"
.in +1c
.ti -1c
.BI "AutoFormatting \fBautoFormatting\fR - the enabled set of auto formatting features"
.br
.ti -1c
.BI "TQString \fBdocumentTitle\fR - the title of the document parsed from the text \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "bool \fBhasSelectedText\fR - whether some text is selected in selection 0 \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "int \fBlength\fR - the number of characters in the text \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "bool \fBlinkUnderline\fR - whether hypertext links will be underlined"
.br
.ti -1c
.BI "bool \fBmodified\fR - whether the document has been modified by the user"
.br
.ti -1c
.BI "bool \fBoverwriteMode\fR - the text edit's overwrite mode"
.br
.ti -1c
.BI "QBrush \fBpaper\fR - the background (paper) brush"
.br
.ti -1c
.BI "bool \fBreadOnly\fR - whether the text edit is read-only"
.br
.ti -1c
.BI "TQString \fBselectedText\fR - the selected text (from selection " "0" ") or an empty string if there is no currently selected text (in selection " "0" ") \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "bool \fBtabChangesFocus\fR - whether TAB changes focus or is accepted as input"
.br
.ti -1c
.BI "int \fBtabStopWidth\fR - the tab stop width in pixels"
.br
.ti -1c
.BI "TQString \fBtext\fR - the text edit's text"
.br
.ti -1c
.BI "TextFormat \fBtextFormat\fR - the text format: rich " "text" ", plain " "text" ", log text or auto text"
.br
.ti -1c
.BI "int \fBundoDepth\fR - the depth of the undo history"
.br
.ti -1c
.BI "bool \fBundoRedoEnabled\fR - whether undo/redo is enabled"
.br
.ti -1c
.BI "WordWrap \fBwordWrap\fR - the word wrap mode"
.br
.ti -1c
.BI "int \fBwrapColumnOrWidth\fR - the position (in pixels or columns depending on the wrap " "mode" ") where text will be wrapped"
.br
.ti -1c
.BI "WrapPolicy \fBwrapPolicy\fR - the word wrap " "policy" ", at whitespace or anywhere"
.br
.in -1c
.SS "Protected Members"
.in +1c
.ti -1c
.BI "void \fBrepaintChanged\fR ()"
.br
.ti -1c
.BI "virtual void \fBkeyPressEvent\fR ( QKeyEvent * e )"
.br
.ti -1c
.BI "virtual bool \fBfocusNextPrevChild\fR ( bool n )"
.br
.ti -1c
.BI "QTextCursor * \fBtextCursor\fR () const"
.br
.ti -1c
.BI "virtual QPopupMenu * \fBcreatePopupMenu\fR ( const QPoint & pos )"
.br
.ti -1c
.BI "virtual QPopupMenu * createPopupMenu () \fI(obsolete)\fR"
.br
.in -1c
.SH DESCRIPTION
The QTextEdit widget provides a powerful single-page rich text editor.
.PP
.TP
Introduction and Concepts
.TP
Using QTextEdit as a Display Widget
.TP
Read-only key bindings
.TP
Using QTextEdit in LogText Mode
.TP
Using QTextEdit as an Editor
.TP
Editing key bindings
.SH "Introduction and Concepts"
QTextEdit is an advanced WYSIWYG viewer/editor supporting rich text formatting using HTML-style tags. It is optimized to handle large documents and to respond quickly to user input.
.PP
QTextEdit has four modes of operation: <center>.nf
.TS
l - l. Mode Command Notes Plain Text Editor setTextFormat(PlainText) Set text with setText(); text() returns plain text. Text attributes (e.g. colors) can be set, but plain text is always returned. Rich Text Editor setTextFormat(RichText) Set text with setText(); text() returns rich text. Rich text editing is fairly limited. You can't set margins or insert images for example (although you can read and correctly display files that have margins set and that include images). This mode is mostly useful for editing small amounts of rich text. Text Viewer setReadOnly(TRUE) Set text with setText() or append() (which has no undo history so is faster and uses less memory); text() returns plain or rich text depending on the textFormat(). This mode can correctly display a large subset of HTML tags. Log Viewer setTextFormat(LogText)
.TE
.fi
</center>
.PP
<sup>1.</sup><small>A more complete API that supports setting margins, images, etc., is planned for a later TQt release.</small>
.PP
QTextEdit can be used as a syntax highlighting editor when used in conjunction with QSyntaxHighlighter.
.PP
We recommend that you always call setTextFormat() to set the mode you want to use. If you use AutoText then setText() and append() will try to determine whether the text they are given is plain text or rich text. If you use RichText then setText() and append() will assume that the text they are given is rich text. insert() simply inserts the text it is given.
.PP
QTextEdit works on paragraphs and characters. A paragraph is a formatted string which is word-wrapped to fit into the width of the widget. By default when reading plain text, one newline signify a paragraph. A document consists of zero or more paragraphs, indexed from 0. Characters are indexed on a per-paragraph basis, also indexed from 0. The words in the paragraph are aligned in accordance with the paragraph's alignment(). Paragraphs are separated by hard line breaks. Each character within a paragraph has its own attributes, for example, font and color.
.PP
The text edit documentation uses the following concepts:
.TP
\fIcurrent format\fR -- this is the format at the current cursor position, \fIand\fR it is the format of the selected text if any.
.TP
\fIcurrent paragraph\fR -- the paragraph which contains the cursor.
.PP
QTextEdit can display images (using QMimeSourceFactory), lists and tables. If the text is too large to view within the text edit's viewport, scrollbars will appear. The text edit can load both plain text and HTML files (a subset of HTML 3.2 and 4). The rendering style and the set of valid tags are defined by a styleSheet(). Custom tags can be created and placed in a custom style sheet. Change the style sheet with setStyleSheet(); see QStyleSheet for details. The images identified by image tags are displayed if they can be interpreted using the text edit's QMimeSourceFactory; see setMimeSourceFactory().
.PP
If you want a text browser with more navigation use QTextBrowser. If you just need to display a small piece of rich text use QLabel or QSimpleRichText.
.PP
If you create a new QTextEdit, and want to allow the user to edit rich text, call setTextFormat(TQt::RichText) to ensure that the text is treated as rich text. (Rich text uses HTML tags to set text formatting attributes. See QStyleSheet for information on the HTML tags that are supported.). If you don't call setTextFormat() explicitly the text edit will guess from the text itself whether it is rich text or plain text. This means that if the text looks like HTML or XML it will probably be interpreted as rich text, so you should call setTextFormat(TQt::PlainText) to preserve such text.
.PP
Note that we do not intend to add a full-featured web browser widget to TQt (because that would easily double Qt's size and only a few applications would benefit from it). The rich text support in TQt is designed to provide a fast, portable and efficient way to add reasonable online help facilities to applications, and to provide a basis for rich text editors.
.SH "Using QTextEdit as a Display Widget"
QTextEdit can display a large HTML subset, including tables and images.
.PP
The text is set or replaced using setText() which deletes any existing text and replaces it with the text passed in the setText() call. If you call setText() with legacy HTML (with setTextFormat(RichText) in force), and then call text(), the text that is returned may have different markup, but will render the same. Text can be inserted with insert(), paste(), pasteSubType() and append(). Text that is appended does not go into the undo history; this makes append() faster and consumes less memory. Text can also be cut(). The entire text is deleted with clear() and the selected text is deleted with removeSelectedText(). Selected (marked) text can also be deleted with del() (which will delete the character to the right of the cursor if no text is selected).
.PP
Loading and saving text is achieved using setText() and text(), for example:
.PP
.nf
.br
QFile file( fileName ); // Read the text from a file
.br
if ( file.open( IO_ReadOnly ) ) {
.br
QTextStream stream( &file );
.br
textEdit->setText( stream.read() );
.br
}
.br
.br
QFile file( fileName ); // Write the text to a file
.br
if ( file.open( IO_WriteOnly ) ) {
.br
QTextStream stream( &file );
.br
stream << textEdit->text();
.br
textEdit->setModified( FALSE );
.br
}
.br
.fi
.PP
By default the text edit wraps words at whitespace to fit within the text edit widget. The setWordWrap() function is used to specify the kind of word wrap you want, or NoWrap if you don't want any wrapping. Call setWordWrap() to set a fixed pixel width FixedPixelWidth, or character column (e.g. 80 column) FixedColumnWidth with the pixels or columns specified with setWrapColumnOrWidth(). If you use word wrap to the widget's width WidgetWidth, you can specify whether to break on whitespace or anywhere with setWrapPolicy().
.PP
The background color is set differently than other widgets, using setPaper(). You specify a brush style which could be a plain color or a complex pixmap.
.PP
Hypertext links are automatically underlined; this can be changed with setLinkUnderline(). The tab stop width is set with setTabStopWidth().
.PP
The zoomIn() and zoomOut() functions can be used to resize the text by increasing (decreasing for zoomOut()) the point size used. Images are not affected by the zoom functions.
.PP
The lines() function returns the number of lines in the text and paragraphs() returns the number of paragraphs. The number of lines within a particular paragraph is returned by linesOfParagraph(). The length of the entire text in characters is returned by length().
.PP
You can scroll to an anchor in the text, e.g. \fC<a name="anchor">\fR with scrollToAnchor(). The find() function can be used to find and select a given string within the text.
.PP
A read-only QTextEdit provides the same functionality as the (obsolete) QTextView. (QTextView is still supplied for compatibility with old code.)
.PP
<h4> Read-only key bindings </h4>
.PP
When QTextEdit is used read-only the key-bindings are limited to navigation, and text may only be selected with the mouse: <center>.nf
.TS
l - l. Keypresses Action UpArrow Move one line up DownArrow Move one line down LeftArrow Move one character left RightArrow Move one character right PageUp Move one (viewport) page up PageDown Move one (viewport) page down Home Move to the beginning of the text End Move to the end of the text Shift+Wheel Scroll the page horizontally (the Wheel is the mouse wheel) Ctrl+Wheel
.TE
.fi
</center>
.PP
The text edit may be able to provide some meta-information. For example, the documentTitle() function will return the text from within HTML \fC<title>\fR tags.
.PP
The text displayed in a text edit has a \fIcontext\fR. The context is a path which the text edit's QMimeSourceFactory uses to resolve the locations of files and images. It is passed to the mimeSourceFactory() when quering data. (See QTextEdit() and context().)
.PP
<h4> Using QTextEdit in LogText Mode </h4>
.PP
Setting the text format to LogText puts the widget in a special mode which is optimized for very large texts. Editing, word wrap, and rich text support are disabled in this mode (the widget is explicitly made read-only). This allows the text to be stored in a different, more memory efficient manner. However, a certain degree of text formatting is supported through the use of formatting tags. A tag is delimited by \fC<\fR and \fC>\fR. The characters \fC<\fR, \fC>\fR and \fC&\fR are escaped by using \fC&lt;\fR, \fC&gt;\fR and \fC&amp;\fR. A tag pair consists of a left and a right tag (or open/close tags). Left-tags mark the starting point for formatting, while right-tags mark the ending point. A right-tag always start with a \fC/\fR before the tag keyword. For example \fC<b>\fR and \fC</b>\fR are a tag pair. Tags can be nested, but they have to be closed in the same order as they are opened. For example, \fC<b><u></u></b>\fR is valid, while \fC<b><u></b></u>\fR will output an error message.
.PP
By using tags it is possible to change the color, bold, italic and underline settings for a piece of text. A color can be specified by using the HTML font tag \fC<font color=colorname>\fR. The color name can be one of the color names from the X11 color database, or a RGB hex value (e.g \fC#00ff00\fR). Example of valid color tags: \fC<font color=red>\fR, \fC<font color="light blue">\fR, \fC<font color="#223344">\fR. Bold, italic and underline settings can be specified by the tags \fC<b>\fR, \fC<i>\fR and \fC<u>\fR. Note that a tag does not necessarily have to be closed. A valid example:
.PP
.nf
.br
This is <font color=red>red</font> while <b>this</b> is <font color=blue>blue</font>.
.br
<font color=green><font color=yellow>Yellow,</font> and <u>green</u>.
.br
.fi
.PP
Stylesheets can also be used in LogText mode. To create and use a custom tag, you could do the following:
.PP
.nf
.br
QTextEdit * log = new QTextEdit( this );
.br
log->setTextFormat( TQt::LogText );
.br
QStyleSheetItem * item = new QStyleSheetItem( log->styleSheet(), "mytag" );
.br
item->setColor( "red" );
.br
item->setFontWeight( QFont::Bold );
.br
item->setFontUnderline( TRUE );
.br
log->append( "This is a <mytag>custom tag</mytag>!" );
.br
.fi
Note that only the color, bold, underline and italic attributes of a QStyleSheetItem is used in LogText mode.
.PP
Note that you can use setMaxLogLines() to limit the number of lines the widget can hold in LogText mode.
.PP
There are a few things that you need to be aware of when the widget is in this mode:
.TP
Functions that deal with rich text formatting and cursor movement will not work or return anything valid.
.TP
Lines are equivalent to paragraphs.
.SH "Using QTextEdit as an Editor"
All the information about using QTextEdit as a display widget also applies here.
.PP
The current format's attributes are set with setItalic(), setBold(), setUnderline(), setFamily() (font family), setPointSize(), setColor() and setCurrentFont(). The current paragraph's alignment is set with setAlignment().
.PP
Use setSelection() to select text. The setSelectionAttributes() function is used to indicate how selected text should be displayed. Use hasSelectedText() to find out if any text is selected. The currently selected text's position is available using getSelection() and the selected text itself is returned by selectedText(). The selection can be copied to the clipboard with copy(), or cut to the clipboard with cut(). It can be deleted with removeSelectedText(). The entire text can be selected (or unselected) using selectAll(). QTextEdit supports multiple selections. Most of the selection functions operate on the default selection, selection 0. If the user presses a non-selecting key, e.g. a cursor key without also holding down Shift, all selections are cleared.
.PP
Set and get the position of the cursor with setCursorPosition() and getCursorPosition() respectively. When the cursor is moved, the signals currentFontChanged(), currentColorChanged() and currentAlignmentChanged() are emitted to reflect the font, color and alignment at the new cursor position.
.PP
If the text changes, the textChanged() signal is emitted, and if the user inserts a new line by pressing Return or Enter, returnPressed() is emitted. The isModified() function will return TRUE if the text has been modified.
.PP
QTextEdit provides command-based undo and redo. To set the depth of the command history use setUndoDepth() which defaults to 100 steps. To undo or redo the last operation call undo() or redo(). The signals undoAvailable() and redoAvailable() indicate whether the undo and redo operations can be executed.
.PP
The indent() function is used to reindent a paragraph. It is useful for code editors, for example in TQt Designer's code editor \fICtrl+I\fR invokes the indent() function.
.PP
<h4> Editing key bindings </h4>
.PP
The list of key-bindings which are implemented for editing: <center>.nf
.TS
l - l. Keypresses Action Backspace Delete the character to the left of the cursor Delete Delete the character to the right of the cursor Ctrl+A Move the cursor to the beginning of the line Ctrl+B Move the cursor one character left Ctrl+C Copy the marked text to the clipboard (also Ctrl+Insert under Windows) Ctrl+D Delete the character to the right of the cursor Ctrl+E Move the cursor to the end of the line Ctrl+F Move the cursor one character right Ctrl+H Delete the character to the left of the cursor Ctrl+K Delete to end of line Ctrl+N Move the cursor one line down Ctrl+P Move the cursor one line up Ctrl+V Paste the clipboard text into line edit (also Shift+Insert under Windows) Ctrl+X Cut the marked text, copy to clipboard (also Shift+Delete under Windows) Ctrl+Z Undo the last operation Ctrl+Y Redo the last operation LeftArrow Move the cursor one character left Ctrl+LeftArrow Move the cursor one word left RightArrow Move the cursor one character right Ctrl+RightArrow Move the cursor one word right UpArrow Move the cursor one line up Ctrl+UpArrow Move the cursor one word up DownArrow Move the cursor one line down Ctrl+Down Arrow Move the cursor one word down PageUp Move the cursor one page up PageDown Move the cursor one page down Home Move the cursor to the beginning of the line Ctrl+Home Move the cursor to the beginning of the text End Move the cursor to the end of the line Ctrl+End Move the cursor to the end of the text Shift+Wheel Scroll the page horizontally (the Wheel is the mouse wheel) Ctrl+Wheel
.TE
.fi
</center>
.PP
To select (mark) text hold down the Shift key whilst pressing one of the movement keystrokes, for example, \fIShift+Right Arrow\fR will select the character to the right, and \fIShift+Ctrl+Right Arrow\fR will select the word to the right, etc.
.PP
By default the text edit widget operates in insert mode so all text that the user enters is inserted into the text edit and any text to the right of the cursor is moved out of the way. The mode can be changed to overwrite, where new text overwrites any text to the right of the cursor, using setOverwriteMode().
.PP
See also Basic Widgets and Text Related Classes.
.SS "Member Type Documentation"
.SH "QTextEdit::AutoFormatting"
.TP
\fCQTextEdit::AutoNone\fR - Do not perform any automatic formatting
.TP
\fCQTextEdit::AutoBulletList\fR - Only automatically format bulletted lists
.TP
\fCQTextEdit::AutoAll\fR - Apply all available autoformatting
.SH "QTextEdit::CursorAction"
This enum is used by moveCursor() to specify in which direction the cursor should be moved:
.TP
\fCQTextEdit::MoveBackward\fR - Moves the cursor one character backward
.TP
\fCQTextEdit::MoveWordBackward\fR - Moves the cursor one word backward
.TP
\fCQTextEdit::MoveForward\fR - Moves the cursor one character forward
.TP
\fCQTextEdit::MoveWordForward\fR - Moves the cursor one word forward
.TP
\fCQTextEdit::MoveUp\fR - Moves the cursor up one line
.TP
\fCQTextEdit::MoveDown\fR - Moves the cursor down one line
.TP
\fCQTextEdit::MoveLineStart\fR - Moves the cursor to the beginning of the line
.TP
\fCQTextEdit::MoveLineEnd\fR - Moves the cursor to the end of the line
.TP
\fCQTextEdit::MoveHome\fR - Moves the cursor to the beginning of the document
.TP
\fCQTextEdit::MoveEnd\fR - Moves the cursor to the end of the document
.TP
\fCQTextEdit::MovePgUp\fR - Moves the cursor one viewport page up
.TP
\fCQTextEdit::MovePgDown\fR - Moves the cursor one viewport page down
.SH "QTextEdit::KeyboardAction"
This enum is used by doKeyboardAction() to specify which action should be executed:
.TP
\fCQTextEdit::ActionBackspace\fR - Delete the character to the left of the cursor.
.TP
\fCQTextEdit::ActionDelete\fR - Delete the character to the right of the cursor.
.TP
\fCQTextEdit::ActionReturn\fR - Split the paragraph at the cursor position.
.TP
\fCQTextEdit::ActionKill\fR - If the cursor is not at the end of the paragraph, delete the text from the cursor position until the end of the paragraph. If the cursor is at the end of the paragraph, delete the hard line break at the end of the paragraph: this will cause this paragraph to be joined with the following paragraph.
.TP
\fCQTextEdit::ActionWordBackspace\fR - Delete the word to the left of the cursor position.
.TP
\fCQTextEdit::ActionWordDelete\fR - Delete the word to the right of the cursor position
.SH "QTextEdit::VerticalAlignment"
This enum is used to set the vertical alignment of the text.
.TP
\fCQTextEdit::AlignNormal\fR - Normal alignment
.TP
\fCQTextEdit::AlignSuperScript\fR - Superscript
.TP
\fCQTextEdit::AlignSubScript\fR - Subscript
.SH "QTextEdit::WordWrap"
This enum defines the QTextEdit's word wrap modes.
.TP
\fCQTextEdit::NoWrap\fR - Do not wrap the text.
.TP
\fCQTextEdit::WidgetWidth\fR - Wrap the text at the current width of the widget (this is the default). Wrapping is at whitespace by default; this can be changed with setWrapPolicy().
.TP
\fCQTextEdit::FixedPixelWidth\fR - Wrap the text at a fixed number of pixels from the widget's left side. The number of pixels is set with wrapColumnOrWidth().
.TP
\fCQTextEdit::FixedColumnWidth\fR - Wrap the text at a fixed number of character columns from the widget's left side. The number of characters is set with wrapColumnOrWidth(). This is useful if you need formatted text that can also be displayed gracefully on devices with monospaced fonts, for example a standard VT100 terminal, where you might set wrapColumnOrWidth() to 80.
.PP
See also wordWrap and wordWrap.
.SH "QTextEdit::WrapPolicy"
This enum defines where text can be wrapped in word wrap mode.
.TP
\fCQTextEdit::AtWhiteSpace\fR - Don't use this deprecated value (it is a synonym for AtWordBoundary which you should use instead).
.TP
\fCQTextEdit::Anywhere\fR - Break anywhere, including within words.
.TP
\fCQTextEdit::AtWordBoundary\fR - Break lines at word boundaries, e.g. spaces or newlines
.TP
\fCQTextEdit::AtWordOrDocumentBoundary\fR - Break lines at whitespace, e.g. spaces or newlines if possible. Break it anywhere otherwise.
.PP
See also wrapPolicy.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QTextEdit::QTextEdit ( const TQString & text, const TQString & context = TQString::null, TQWidget * parent = 0, const char * name = 0 )"
Constructs a QTextEdit called \fIname\fR, with parent \fIparent\fR. The text edit will display the text \fItext\fR using context \fIcontext\fR.
.PP
The \fIcontext\fR is a path which the text edit's QMimeSourceFactory uses to resolve the locations of files and images. It is passed to the mimeSourceFactory() when quering data.
.PP
For example if the text contains an image tag, \fC<img src="image.png">\fR, and the context is "path/to/look/in", the QMimeSourceFactory will try to load the image from" path/to/look/in/image.png". If the tag was \fC<img src="/image.png">\fR, the context will not be used (because QMimeSourceFactory recognizes that we have used an absolute path) and will try to load "/image.png". The context is applied in exactly the same way to \fIhrefs\fR, for example, \fC<a href="target.html">Target</a>\fR, would resolve to" path/to/look/in/target.html".
.SH "QTextEdit::QTextEdit ( TQWidget * parent = 0, const char * name = 0 )"
Constructs an empty QTextEdit called \fIname\fR, with parent \fIparent\fR.
.SH "int QTextEdit::alignment () const"
Returns the alignment of the current paragraph.
.PP
See also setAlignment().
.SH "TQString QTextEdit::anchorAt ( const QPoint & pos, AnchorAttribute attr )"
If there is an anchor at position \fIpos\fR (in contents coordinates), the text for attribute \fIattr\fR is returned, otherwise TQString::null is returned.
.SH "TQString QTextEdit::anchorAt ( const QPoint & pos )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
If there is an anchor at position \fIpos\fR (in contents coordinates), its \fChref\fR is returned, otherwise TQString::null is returned.
.SH "void QTextEdit::append ( const TQString & text )\fC [virtual slot]\fR"
Appends a new paragraph with \fItext\fR to the end of the text edit. Note that the undo/redo history is cleared by this function, and no undo history is kept for appends which makes them faster than insert()s. If you want to append text which is added to the undo/redo history as well, use insertParagraph().
.PP
Examples:
.)l network/clientserver/client/client.cpp, network/clientserver/server/server.cpp, network/httpd/httpd.cpp, and process/process.cpp.
.SH "uint QTextEdit::autoFormatting () const"
Returns the enabled set of auto formatting features. See the "autoFormatting" property for details.
.SH "bool QTextEdit::bold () const"
Returns TRUE if the current format is bold; otherwise returns FALSE.
.PP
See also setBold().
.SH "int QTextEdit::charAt ( const QPoint & pos, int * para ) const"
Returns the index of the character (relative to its paragraph) at position \fIpos\fR (in contents coordinates). If \fIpara\fR is not 0, \fI*para\fR is set to the character's paragraph.
.SH "void QTextEdit::clear ()\fC [virtual slot]\fR"
Deletes all the text in the text edit.
.PP
See also cut(), removeSelectedText(), and text.
.SH "void QTextEdit::clearParagraphBackground ( int para )\fC [virtual slot]\fR"
Clears the background color of the paragraph \fIpara\fR, so that the default color is used again.
.SH "void QTextEdit::clicked ( int para, int pos )\fC [signal]\fR"
This signal is emitted when the mouse is clicked on the paragraph \fIpara\fR at character position \fIpos\fR.
.PP
See also doubleClicked().
.SH "TQColor QTextEdit::color () const"
Returns the color of the current format.
.PP
See also setColor() and paper.
.SH "TQString QTextEdit::context () const"
Returns the context of the text edit. The context is a path which the text edit's QMimeSourceFactory uses to resolve the locations of files and images.
.PP
See also text.
.PP
Examples:
.)l action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp, mdi/application.cpp, and qdir/qdir.cpp.
.SH "void QTextEdit::copy ()\fC [virtual slot]\fR"
Copies any selected text (from selection 0) to the clipboard.
.PP
See also hasSelectedText and copyAvailable().
.SH "void QTextEdit::copyAvailable ( bool yes )\fC [signal]\fR"
This signal is emitted when text is selected or de-selected in the text edit.
.PP
When text is selected this signal will be emitted with \fIyes\fR set to TRUE. If no text has been selected or if the selected text is de-selected this signal is emitted with \fIyes\fR set to FALSE.
.PP
If \fIyes\fR is TRUE then copy() can be used to copy the selection to the clipboard. If \fIyes\fR is FALSE then copy() does nothing.
.PP
See also selectionChanged().
.SH "QPopupMenu * QTextEdit::createPopupMenu ( const QPoint & pos )\fC [virtual protected]\fR"
This function is called to create a right mouse button popup menu at the document position \fIpos\fR. If you want to create a custom popup menu, reimplement this function and return the created popup menu. Ownership of the popup menu is transferred to the caller.
.PP
\fBWarning:\fR The QPopupMenu ID values 0-7 are reserved, and they map to the standard operations. When inserting items into your custom popup menu, be sure to specify ID values larger than 7.
.SH "QPopupMenu * QTextEdit::createPopupMenu ()\fC [virtual protected]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
This function is called to create a right mouse button popup menu. If you want to create a custom popup menu, reimplement this function and return the created popup menu. Ownership of the popup menu is transferred to the caller.
.PP
This function is only called if createPopupMenu( const QPoint & ) returns 0.
.SH "void QTextEdit::currentAlignmentChanged ( int a )\fC [signal]\fR"
This signal is emitted if the alignment of the current paragraph has changed.
.PP
The new alignment is \fIa\fR.
.PP
See also setAlignment().
.SH "void QTextEdit::currentColorChanged ( const TQColor & c )\fC [signal]\fR"
This signal is emitted if the color of the current format has changed.
.PP
The new color is \fIc\fR.
.PP
See also setColor().
.SH "QFont QTextEdit::currentFont () const"
Returns the font of the current format.
.PP
See also setCurrentFont(), setFamily(), and setPointSize().
.SH "void QTextEdit::currentFontChanged ( const QFont & f )\fC [signal]\fR"
This signal is emitted if the font of the current format has changed.
.PP
The new font is \fIf\fR.
.PP
See also setCurrentFont().
.SH "void QTextEdit::currentVerticalAlignmentChanged ( VerticalAlignment a )\fC [signal]\fR"
This signal is emitted if the vertical alignment of the current format has changed.
.PP
The new vertical alignment is \fIa\fR.
.PP
See also setVerticalAlignment().
.SH "void QTextEdit::cursorPositionChanged ( int para, int pos )\fC [signal]\fR"
This signal is emitted if the position of the cursor has changed. \fIpara\fR contains the paragraph index and \fIpos\fR contains the character position within the paragraph.
.PP
See also setCursorPosition().
.SH "void QTextEdit::cut ()\fC [virtual slot]\fR"
Copies the selected text (from selection 0) to the clipboard and deletes it from the text edit.
.PP
If there is no selected text (in selection 0) nothing happens.
.PP
See also QTextEdit::copy(), paste(), and pasteSubType().
.SH "void QTextEdit::del ()\fC [virtual slot]\fR"
If there is some selected text (in selection 0) it is deleted. If there is no selected text (in selection 0) the character to the right of the text cursor is deleted.
.PP
See also removeSelectedText() and cut().
.SH "void QTextEdit::doKeyboardAction ( KeyboardAction action )\fC [virtual slot]\fR"
Executes keyboard action \fIaction\fR. This is normally called by a key event handler.
.SH "TQString QTextEdit::documentTitle () const"
Returns the title of the document parsed from the text. See the "documentTitle" property for details.
.SH "void QTextEdit::doubleClicked ( int para, int pos )\fC [signal]\fR"
This signal is emitted when the mouse is double-clicked on the paragraph \fIpara\fR at character position \fIpos\fR.
.PP
See also clicked().
.SH "void QTextEdit::ensureCursorVisible ()\fC [virtual slot]\fR"
Ensures that the cursor is visible by scrolling the text edit if necessary.
.PP
See also setCursorPosition().
.SH "TQString QTextEdit::family () const"
Returns the font family of the current format.
.PP
See also setFamily(), setCurrentFont(), and setPointSize().
.SH "bool QTextEdit::find ( const TQString & expr, bool cs, bool wo, bool forward = TRUE, int * para = 0, int * index = 0 )\fC [virtual]\fR"
Finds the next occurrence of the string, \fIexpr\fR. Returns TRUE if \fIexpr\fR was found; otherwise returns FALSE.
.PP
If \fIpara\fR and \fIindex\fR are both 0 the search begins from the current cursor position. If \fIpara\fR and \fIindex\fR are both not 0, the search begins from the \fI*index\fR character position in the \fI*para\fR paragraph.
.PP
If \fIcs\fR is TRUE the search is case sensitive, otherwise it is case insensitive. If \fIwo\fR is TRUE the search looks for whole word matches only; otherwise it searches for any matching text. If \fIforward\fR is TRUE (the default) the search works forward from the starting position to the end of the text, otherwise it works backwards to the beginning of the text.
.PP
If \fIexpr\fR is found the function returns TRUE. If \fIindex\fR and \fIpara\fR are not 0, the number of the paragraph in which the first character of the match was found is put into \fI*para\fR, and the index position of that character within the paragraph is put into \fI*index\fR.
.PP
If \fIexpr\fR is not found the function returns FALSE. If \fIindex\fR and \fIpara\fR are not 0 and \fIexpr\fR is not found, \fI*index\fR and \fI*para\fR are undefined.
.PP
Please note that this function will make the next occurrence of the string (if found) the current selection, and will thus modify the cursor position.
.PP
Using the \fIpara\fR and \fIindex\fR parameters will not work correctly in case the document contains tables.
.SH "bool QTextEdit::focusNextPrevChild ( bool n )\fC [virtual protected]\fR"
Reimplemented to allow tabbing through links. If \fIn\fR is TRUE the tab moves the focus to the next child; if \fIn\fR is FALSE the tab moves the focus to the previous child. Returns TRUE if the focus was moved; otherwise returns FALSE.
.SH "QFont QTextEdit::font () const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Returns QScrollView::font()
.PP
\fBWarning:\fR In previous versions this function returned the font of the current format. This lead to confusion. Please use currentFont() instead.
.PP
Example: qwerty/qwerty.cpp.
.SH "void QTextEdit::getCursorPosition ( int * para, int * index ) const"
This function sets the \fI*para\fR and \fI*index\fR parameters to the current cursor position. \fIpara\fR and \fIindex\fR must not be 0.
.PP
See also setCursorPosition().
.SH "void QTextEdit::getSelection ( int * paraFrom, int * indexFrom, int * paraTo, int * indexTo, int selNum = 0 ) const"
If there is a selection, \fI*paraFrom\fR is set to the number of the paragraph in which the selection begins and \fI*paraTo\fR is set to the number of the paragraph in which the selection ends. (They could be the same.) \fI*indexFrom\fR is set to the index at which the selection begins within \fI*paraFrom\fR, and \fI*indexTo\fR is set to the index at which the selection ends within \fI*paraTo\fR.
.PP
If there is no selection, \fI*paraFrom\fR, \fI*indexFrom\fR, \fI*paraTo\fR and \fI*indexTo\fR are all set to -1.
.PP
If \fIparaFrom\fR, \fIindexFrom\fR, \fIparaTo\fR or \fIindexTo\fR is 0 this function does nothing.
.PP
The \fIselNum\fR is the number of the selection (multiple selections are supported). It defaults to 0 (the default selection).
.PP
See also setSelection() and selectedText.
.SH "bool QTextEdit::hasSelectedText () const"
Returns TRUE if some text is selected in selection 0; otherwise returns FALSE. See the "hasSelectedText" property for details.
.SH "int QTextEdit::heightForWidth ( int w ) const\fC [virtual]\fR"
Returns how many pixels high the text edit needs to be to display all the text if the text edit is \fIw\fR pixels wide.
.PP
Reimplemented from TQWidget.
.SH "void QTextEdit::insert ( const TQString & text, uint insertionFlags = CheckNewLines | RemoveSelected )\fC [slot]\fR"
Inserts \fItext\fR at the current cursor position.
.PP
The \fIinsertionFlags\fR define how the text is inserted. If RedoIndentation is set, the paragraph is re-indented. If CheckNewLines is set, newline characters in \fItext\fR result in hard line breaks (i.e. new paragraphs). If \fCcheckNewLine\fR is not set, the behaviour of the editor is undefined if the \fItext\fR contains newlines. (It is not possible to change QTextEdit's newline handling behavior, but you can use TQString::replace() to preprocess text before inserting it.) If RemoveSelected is set, any selected text (in selection 0) is removed before the text is inserted.
.PP
The default flags are CheckNewLines | RemoveSelected.
.PP
If the widget is in LogText mode this function will do nothing.
.PP
See also paste() and pasteSubType().
.SH "void QTextEdit::insert ( const TQString & text, bool indent, bool checkNewLine = TRUE, bool removeSelected = TRUE )\fC [virtual slot]\fR"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.SH "void QTextEdit::insertAt ( const TQString & text, int para, int index )\fC [virtual slot]\fR"
Inserts \fItext\fR in the paragraph \fIpara\fR at position \fIindex\fR.
.SH "void QTextEdit::insertParagraph ( const TQString & text, int para )\fC [virtual slot]\fR"
Inserts \fItext\fR as a new paragraph at position \fIpara\fR. If \fIpara\fR is -1, the text is appended. Use append() if the append operation is performance critical.
.SH "bool QTextEdit::isModified () const"
Returns TRUE if the document has been modified by the user; otherwise returns FALSE. See the "modified" property for details.
.SH "bool QTextEdit::isOverwriteMode () const"
Returns the text edit's overwrite mode. See the "overwriteMode" property for details.
.SH "bool QTextEdit::isReadOnly () const"
Returns TRUE if the text edit is read-only; otherwise returns FALSE. See the "readOnly" property for details.
.SH "bool QTextEdit::isRedoAvailable () const"
Returns TRUE if redo is available; otherwise returns FALSE.
.SH "bool QTextEdit::isUndoAvailable () const"
Returns TRUE if undo is available; otherwise returns FALSE.
.SH "bool QTextEdit::isUndoRedoEnabled () const"
Returns TRUE if undo/redo is enabled; otherwise returns FALSE. See the "undoRedoEnabled" property for details.
.SH "bool QTextEdit::italic () const"
Returns TRUE if the current format is italic; otherwise returns FALSE.
.PP
See also setItalic().
.SH "void QTextEdit::keyPressEvent ( QKeyEvent * e )\fC [virtual protected]\fR"
Processes the key event, \fIe\fR. By default key events are used to provide keyboard navigation and text editing.
.PP
Reimplemented from TQWidget.
.PP
Reimplemented in QTextBrowser.
.SH "int QTextEdit::length () const"
Returns the number of characters in the text. See the "length" property for details.
.SH "int QTextEdit::lineOfChar ( int para, int index )"
Returns the line number of the line in paragraph \fIpara\fR in which the character at position \fIindex\fR appears. The \fIindex\fR position is relative to the beginning of the paragraph. If there is no such paragraph or no such character at the \fIindex\fR position (e.g. the index is out of range) -1 is returned.
.SH "int QTextEdit::lines () const"
Returns the number of lines in the text edit; this could be 0.
.PP
\fBWarning:\fR This function may be slow. Lines change all the time during word wrapping, so this function has to iterate over all the paragraphs and get the number of lines from each one individually.
.SH "int QTextEdit::linesOfParagraph ( int para ) const"
Returns the number of lines in paragraph \fIpara\fR, or -1 if there is no paragraph with index \fIpara\fR.
.SH "bool QTextEdit::linkUnderline () const"
Returns TRUE if hypertext links will be underlined; otherwise returns FALSE. See the "linkUnderline" property for details.
.SH "int QTextEdit::maxLogLines ()\fC [slot]\fR"
Returns the maximum number of lines QTextEdit can hold in LogText mode. By default the number of lines is unlimited, which is signified by a value of -1.
.SH "QMimeSourceFactory * QTextEdit::mimeSourceFactory () const"
Returns the QMimeSourceFactory which is being used by this text edit.
.PP
See also setMimeSourceFactory().
.PP
Examples:
.)l action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp, mdi/application.cpp, and qdir/qdir.cpp.
.SH "void QTextEdit::modificationChanged ( bool m )\fC [signal]\fR"
This signal is emitted when the modification status of the document has changed. If \fIm\fR is TRUE, the document was modified, otherwise the modification state has been reset to unmodified.
.PP
See also modified.
.SH "void QTextEdit::moveCursor ( CursorAction action, bool select )\fC [virtual slot]\fR"
Moves the text cursor according to \fIaction\fR. This is normally used by some key event handler. \fIselect\fR specifies whether the text between the current cursor position and the new position should be selected.
.SH "QBrush QTextEdit::paper () const"
Returns the background (paper) brush. See the "paper" property for details.
.SH "int QTextEdit::paragraphAt ( const QPoint & pos ) const"
Returns the paragraph which is at position \fIpos\fR (in contents coordinates).
.SH "TQColor QTextEdit::paragraphBackgroundColor ( int para ) const"
Returns the background color of the paragraph \fIpara\fR or an invalid color if \fIpara\fR is out of range or the paragraph has no background set
.SH "int QTextEdit::paragraphLength ( int para ) const"
Returns the length of the paragraph \fIpara\fR (i.e. the number of characters), or -1 if there is no paragraph with index \fIpara\fR.
.PP
This function ignores newlines.
.SH "QRect QTextEdit::paragraphRect ( int para ) const"
Returns the rectangle of the paragraph \fIpara\fR in contents coordinates, or an invalid rectangle if \fIpara\fR is out of range.
.SH "int QTextEdit::paragraphs () const"
Returns the number of paragraphs in the text; an empty textedit is always considered to have one paragraph, so 1 is returned in this case.
.SH "void QTextEdit::paste ()\fC [virtual slot]\fR"
Pastes the text from the clipboard into the text edit at the current cursor position. Only plain text is pasted.
.PP
If there is no text in the clipboard nothing happens.
.PP
See also pasteSubType(), cut(), and QTextEdit::copy().
.SH "void QTextEdit::pasteSubType ( const QCString & subtype )\fC [virtual slot]\fR"
Pastes the text with format \fIsubtype\fR from the clipboard into the text edit at the current cursor position. The \fIsubtype\fR can be" plain" or "html".
.PP
If there is no text with format \fIsubtype\fR in the clipboard nothing happens.
.PP
See also paste(), cut(), and QTextEdit::copy().
.SH "void QTextEdit::placeCursor ( const QPoint & pos, QTextCursor * c = 0 )\fC [virtual slot]\fR"
Places the cursor \fIc\fR at the character which is closest to position \fIpos\fR (in contents coordinates). If \fIc\fR is 0, the default text cursor is used.
.PP
See also setCursorPosition().
.SH "int QTextEdit::pointSize () const"
Returns the point size of the font of the current format.
.PP
See also setFamily(), setCurrentFont(), and setPointSize().
.SH "void QTextEdit::redo ()\fC [virtual slot]\fR"
Redoes the last operation.
.PP
If there is no operation to redo, i.e. there is no redo step in the undo/redo history, nothing happens.
.PP
See also redoAvailable(), undo(), and undoDepth.
.SH "void QTextEdit::redoAvailable ( bool yes )\fC [signal]\fR"
This signal is emitted when the availability of redo changes. If \fIyes\fR is TRUE, then redo() will work until redoAvailable( FALSE ) is next emitted.
.PP
See also redo() and undoDepth.
.SH "void QTextEdit::removeParagraph ( int para )\fC [virtual slot]\fR"
Removes the paragraph \fIpara\fR.
.SH "void QTextEdit::removeSelectedText ( int selNum = 0 )\fC [virtual slot]\fR"
Deletes the text of selection \fIselNum\fR (by default, the default selection, 0). If there is no selected text nothing happens.
.PP
See also selectedText and removeSelection().
.SH "void QTextEdit::removeSelection ( int selNum = 0 )\fC [virtual slot]\fR"
Removes the selection \fIselNum\fR (by default 0). This does not remove the selected text.
.PP
See also removeSelectedText().
.SH "void QTextEdit::repaintChanged ()\fC [protected]\fR"
Repaints any paragraphs that have changed.
.PP
Although used extensively internally you shouldn't need to call this yourself.
.SH "void QTextEdit::returnPressed ()\fC [signal]\fR"
This signal is emitted if the user pressed the Return or the Enter key.
.SH "void QTextEdit::scrollToAnchor ( const TQString & name )\fC [virtual slot]\fR"
Scrolls the text edit to make the text at the anchor called \fIname\fR visible, if it can be found in the document. If the anchor isn't found no scrolling will occur. An anchor is defined using the HTML anchor tag, e.g. \fC<a name="target">\fR.
.SH "void QTextEdit::scrollToBottom ()\fC [virtual slot]\fR"
Scrolls to the bottom of the document and does formatting if required.
.SH "void QTextEdit::selectAll ( bool select = TRUE )\fC [virtual slot]\fR"
If \fIselect\fR is TRUE (the default), all the text is selected as selection 0. If \fIselect\fR is FALSE any selected text is unselected, i.e. the default selection (selection 0) is cleared.
.PP
See also selectedText.
.SH "TQString QTextEdit::selectedText () const"
Returns the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0). See the "selectedText" property for details.
.SH "void QTextEdit::selectionChanged ()\fC [signal]\fR"
This signal is emitted whenever the selection changes.
.PP
See also setSelection() and copyAvailable().
.SH "void QTextEdit::setAlignment ( int a )\fC [virtual slot]\fR"
Sets the alignment of the current paragraph to \fIa\fR. Valid alignments are TQt::AlignLeft, TQt::AlignRight, TQt::AlignJustify and TQt::AlignCenter (which centers horizontally).
.PP
Reimplemented in QMultiLineEdit.
.SH "void QTextEdit::setAutoFormatting ( uint features )"
Sets the enabled set of auto formatting features to \fIfeatures\fR. See the "autoFormatting" property for details.
.SH "void QTextEdit::setBold ( bool b )\fC [virtual slot]\fR"
If \fIb\fR is TRUE sets the current format to bold; otherwise sets the current format to non-bold.
.PP
See also bold().
.SH "void QTextEdit::setColor ( const TQColor & c )\fC [virtual slot]\fR"
Sets the color of the current format, i.e. of the text, to \fIc\fR.
.PP
See also color() and paper.
.SH "void QTextEdit::setCurrentFont ( const QFont & f )\fC [virtual slot]\fR"
Sets the font of the current format to \fIf\fR.
.PP
If the widget is in LogText mode this function will do nothing. Use setFont() instead.
.PP
See also currentFont(), setPointSize(), and setFamily().
.SH "void QTextEdit::setCursorPosition ( int para, int index )\fC [virtual slot]\fR"
Sets the cursor to position \fIindex\fR in paragraph \fIpara\fR.
.PP
See also getCursorPosition().
.SH "void QTextEdit::setFamily ( const TQString & fontFamily )\fC [virtual slot]\fR"
Sets the font family of the current format to \fIfontFamily\fR.
.PP
See also family() and setCurrentFont().
.SH "void QTextEdit::setItalic ( bool b )\fC [virtual slot]\fR"
If \fIb\fR is TRUE sets the current format to italic; otherwise sets the current format to non-italic.
.PP
See also italic().
.SH "void QTextEdit::setLinkUnderline ( bool )\fC [virtual slot]\fR"
Sets whether hypertext links will be underlined. See the "linkUnderline" property for details.
.SH "void QTextEdit::setMaxLogLines ( int limit )\fC [slot]\fR"
Sets the maximum number of lines a QTextEdit can hold in LogText mode to \fIlimit\fR. If \fIlimit\fR is -1 (the default), this signifies an unlimited number of lines.
.PP
\fBWarning:\fR Never use formatting tags that span more than one line when the maximum log lines is set. When lines are removed from the top of the buffer it could result in an unbalanced tag pair, i.e. the left formatting tag is removed before the right one.
.SH "void QTextEdit::setMimeSourceFactory ( QMimeSourceFactory * factory )\fC [virtual slot]\fR"
Sets the text edit's mimesource factory to \fIfactory\fR. See QMimeSourceFactory for further details.
.PP
See also mimeSourceFactory().
.SH "void QTextEdit::setModified ( bool m )\fC [virtual slot]\fR"
Sets whether the document has been modified by the user to \fIm\fR. See the "modified" property for details.
.SH "void QTextEdit::setOverwriteMode ( bool b )\fC [virtual slot]\fR"
Sets the text edit's overwrite mode to \fIb\fR. See the "overwriteMode" property for details.
.SH "void QTextEdit::setPaper ( const QBrush & pap )\fC [virtual slot]\fR"
Sets the background (paper) brush to \fIpap\fR. See the "paper" property for details.
.SH "void QTextEdit::setParagraphBackgroundColor ( int para, const TQColor & bg )\fC [virtual slot]\fR"
Sets the background color of the paragraph \fIpara\fR to \fIbg\fR.
.SH "void QTextEdit::setPointSize ( int s )\fC [virtual slot]\fR"
Sets the point size of the current format to \fIs\fR.
.PP
Note that if \fIs\fR is zero or negative, the behaviour of this function is not defined.
.PP
See also pointSize(), setCurrentFont(), and setFamily().
.SH "void QTextEdit::setReadOnly ( bool b )\fC [virtual slot]\fR"
Sets whether the text edit is read-only to \fIb\fR. See the "readOnly" property for details.
.SH "void QTextEdit::setSelection ( int paraFrom, int indexFrom, int paraTo, int indexTo, int selNum = 0 )\fC [virtual slot]\fR"
Sets a selection which starts at position \fIindexFrom\fR in paragraph \fIparaFrom\fR and ends at position \fIindexTo\fR in paragraph \fIparaTo\fR.
.PP
Any existing selections which have a different id (\fIselNum\fR) are left alone, but if an existing selection has the same id as \fIselNum\fR it is removed and replaced by this selection.
.PP
Uses the selection settings of selection \fIselNum\fR. If \fIselNum\fR is 0, this is the default selection.
.PP
The cursor is moved to the end of the selection if \fIselNum\fR is 0, otherwise the cursor position remains unchanged.
.PP
See also getSelection() and selectedText.
.SH "void QTextEdit::setSelectionAttributes ( int selNum, const TQColor & back, bool invertText )\fC [virtual slot]\fR"
Sets the background color of selection number \fIselNum\fR to \fIback\fR and specifies whether the text of this selection should be inverted with \fIinvertText\fR.
.PP
This only works for \fIselNum\fR > 0. The default selection (\fIselNum\fR == 0) gets its attributes from the text edit's colorGroup().
.SH "void QTextEdit::setStyleSheet ( QStyleSheet * styleSheet )\fC [virtual slot]\fR"
Sets the stylesheet to use with this text edit to \fIstyleSheet\fR. Changes will only take effect for new text added with setText() or append().
.PP
See also styleSheet().
.SH "void QTextEdit::setTabChangesFocus ( bool b )\fC [slot]\fR"
Sets whether TAB changes focus or is accepted as input to \fIb\fR. See the "tabChangesFocus" property for details.
.SH "void QTextEdit::setTabStopWidth ( int ts )\fC [virtual slot]\fR"
Sets the tab stop width in pixels to \fIts\fR. See the "tabStopWidth" property for details.
.SH "void QTextEdit::setText ( const TQString & txt )\fC [slot]\fR"
Sets the text edit's text to \fItxt\fR. See the "text" property for details.
.SH "void QTextEdit::setText ( const TQString & text, const TQString & context )\fC [virtual slot]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Changes the text of the text edit to the string \fItext\fR and the context to \fIcontext\fR. Any previous text is removed.
.PP
\fItext\fR may be interpreted either as plain text or as rich text, depending on the textFormat(). The default setting is AutoText, i.e. the text edit auto-detects the format from \fItext\fR.
.PP
For rich text the rendering style and available tags are defined by a styleSheet(); see QStyleSheet for details.
.PP
The optional \fIcontext\fR is a path which the text edit's QMimeSourceFactory uses to resolve the locations of files and images. (See QTextEdit::QTextEdit().) It is passed to the text edit's QMimeSourceFactory when quering data.
.PP
Note that the undo/redo history is cleared by this function.
.PP
See also text and textFormat.
.SH "void QTextEdit::setTextFormat ( TextFormat f )\fC [virtual slot]\fR"
Sets the text format: rich text, plain text, log text or auto text to \fIf\fR. See the "textFormat" property for details.
.SH "void QTextEdit::setUnderline ( bool b )\fC [virtual slot]\fR"
If \fIb\fR is TRUE sets the current format to underline; otherwise sets the current format to non-underline.
.PP
See also underline().
.SH "void QTextEdit::setUndoDepth ( int d )\fC [virtual slot]\fR"
Sets the depth of the undo history to \fId\fR. See the "undoDepth" property for details.
.SH "void QTextEdit::setUndoRedoEnabled ( bool b )\fC [virtual slot]\fR"
Sets whether undo/redo is enabled to \fIb\fR. See the "undoRedoEnabled" property for details.
.SH "void QTextEdit::setVerticalAlignment ( VerticalAlignment a )\fC [virtual slot]\fR"
Sets the vertical alignment of the current format, i.e. of the text, to \fIa\fR.
.PP
See also color() and paper.
.SH "void QTextEdit::setWordWrap ( WordWrap mode )\fC [virtual slot]\fR"
Sets the word wrap mode to \fImode\fR. See the "wordWrap" property for details.
.SH "void QTextEdit::setWrapColumnOrWidth ( int )\fC [virtual slot]\fR"
Sets the position (in pixels or columns depending on the wrap mode) where text will be wrapped. See the "wrapColumnOrWidth" property for details.
.SH "void QTextEdit::setWrapPolicy ( WrapPolicy policy )\fC [virtual slot]\fR"
Sets the word wrap policy, at whitespace or anywhere to \fIpolicy\fR. See the "wrapPolicy" property for details.
.SH "QStyleSheet * QTextEdit::styleSheet () const"
Returns the QStyleSheet which is being used by this text edit.
.PP
See also setStyleSheet().
.PP
Examples:
.)l action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp, and mdi/application.cpp.
.SH "void QTextEdit::sync ()\fC [virtual slot]\fR"
QTextEdit is optimized for large amounts text. One of its optimizations is to format only the visible text, formatting the rest on demand, e.g. as the user scrolls, so you don't usually need to call this function.
.PP
In some situations you may want to force the whole text to be formatted. For example, if after calling setText(), you wanted to know the height of the document (using contentsHeight()), you would call this function first.
.SH "QSyntaxHighlighter * QTextEdit::syntaxHighlighter () const"
Returns the QSyntaxHighlighter set on this QTextEdit. 0 is returned if no syntax highlighter is set.
.SH "bool QTextEdit::tabChangesFocus () const"
Returns TRUE if TAB changes focus or is accepted as input; otherwise returns FALSE. See the "tabChangesFocus" property for details.
.SH "int QTextEdit::tabStopWidth () const"
Returns the tab stop width in pixels. See the "tabStopWidth" property for details.
.SH "TQString QTextEdit::text () const"
Returns the text edit's text. See the "text" property for details.
.SH "TQString QTextEdit::text ( int para ) const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the text of paragraph \fIpara\fR.
.PP
If textFormat() is RichText the text will contain HTML formatting tags.
.SH "void QTextEdit::textChanged ()\fC [signal]\fR"
This signal is emitted whenever the text in the text edit changes.
.PP
See also text and append().
.PP
Examples:
.)l qwerty/qwerty.cpp and rot13/rot13.cpp.
.SH "QTextCursor * QTextEdit::textCursor () const\fC [protected]\fR"
Returns the text edit's text cursor.
.PP
\fBWarning:\fR QTextCursor is not in the public API, but in special circumstances you might wish to use it.
.SH "TextFormat QTextEdit::textFormat () const"
Returns the text format: rich text, plain text, log text or auto text. See the "textFormat" property for details.
.SH "bool QTextEdit::underline () const"
Returns TRUE if the current format is underlined; otherwise returns FALSE.
.PP
See also setUnderline().
.SH "void QTextEdit::undo ()\fC [virtual slot]\fR"
Undoes the last operation.
.PP
If there is no operation to undo, i.e. there is no undo step in the undo/redo history, nothing happens.
.PP
See also undoAvailable(), redo(), and undoDepth.
.SH "void QTextEdit::undoAvailable ( bool yes )\fC [signal]\fR"
This signal is emitted when the availability of undo changes. If \fIyes\fR is TRUE, then undo() will work until undoAvailable( FALSE ) is next emitted.
.PP
See also undo() and undoDepth.
.SH "int QTextEdit::undoDepth () const"
Returns the depth of the undo history. See the "undoDepth" property for details.
.SH "WordWrap QTextEdit::wordWrap () const"
Returns the word wrap mode. See the "wordWrap" property for details.
.SH "int QTextEdit::wrapColumnOrWidth () const"
Returns the position (in pixels or columns depending on the wrap mode) where text will be wrapped. See the "wrapColumnOrWidth" property for details.
.SH "WrapPolicy QTextEdit::wrapPolicy () const"
Returns the word wrap policy, at whitespace or anywhere. See the "wrapPolicy" property for details.
.SH "void QTextEdit::zoomIn ( int range )\fC [virtual slot]\fR"
Zooms in on the text by making the base font size \fIrange\fR points larger and recalculating all font sizes to be the new size. This does not change the size of any images.
.PP
See also zoomOut().
.SH "void QTextEdit::zoomIn ()\fC [virtual slot]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Zooms in on the text by making the base font size one point larger and recalculating all font sizes to be the new size. This does not change the size of any images.
.PP
See also zoomOut().
.SH "void QTextEdit::zoomOut ( int range )\fC [virtual slot]\fR"
Zooms out on the text by making the base font size \fIrange\fR points smaller and recalculating all font sizes to be the new size. This does not change the size of any images.
.PP
See also zoomIn().
.SH "void QTextEdit::zoomOut ()\fC [virtual slot]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Zooms out on the text by making the base font size one point smaller and recalculating all font sizes to be the new size. This does not change the size of any images.
.PP
See also zoomIn().
.SH "void QTextEdit::zoomTo ( int size )\fC [virtual slot]\fR"
Zooms the text by making the base font size \fIsize\fR points and recalculating all font sizes to be the new size. This does not change the size of any images.
.SS "Property Documentation"
.SH "AutoFormatting autoFormatting"
This property holds the enabled set of auto formatting features.
.PP
The value can be any combination of the values in the AutoFormatting enum. The default is AutoAll. Choose AutoNone to disable all automatic formatting.
.PP
Currently, the only automatic formatting feature provided is AutoBulletList; future versions of TQt may offer more.
.PP
Set this property's value with setAutoFormatting() and get this property's value with autoFormatting().
.SH "TQString documentTitle"
This property holds the title of the document parsed from the text.
.PP
For PlainText the title will be an empty string. For RichText the title will be the text between the \fC<title>\fR tags, if present, otherwise an empty string.
.PP
Get this property's value with documentTitle().
.SH "bool hasSelectedText"
This property holds whether some text is selected in selection 0.
.PP
Get this property's value with hasSelectedText().
.SH "int length"
This property holds the number of characters in the text.
.PP
Get this property's value with length().
.SH "bool linkUnderline"
This property holds whether hypertext links will be underlined.
.PP
If TRUE (the default) hypertext links will be displayed underlined. If FALSE links will not be displayed underlined.
.PP
Set this property's value with setLinkUnderline() and get this property's value with linkUnderline().
.SH "bool modified"
This property holds whether the document has been modified by the user.
.PP
Set this property's value with setModified() and get this property's value with isModified().
.SH "bool overwriteMode"
This property holds the text edit's overwrite mode.
.PP
If FALSE (the default) characters entered by the user are inserted with any characters to the right being moved out of the way. If TRUE, the editor is in overwrite mode, i.e. characters entered by the user overwrite any characters to the right of the cursor position.
.PP
Set this property's value with setOverwriteMode() and get this property's value with isOverwriteMode().
.SH "QBrush paper"
This property holds the background (paper) brush.
.PP
The brush that is currently used to draw the background of the text edit. The initial setting is an empty brush.
.PP
Set this property's value with setPaper() and get this property's value with paper().
.SH "bool readOnly"
This property holds whether the text edit is read-only.
.PP
In a read-only text edit the user can only navigate through the text and select text; modifying the text is not possible.
.PP
This property's default is FALSE.
.PP
Set this property's value with setReadOnly() and get this property's value with isReadOnly().
.SH "TQString selectedText"
This property holds the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0).
.PP
The text is always returned as PlainText if the textFormat() is PlainText or AutoText, otherwise it is returned as HTML.
.PP
See also hasSelectedText.
.PP
Get this property's value with selectedText().
.SH "bool tabChangesFocus"
This property holds whether TAB changes focus or is accepted as input.
.PP
In some occasions text edits should not allow the user to input tabulators or change indentation using the TAB key, as this breaks the focus chain. The default is FALSE.
.PP
Set this property's value with setTabChangesFocus() and get this property's value with tabChangesFocus().
.SH "int tabStopWidth"
This property holds the tab stop width in pixels.
.PP
Set this property's value with setTabStopWidth() and get this property's value with tabStopWidth().
.SH "TQString text"
This property holds the text edit's text.
.PP
There is no default text.
.PP
On setting, any previous text is deleted.
.PP
The text may be interpreted either as plain text or as rich text, depending on the textFormat(). The default setting is AutoText, i.e. the text edit auto-detects the format of the text.
.PP
For richtext, calling text() on an editable QTextEdit will cause the text to be regenerated from the textedit. This may mean that the TQString returned may not be exactly the same as the one that was set.
.PP
See also textFormat.
.PP
Set this property's value with setText() and get this property's value with text().
.SH "TextFormat textFormat"
This property holds the text format: rich text, plain text, log text or auto text.
.PP
The text format is one of the following:
.TP
PlainText - all characters, except newlines, are displayed verbatim, including spaces. Whenever a newline appears in the text the text edit inserts a hard line break and begins a new paragraph.
.TP
RichText - rich text rendering. The available styles are defined in the default stylesheet QStyleSheet::defaultSheet().
.TP
LogText - optimized mode for very large texts. Supports a very limited set of formatting tags (color, bold, underline and italic settings).
.TP
AutoText - this is the default. The text edit autodetects which rendering style is best, PlainText or RichText. This is done by using the QStyleSheet::mightBeRichText() function.
.PP
Set this property's value with setTextFormat() and get this property's value with textFormat().
.SH "int undoDepth"
This property holds the depth of the undo history.
.PP
The maximum number of steps in the undo/redo history. The default is 100.
.PP
See also undo() and redo().
.PP
Set this property's value with setUndoDepth() and get this property's value with undoDepth().
.SH "bool undoRedoEnabled"
This property holds whether undo/redo is enabled.
.PP
When changing this property, the undo/redo history is cleared.
.PP
The default is TRUE.
.PP
Set this property's value with setUndoRedoEnabled() and get this property's value with isUndoRedoEnabled().
.SH "WordWrap wordWrap"
This property holds the word wrap mode.
.PP
The default mode is WidgetWidth which causes words to be wrapped at the right edge of the text edit. Wrapping occurs at whitespace, keeping whole words intact. If you want wrapping to occur within words use setWrapPolicy(). If you set a wrap mode of FixedPixelWidth or FixedColumnWidth you should also call setWrapColumnOrWidth() with the width you want.
.PP
See also WordWrap, wrapColumnOrWidth, and wrapPolicy.
.PP
Set this property's value with setWordWrap() and get this property's value with wordWrap().
.SH "int wrapColumnOrWidth"
This property holds the position (in pixels or columns depending on the wrap mode) where text will be wrapped.
.PP
If the wrap mode is FixedPixelWidth, the value is the number of pixels from the left edge of the text edit at which text should be wrapped. If the wrap mode is FixedColumnWidth, the value is the column number (in character columns) from the left edge of the text edit at which text should be wrapped.
.PP
See also wordWrap.
.PP
Set this property's value with setWrapColumnOrWidth() and get this property's value with wrapColumnOrWidth().
.SH "WrapPolicy wrapPolicy"
This property holds the word wrap policy, at whitespace or anywhere.
.PP
Defines where text can be wrapped when word wrap mode is not NoWrap. The choices are AtWordBoundary (the default), Anywhere and AtWordOrDocumentBoundary
.PP
See also wordWrap.
.PP
Set this property's value with setWrapPolicy() and get this property's value with wrapPolicy().
.SH "SEE ALSO"
.BR http://doc.trolltech.com/ntqtextedit.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (tqtextedit.3qt) and the Qt
version (3.3.8).