---
name: "qmultilineedit"
section: "3qt"
platform: "linux"
package: "qt-doc"
version: "3:2.3.1-22"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/qmultilineedit"
---

# qmultilineedit(3qt)

Simple editor for inputting text #include \<qmultilineedit.h\> Inherits QTableView.

## NAME

QMultiLineEdit - Simple editor for inputting text\

`#include <qmultilineedit.h>`

Inherits QTableView.

### Public Members

**QMultiLineEdit ( QWidget \*** *parent***=0, const char \*** *name***=0 )** \
 **~QMultiLineEdit ()** \
 **QString textLine ( int line ) const**\
 **int numLines () const**\
 **virtual QSize minimumSizeHint () const**\
 **virtual void insertLine ( const QString &** *s***, int** *line* **= -1 )** \
 **virtual void insertAt ( const QString &** *s***, int** *line***, int** *col***, bool** *mark* **= FALSE )** \
 **virtual void removeLine ( int line )** \
 **void cursorPosition ( int \*** *line***, int \* col ) const *(obsolete)***\
 **virtual void setCursorPosition ( int** *line***, int** *col***, bool** *mark* **= FALSE )** \
 **void getCursorPosition ( int \*** *line***, int \* col ) const**\
 **bool atBeginning () const**\
 **bool atEnd () const**\
 **virtual void setFixedVisibleLines ( int lines )** \
 **int maxLineWidth () const**\
 **void setAlignment ( int flags )** \
 **int alignment () const**\
 **virtual void setValidator ( const QValidator \* )** \
 **const QValidator\* validator () const**\
 **void setEdited ( bool )** \
 **bool edited () const**\
 **void cursorWordForward ( bool mark )** \
 **void cursorWordBackward ( bool mark )** \
 **enum EchoMode { Normal, NoEcho, Password }**\
 **virtual void setEchoMode ( EchoMode )** \
 **EchoMode echoMode () const**\
 **void setMaxLength ( int )** \
 **int maxLength () const**\
 **virtual void setMaxLineLength ( int )** \
 **int maxLineLength () const**\
 **virtual void setMaxLines ( int )** \
 **int maxLines () const**\
 **virtual void setHMargin ( int )** \
 **int hMargin () const**\
 **virtual void setSelection ( int** *row\_from***, int** *col\_from***, int** *row\_to***, int col\_t )** \
 **enum WordWrap { NoWrap, WidgetWidth, FixedPixelWidth, FixedColumnWidth }**\
 **void setWordWrap ( WordWrap mode )** \
 **WordWrap wordWrap () const**\
 **void setWrapColumnOrWidth ( int )** \
 **int wrapColumnOrWidth () const**\
 **enum WrapPolicy { AtWhiteSpace, Anywhere }**\
 **void setWrapPolicy ( WrapPolicy policy )** \
 **WrapPolicy wrapPolicy () const**\
 **bool autoUpdate () const**\
 **virtual void setAutoUpdate ( bool )** \
 **void setUndoEnabled ( bool )** \
 **bool isUndoEnabled () const**\
 **void setUndoDepth ( int )** \
 **int undoDepth () const**\
 **bool isReadOnly () const**\
 **bool isOverwriteMode () const**\
 **QString text () const**\
 **int length () const**\

### Public Slots

**virtual void setText ( const QString & )** \
 **virtual void setReadOnly ( bool )** \
 **virtual void setOverwriteMode ( bool )** \
 **void clear ()** \
 **void append ( const QString & )** \
 **void deselect ()** \
 **void selectAll ()** \
 **void paste ()** \
 **void pasteSubType ( const QCString & subtype )** \
 **void copyText () const *(obsolete)***\
 **void copy () const**\
 **void cut ()** \
 **void insert ( const QString & )** \
 **void undo ()** \
 **void redo ()** \

### Signals

**void textChanged ()** \
 **void returnPressed ()** \
 **void undoAvailable ( bool )** \
 **void redoAvailable ( bool )** \
 **void copyAvailable ( bool )** \

### Static Public Members

**void setDefaultTabStop ( int ex )** \
 **int defaultTabStop ()** \

### Protected Members

**virtual void paintCell ( QPainter \*, int** *row***, int col )** \
 **virtual void keyPressEvent ( QKeyEvent \* )** \
 **virtual void focusInEvent ( QFocusEvent \* )** \
 **bool hasMarkedText () const**\
 **QString markedText () const**\
 **int textWidth ( int )** \
 **int textWidth ( const QString & )** \
 **QPoint cursorPoint () const**\
 **virtual void insert ( const QString &, bool mark )** \
 **virtual void newLine ()** \
 **virtual void killLine ()** \
 **virtual void pageUp ( bool** *mark***=FALSE )** \
 **virtual void pageDown ( bool** *mark***=FALSE )** \
 **virtual void cursorLeft ( bool** *mark***=FALSE, bool** *wrap* **= TRUE )** \
 **virtual void cursorRight ( bool** *mark***=FALSE, bool** *wrap* **= TRUE )** \
 **virtual void cursorUp ( bool** *mark***=FALSE )** \
 **virtual void cursorDown ( bool** *mark***=FALSE )** \
 **virtual void backspace ()** \
 **virtual void del ()** \
 **virtual void home ( bool** *mark***=FALSE )** \
 **virtual void end ( bool** *mark***=FALSE )** \
 **bool getMarkedRegion ( int \*** *line1***, int \*** *col1***, int \*** *line2***, int \* col2 ) const**\
 **int lineLength ( int row ) const**\
 **QString\* getString ( int row ) const**\
 **bool isEndOfParagraph ( int row ) const**\
 **QString stringShown ( int row ) const**\
 **void insertChar ( QChar )** \

### Properties

```

```

| | | | | |
| --- | --- | --- | --- | --- |
| Type | Name | READ | WRITE | Options |
|
| bool | atBeginning | atBeginning |
| bool | atEnd | atEnd |
| int | maxLineWidth | maxLineWidth |
| Alignment | alignment | alignment | setAlignment |
| bool | edited | edited | setEdited | DESIGNABLE false |
| EchoMode | echoMode | echoMode | setEchoMode |
| int | maxLength | maxLength | setMaxLength |
| int | maxLines | maxLines | setMaxLines |
| int | hMargin | hMargin | setHMargin |
| WordWrap | wordWrap | wordWrap | setWordWrap |
| int | wrapColumnOrWidth | wrapColumnOrWidth | setWrapColumnOrWidth |
| WrapPolicy | wrapPolicy | wrapPolicy | setWrapPolicy |
| bool | autoUpdate | autoUpdate | setAutoUpdate | DESIGNABLE false |
| bool | undoEnabled | isUndoEnabled | setUndoEnabled |
| int | undoDepth | undoDepth | setUndoDepth |
| bool | readOnly | isReadOnly | setReadOnly |
| bool | overWriteMode | isOverwriteMode | setOverwriteMode |
| QString | text | text | setText |
| int | length | length |

## DESCRIPTION

The QMultiLineEdit widget is a simple editor for inputting text.

The QMultiLineEdit widget provides multiple line text input and display. It is intended for moderate amounts of text. There are no arbitrary limitations, but if you try to handle megabytes of data, performance will suffer.

Per default, the edit widget does not perform any word wrapping. This can be adjusted by calling setWordWrap(). Both dynamic wrapping according to the visible width or a fixed number of character or pixels is supported.

The widget can be used to display text by calling setReadOnly(TRUE)

The default key bindings are described in keyPressEvent(); they cannot be customized except by inheriting the class.

**\[Image Omitted\]**

**\[Image Omitted\]**

Examples: mainlyQt/editor.cpp layout/layout.cpp mainlyXt/editor.cpp mainlyMotif/editor.cpp rot13/rot13.cpp scrollview/scrollview.cpp customlayout/main.cpp

### Member Type Documentation

## QMultiLineEdit::EchoMode

This enum type describes the ways in which QLineEdit can display its contents. The currently defined values are:

- `Normal` - display characters as they are entered. This is the default.

  - `NoEcho` - do not display anything.

  - `Password` - display asterisks instead of the characters actually entered.

  -

  See also setEchoMode(), echoMode() and QLineEdit::EchoMode.

## QMultiLineEdit::WordWrap

This enum describes the multiline edit's word wrap mode.

The following values are valid:

- `NoWrap` - no word wrap at all.

  - `WidgetWidth` - word wrap depending on the current width of the editor widget

  - `FixedPixelWidth` - wrap according to a fix amount of pixels ( see wrapColumnOrWidth() )

  - `FixedColumnWidth` - wrap according to a fix character column. This is useful whenever you need formatted text that can also be displayed gracefully on devices with monospaced fonts, for example a standard VT100 terminal. In that case wrapColumnOrWidth() should typically be set to 80.

  See also setWordWrap().

## QMultiLineEdit::WrapPolicy

Defines where text can be wrapped in word wrap mode.

The following values are valid:

- `AtWhiteSpace` - break only after whitespace

  - `Anywhere` - break anywhere

  See also setWrapPolicy().

## MEMBER FUNCTION DOCUMENTATION

## QMultiLineEdit::QMultiLineEdit ( QWidget \* parent=0, const char \* name=0 )

Constructs a new, empty, QMultiLineEdit.

## QMultiLineEdit::~QMultiLineEdit ()

Destroys the QMultiLineEdit.

## int QMultiLineEdit::alignment () const

Returns the alignment.

See also setAlignment() and Qt::AlignmentFlags.

## void QMultiLineEdit::append ( const QString & s ) `[slot]`

Appends *s* to the text.

## bool QMultiLineEdit::atBeginning () const

Returns TRUE if the cursor is placed at the beginning of the text.

## bool QMultiLineEdit::atEnd () const

Returns TRUE if the cursor is placed at the end of the text.

## bool QMultiLineEdit::autoUpdate () const

Returns TRUE if the view updates itself automatically whenever it is changed in some way.

See also setAutoUpdate().

## void QMultiLineEdit::backspace () `[virtual protected]`

Deletes the character on the left side of the text cursor and moves the cursor one position to the left. If a text has been marked by the user (e.g. by clicking and dragging) the cursor is put at the beginning of the marked text and the marked text is removed.

See also del().

## void QMultiLineEdit::clear () `[slot]`

Removes all text.

## void QMultiLineEdit::copy () const `[slot]`

Copies the marked text to the clipboard. Will copy only if echoMode() is Normal.

## void QMultiLineEdit::copyAvailable ( bool yes ) `[signal]`

This signal is emitted when the availability of cut/copy changes. If *yes* is TRUE, then cut() and copy() will work until copyAvailable( FALSE ) is next emitted.

## void QMultiLineEdit::copyText () const `[slot]`

**This function is obsolete.** It is provided to keep old source working, and will probably be removed in a future version of Qt. We strongly advise against using it in new code.

Backward compatibility.

## void QMultiLineEdit::cursorDown ( bool mark=FALSE ) `[virtual protected]`

Moves the cursor one line down. If *mark* is TRUE, the text is marked.

See also cursorUp(), cursorLeft() and cursorRight().

## void QMultiLineEdit::cursorLeft ( bool mark=FALSE, bool wrap = TRUE ) `[virtual protected]`

Moves the cursor one character to the left. If *mark* is TRUE, the text is marked. If *wrap* is TRUE, the cursor moves to the end of the previous line if it is placed at the beginning of the current line.

See also cursorRight(), cursorUp() and cursorDown().

## QPoint QMultiLineEdit::cursorPoint () const `[protected]`

Returns the top center point where the cursor is drawn.

## void QMultiLineEdit::cursorPosition ( int \* line, int \* col ) const

**This function is obsolete.** It is provided to keep old source working, and will probably be removed in a future version of Qt. We strongly advise against using it in new code.

Use getCursorPosition() instead.

## void QMultiLineEdit::cursorRight ( bool mark=FALSE, bool wrap = TRUE ) `[virtual protected]`

Moves the cursor one character to the right. If *mark* is TRUE, the text is marked. If *wrap* is TRUE, the cursor moves to the beginning of the next line if it is placed at the end of the current line.

See also cursorLeft(), cursorUp() and cursorDown().

## void QMultiLineEdit::cursorUp ( bool mark=FALSE ) `[virtual protected]`

Moves the cursor up one line. If *mark* is TRUE, the text is marked.

See also cursorDown(), cursorLeft() and cursorRight().

## void QMultiLineEdit::cursorWordBackward ( bool mark )

Moves the cursor one word to the left. If *mark* is TRUE, the text is marked.

See also cursorWordForward().

## void QMultiLineEdit::cursorWordForward ( bool mark )

Moves the cursor one word to the right. If *mark* is TRUE, the text is marked.

See also cursorWordBackward().

## void QMultiLineEdit::cut () `[slot]`

Copies the selected text to the clipboard and deletes the selected text.

## int QMultiLineEdit::defaultTabStop () `[static]`

Returns the distance between tab stops.

See also setDefaultTabStop();.

## void QMultiLineEdit::del () `[virtual protected]`

Deletes the character on the right side of the text cursor. If a text has been marked by the user (e.g. by clicking and dragging) the cursor is put at the beginning of the marked text and the marked text is removed.

See also backspace().

## void QMultiLineEdit::deselect () `[slot]`

Deselects all text (i.e. removes marking) and leaves the cursor at the current position.

## void QMultiLineEdit::dragEnterEvent ( QDragEnterEvent \* ) `[virtual protected]`

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

## void QMultiLineEdit::dragLeaveEvent ( QDragLeaveEvent \* ) `[virtual protected]`

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

## void QMultiLineEdit::dragMoveEvent ( QDragMoveEvent \* event ) `[virtual protected]`

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

## void QMultiLineEdit::dropEvent ( QDropEvent \* event ) `[virtual protected]`

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

## QMultiLineEdit::EchoMode QMultiLineEdit::echoMode() const

Returns the currently set echo mode.

See also setEchoMode().

## bool QMultiLineEdit::edited () const

Returns the edited flag of the line edit. If this returns FALSE, the contents has not been changed since the construction of the QMultiLineEdit (or the last call to setEdited( FALSE ), if any). If it returns TRUE, the contents have been edited, or setEdited( TRUE ) has been called.

See also setEdited().

## void QMultiLineEdit::end ( bool mark=FALSE ) `[virtual protected]`

Moves the text cursor to the right end of the line. If mark is TRUE text is marked towards the last position. If it is FALSE and the cursor is moved, all marked text is unmarked.

See also home().

## bool QMultiLineEdit::event ( QEvent \* e ) `[virtual protected]`

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QObject.

## void QMultiLineEdit::focusInEvent ( QFocusEvent \* ) `[virtual protected]`

Starts the cursor blinking.

Reimplemented from QWidget.

## bool QMultiLineEdit::focusNextPrevChild ( bool ) `[virtual protected]`

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

## void QMultiLineEdit::focusOutEvent ( QFocusEvent \* ) `[virtual protected]`

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

## void QMultiLineEdit::getCursorPosition ( int \* line, int \* col ) const

Returns the current line and character position within that line, in the variables pointed to by *line* and *col* respectively.

See also setCursorPosition().

## bool QMultiLineEdit::getMarkedRegion ( int \* line1, int \* col1, int \* line2, int \* col2 ) const `[protected]`

If there is marked text, sets *line1, col1, line2* and *col2* to the start and end of the marked region and returns TRUE. Returns FALSE if there is no marked text.

## QString \* QMultiLineEdit::getString ( int line ) const `[protected]`

Returns a pointer to the text at line *line.*

## int QMultiLineEdit::hMargin () const

Returns the horizontal margin current set. The default is 3.

See also setHMargin().

## bool QMultiLineEdit::hasMarkedText () const `[protected]`

Returns TRUE if there is marked text.

## void QMultiLineEdit::home ( bool mark=FALSE ) `[virtual protected]`

Moves the text cursor to the left end of the line. If *mark* is TRUE, text is marked towards the first position. If it is FALSE and the cursor is moved, all marked text is unmarked.

See also end().

## void QMultiLineEdit::insert ( const QString & s ) `[slot]`

Inserts *s* at the current cursor position.

## void QMultiLineEdit::insert ( const QString & str, bool mark ) `[virtual protected]`

Inserts *c* at the current cursor position.

## void QMultiLineEdit::insertAt ( const QString & s, int line, int col, bool mark = FALSE ) `[virtual]`

Inserts *txt* at line number *line,* after character number *col* in the line. If *txt* contains newline characters, new lines are inserted.

The cursor position is adjusted. If the insertion position is equal to the cursor position, the cursor is placed after the end of the new text.

## void QMultiLineEdit::insertChar ( QChar c ) `[protected]`

Inserts *c* at the current cursor position. (this function is provided for backward compatibility - it simply calls insert()).

## void QMultiLineEdit::insertLine ( const QString & txt, int line = -1 ) `[virtual]`

Inserts *txt* at line number *line.* If *line* is less than zero, or larger than the number of rows, the new text is put at the end. If *txt* contains newline characters, several lines are inserted.

The cursor position is not changed.

## bool QMultiLineEdit::isEndOfParagraph ( int row ) const `[protected]`

Returns wether *row* is the last row in a paragraph.

This function is only interesting in word wrap mode, otherwise its return value is always TRUE.

See also setWordWrap().

## bool QMultiLineEdit::isOverwriteMode () const

Returns TRUE if this multi line edit is in overwrite mode, i.e. if characters typed replace characters in the editor.

See also setOverwriteMode().

## bool QMultiLineEdit::isReadOnly () const

Returns FALSE if this multi line edit accepts text input. Scrolling and cursor movements are accepted in any case.

See also setReadOnly() and QWidget::isEnabled().

## bool QMultiLineEdit::isUndoEnabled () const

Returns whether the multilineedit is currently undo enabled or not.

See also setUndoEnabled().

## void QMultiLineEdit::keyPressEvent ( QKeyEvent \* e ) `[virtual protected]`

The key press event handler converts a key press to some line editor action.

Here are the default key bindings when isReadOnly() is FALSE:

- *Left Arrow* Move the cursor one character leftwards

  - *Right Arrow* Move the cursor one character rightwards

  - *Up Arrow* Move the cursor one line upwards

  - *Down Arrow* Move the cursor one line downwards

  - *Page Up* Move the cursor one page upwards

  - *Page Down* Move the cursor one page downwards

  - *Backspace* Delete the character to the left of the cursor

  - *Home* Move the cursor to the beginning of the line

  - *End* Move the cursor to the end of the line

  - *Delete* Delete the character to the right of the cursor

  - *Shift - Left Arrow* Mark text one character leftwards

  - *Shift - Right Arrow* Mark text one character rightwards

  - *Control-A* Move the cursor to the beginning of the line

  - *Control-B* Move the cursor one character leftwards

  - *Control-C* Copy the marked text to the clipboard

  - *Control-D* Delete the character to the right of the cursor

  - *Control-E* Move the cursor to the end of the line

  - *Control-F* Move the cursor one character rightwards

  - *Control-H* Delete the character to the left of the cursor

  - *Control-K* Delete to end of line

  - *Control-N* Move the cursor one line downwards

  - *Control-P* Move the cursor one line upwards

  - *Control-V* Paste the clipboard text into line edit

  - *Control-X* Cut the marked text, copy to clipboard

  - *Control-Z* Undo the last operation

  - *Control-Y* Redo the last operation

  - *Control - Left Arrow* Move the cursor one word leftwards

  - *Control - Right Arrow* Move the cursor one word rightwards

  - *Control - Up Arrow* Move the cursor one word upwards

  - *Control - Down Arrow* Move the cursor one word downwards

  - *Control - Home Arrow* Move the cursor to the beginning of the text

  - *Control - End Arrow* Move the cursor to the end of the text In addition, the following key bindings are used on Windows:

  - *Shift - Delete* Cut the marked text, copy to clipboard

  - *Shift - Insert* Paste the clipboard text into line edit

  - *Control - Insert* Copy the marked text to the clipboard All other keys with valid ASCII codes insert themselves into the line.

  Here are the default key bindings when isReadOnly() is TRUE:

- *Left Arrow* Scrolls the table rightwards

  - *Right Arrow* Scrolls the table rightwards

  - *Up Arrow* Scrolls the table one line downwards

  - *Down Arrow* Scrolls the table one line upwards

  - *Page Up* Scrolls the table one page downwards

  - *Page Down* Scrolls the table one page upwards

  - *Control-C* Copy the marked text to the clipboard

  Reimplemented from QWidget.

## void QMultiLineEdit::killLine () `[virtual protected]`

Deletes text from the current cursor position to the end of the line.

## void QMultiLineEdit::leaveEvent ( QEvent \* ) `[virtual protected]`

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

## int QMultiLineEdit::length () const

Returns the length of the current text.

See also setMaxLength().

## int QMultiLineEdit::lineLength ( int line ) const `[protected]`

Returns the number of characters at line number *line.*

## QString QMultiLineEdit::markedText () const `[protected]`

Returns a copy of the marked text.

## int QMultiLineEdit::maxLength () const

Returns the currently set text length limit, or -1 if there is no limit (this is the default).

See also setMaxLength().

## int QMultiLineEdit::maxLineLength () const

Returns the currently set line length limit, or -1 if there is no limit (this is the default).

See also setMaxLineLength().

## int QMultiLineEdit::maxLineWidth () const

Returns the width in pixels of the longest text line in this editor.

## int QMultiLineEdit::maxLines () const

Returns the currently set line limit, or -1 if there is no limit (the default).

See also setMaxLines().

## QSize QMultiLineEdit::minimumSizeHint () const `[virtual]`

Returns a size sufficient for one character, and scroll bars.

Reimplemented from QWidget.

## void QMultiLineEdit::mouseDoubleClickEvent ( QMouseEvent \* m ) `[virtual protected]`

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

## void QMultiLineEdit::mouseMoveEvent ( QMouseEvent \* e ) `[virtual protected]`

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

## void QMultiLineEdit::mousePressEvent ( QMouseEvent \* e ) `[virtual protected]`

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

## void QMultiLineEdit::mouseReleaseEvent ( QMouseEvent \* e ) `[virtual protected]`

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

## void QMultiLineEdit::newLine () `[virtual protected]`

Makes a line break at the current cursor position.

## int QMultiLineEdit::numLines () const

Returns the number of lines in the editor. The count includes any empty lines at top and bottom, so for an empty editor this method will return 1.

## void QMultiLineEdit::pageDown ( bool mark=FALSE ) `[virtual protected]`

Moves the cursor one page down. If *mark* is TRUE, the text is marked.

## void QMultiLineEdit::pageUp ( bool mark=FALSE ) `[virtual protected]`

Moves the cursor one page up. If *mark* is TRUE, the text is marked.

## void QMultiLineEdit::paintCell ( QPainter \* painter, int row, int ) `[virtual protected]`

Implements the basic drawing logic.

Reimplemented from QTableView.

## void QMultiLineEdit::paste () `[slot]`

Copies plain text from the clipboard onto the current cursor position. Any marked text is first deleted.

## void QMultiLineEdit::pasteSubType ( const QCString & subtype ) `[slot]`

Copies text in MIME subtype *subtype* from the clipboard onto the current cursor position. Any marked text is first deleted.

## void QMultiLineEdit::redo () `[slot]`

Redoes the last text operation.

## void QMultiLineEdit::redoAvailable ( bool yes ) `[signal]`

This signal is emitted when the availability of redo changes. If *yes* is TRUE, then redo() will work until redoAvailable( FALSE ) is next emitted.

## void QMultiLineEdit::removeLine ( int line ) `[virtual]`

Deletes the line at line number *line.* If *line* is less than zero, or larger than the number of lines, no line is deleted.

## void QMultiLineEdit::resizeEvent ( QResizeEvent \* e ) `[virtual protected]`

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

## void QMultiLineEdit::returnPressed () `[signal]`

This signal is emitted when the user presses the return or enter key. It is not emitted if isReadOnly() is TRUE.

See also textChanged().

## void QMultiLineEdit::selectAll () `[slot]`

Selects all text without moving the cursor.

## void QMultiLineEdit::setAlignment ( int flags )

Sets the alignment. Possible values are `AlignLeft, Align(H)Center` and `AlignRight.`

See also alignment() and Qt::AlignmentFlags.

## void QMultiLineEdit::setAutoUpdate ( bool enable ) `[virtual]`

Sets the auto-update option of multi-line editor to *enable.*

If *enable* is TRUE (this is the default) then the editor updates itself automatically whenever it has changed in some way (generally, when text has been inserted or deleted).

If *enable* is FALSE, the view does NOT repaint itself, or update its internal state variables itself when it is changed. This can be useful to avoid flicker during large changes, and is singularly useless otherwise: Disable auto-update, do the changes, re-enable auto-update, and call repaint().

**Warning:** Do not leave the view in this state for a long time (i.e. between events ). If, for example, the user interacts with the view when auto-update is off, strange things can happen.

Setting auto-update to TRUE does not repaint the view, you must call repaint() to do this (preferable repaint(FALSE) to avoid flicker).

See also autoUpdate() and repaint().

## void QMultiLineEdit::setCursorPosition ( int line, int col, bool mark = FALSE ) `[virtual]`

Sets the cursor position to character number *col* in line number *line.* The parameters are adjusted to lie within the legal range.

If *mark* is FALSE, the selection is cleared. otherwise it is extended

See also cursorPosition().

## void QMultiLineEdit::setDefaultTabStop ( int ex ) `[static]`

Sets the distance between tab stops for all QMultiLineEdit instances to *ex,* which is measured in multiples of the width of a lower case 'x' in the widget's font. The initial value is 8.

**Warning:** This function does not cause a redraw. It is best to call it before any QMultiLineEdit widgets are shown.

See also defaultTabStop().

## void QMultiLineEdit::setEchoMode ( EchoMode em )

Sets the echo mode to *em.* The default is `Normal.`

The display is updated according.

See also setEchoMode().

## void QMultiLineEdit::setEdited ( bool e )

Sets the edited flag of this line edit to *on.* The edited flag is never read by QMultiLineEdit, but is changed to TRUE whenever the user changes its contents.

This is useful e.g. for things that need to provide a default value, but cannot find the default at once. Just open the widget without the best default and when the default is known, check the edited() return value and set the line edit's contents if the user has not started editing the line edit. Another example is to detect whether the contents need saving.

See also edited().

## void QMultiLineEdit::setFixedVisibleLines ( int lines ) `[virtual]`

Sets the fixed height of the QMultiLineEdit so that *lines* text lines are visible given the current font.

See also setMaxLines() and setFixedHeight().

## void QMultiLineEdit::setFont ( const QFont & font ) `[virtual]`

Reimplemented for internal reasons; the API is not affected.

## void QMultiLineEdit::setHMargin ( int m ) `[virtual]`

Sets the horizontal margin.

See also hMargin().

## void QMultiLineEdit::setMaxLength ( int m )

Sets the maximum text length to *m.* Use -1 for unlimited (the default). Existing overlong text will be truncated.

See also maxLength().

## void QMultiLineEdit::setMaxLineLength ( int m ) `[virtual]`

Sets the maximum length of lines to *m.* Use -1 for unlimited (the default). Existing long lines will be truncated.

See also maxLineLength().

## void QMultiLineEdit::setMaxLines ( int m ) `[virtual]`

Sets the maximum number of lines to *m.* Use -1 for unlimited (the default). Existing excess lines will be deleted.

Note that excess lines are deleted from the *bottom* of the lines. If you want teletype behaviour with lines disappearing from the *top* as the limit is exceed, you probably just want to use removeLine(0) prior to adding an excess line.

See also maxLines() and numLines().

## void QMultiLineEdit::setOverwriteMode ( bool on ) `[virtual slot]`

Sets overwrite mode if *on* is TRUE. Overwrite mode means that characters typed replace characters in the editor.

See also isOverwriteMode().

## void QMultiLineEdit::setReadOnly ( bool on ) `[virtual slot]`

If *on* is FALSE, this multi line edit accepts text input. Scrolling and cursor movements are accepted in any case.

See also isReadOnly() and QWidget::setEnabled().

## void QMultiLineEdit::setSelection ( int row\_from, int col\_from, int row\_to, int col\_to ) `[virtual]`

Marks the text starting at *row\_from, col\_from* and ending at row\_to, col\_to.

## void QMultiLineEdit::setText ( const QString & s ) `[virtual slot]`

Sets the text to *s,* removing old text, if any.

Examples: mainlyQt/editor.cpp layout/layout.cpp mainlyXt/editor.cpp mainlyMotif/editor.cpp scrollview/scrollview.cpp customlayout/main.cpp

## void QMultiLineEdit::setUndoDepth ( int depth )

Sets the maximum number of operations that can be stored on the undo stack.

See also undoDepth().

## void QMultiLineEdit::setUndoEnabled ( bool enable )

Sets undo enabled to *enable.*

See also isUndoEnabled().

## void QMultiLineEdit::setValidator ( const QValidator \* v ) `[virtual]`

Not supported at this time.

## void QMultiLineEdit::setWordWrap ( WordWrap mode )

Sets the word wrap mode.

Per default, wrapping keeps words intact. To allow breaking within words, set the wrap policy to `Anywhere` (see setWrapPolicy() ).

The default wrap mode is `NoWrap.`

See also wordWrap(), setWrapColumnOrWidth() and setWrapPolicy().

## void QMultiLineEdit::setWrapColumnOrWidth ( int value )

Sets the wrap column or wrap width, depending on the word wrap mode.

See also setWordWrap().

## void QMultiLineEdit::setWrapPolicy ( WrapPolicy policy )

Defines where text can be wrapped in word wrap mode.

The default is `AtWhiteSpace.`

See also setWordWrap() and wrapPolicy().

## QSize QMultiLineEdit::sizeHint () const `[virtual]`

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

## QSizePolicy QMultiLineEdit::sizePolicy () const `[virtual]`

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

## QString QMultiLineEdit::stringShown ( int row ) const `[protected]`

Returns the string shown at line *row,* including processing of the echoMode().

## QString QMultiLineEdit::text () const

Returns a copy of the whole text. If the multi line edit contains no text, a null string is returned.

## void QMultiLineEdit::textChanged () `[signal]`

This signal is emitted when the text is changed by an event or by a slot. Note that the signal is not emitted when you call a non-slot function such as insertLine().

See also returnPressed().

## QString QMultiLineEdit::textLine ( int line ) const

Returns the text at line number *line* (possibly the empty string), or a null string if *line* is invalid.

## int QMultiLineEdit::textWidth ( const QString & s ) `[protected]`

Returns the width in pixels of the string *s.* NOTE: only appropriate for whole lines.

## int QMultiLineEdit::textWidth ( int line ) `[protected]`

Returns the width in pixels of the text at line *line.*

## void QMultiLineEdit::timerEvent ( QTimerEvent \* ) `[virtual protected]`

Reimplemented for internal reasons; the API is not affected. Present for binary compatibility only!.

Reimplemented from QObject.

## void QMultiLineEdit::undo () `[slot]`

Undoes the last text operation.

## void QMultiLineEdit::undoAvailable ( bool yes ) `[signal]`

This signal is emitted when the availability of undo changes. If *yes* is TRUE, then undo() will work until undoAvailable( FALSE ) is next emitted.

## int QMultiLineEdit::undoDepth () const

Returns the maximum number of operations that can be stored on the undo stack.

See also setUndoDepth().

## const QValidator \* QMultiLineEdit::validator () const

Not supported at this time.

## void QMultiLineEdit::wheelEvent ( QWheelEvent \* e ) `[virtual protected]`

Reimplemented for internal reasons; the API is not affected. Passes wheel events to the vertical scrollbar.

Reimplemented from QWidget.

## QMultiLineEdit::WordWrap QMultiLineEdit::wordWrap() const

Returns the current word wrap mode.

See also setWordWrap().

## int QMultiLineEdit::wrapColumnOrWidth () const

Returns the wrap column or wrap width, depending on the word wrap mode.

See also setWordWrap() and setWrapColumnOrWidth().

## QMultiLineEdit::WrapPolicy QMultiLineEdit::wrapPolicy() const

Returns the current word wrap policy.

See also  setWrapPolicy().

## SEE ALSO

**http://doc.trolltech.com/qmultilineedit.html** **http://www.trolltech.com/faq/tech.html**

## COPYRIGHT

Copyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See the license file included in the distribution for a complete license statement.

## AUTHOR

Generated automatically from the source code.

## BUGS

If you find a bug in Qt, please report it as described in **http://doc.trolltech.com/bughowto.html**. Good bug reports make our job much simpler. Thank you.

In case of content or formattting problems with this manual page, please report them to **qt-bugs@trolltech.com**. Please include the name of the manual page (qmultilineedit.3qt) and the Qt version (2.3.1).
