Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# QMultiLineEdit Class Reference

The QMultiLineEdit widget is a simple editor for inputting text. More...

    #include <QMultiLineEdit>

This class is part of the Qt 3 compatibility library. It is provided to keep old source code working. We strongly advise against using it in new code.

Inherits Q3TextEdit.

- List of all members, including inherited members

### Writable Properties

- alignment : Qt::Alignment
- edited : bool

- 15 writable properties inherited from Q3TextEdit
- 4 writable properties inherited from QScrollView
- 5 writable properties inherited from QFrame
- 33 writable properties inherited from QWidget
- 1 writable property inherited from QObject

### Read-Only Properties

- atBeginning : bool
- atEnd : bool
- numLines : int

- 4 read-only properties inherited from Q3TextEdit
- 6 read-only properties inherited from QScrollView
- 1 read-only property inherited from QFrame
- 24 read-only properties inherited from QWidget

### Public Functions

- QMultiLineEdit ( QWidget * parent = 0, const char * name = 0 )
- ~QMultiLineEdit ()
- bool autoUpdate () const
- void cursorWordBackward ( bool mark )
- void cursorWordForward ( bool mark )
- bool hasMarkedText () const
- virtual void insertAt ( const QString & s, int line, int col, bool mark )
- virtual void insertLine ( const QString & txt, int line = -1 )
- QString markedText () const
- int maxLines () const
- virtual void removeLine ( int paragraph )
- virtual void setCursorPosition ( int line, int col, bool mark )
- void setMaxLines ( int max )
- QString textLine ( int line ) const
- int totalHeight () const
- int totalWidth () const

- 29 public functions inherited from Q3TextEdit
- 32 public functions inherited from QScrollView
- 2 public functions inherited from QFrame
- 83 public functions inherited from QWidget
- 24 public functions inherited from QObject
- 2 public functions inherited from QPaintDevice

### Public Slots

- void deselect ()

- 60 public slots inherited from Q3TextEdit
- 8 public slots inherited from QScrollView
- 16 public slots inherited from QWidget
- 1 public slot inherited from QObject

### Signals

- 14 signals inherited from Q3TextEdit
- 5 signals inherited from QScrollView
- 1 signal inherited from QObject

### Static Public Members

- 4 static public members inherited from QWidget
- 4 static public members inherited from QObject

### Protected Functions

- virtual void backspace ()
- virtual void cursorDown ( bool mark = false )
- virtual void cursorLeft ( bool mark = false, bool wrap = true )
- QPoint cursorPoint () const
- virtual void cursorRight ( bool mark = false, bool wrap = true )
- virtual void cursorUp ( bool mark = false )
- virtual void end ( bool mark = false )
- bool getMarkedRegion ( int * line1, int * col1, int * line2, int * col2 ) const
- virtual void home ( bool mark = false )
- virtual void insertAndMark ( const QString & str, bool mark )
- virtual void killLine ()
- int lineLength ( int row ) const
- virtual void newLine ()
- virtual void pageDown ( bool mark = false )
- virtual void pageUp ( bool mark = false )

- 6 protected functions inherited from Q3TextEdit
- 22 protected functions inherited from QScrollView
- 44 protected functions inherited from QWidget
- 9 protected functions inherited from QObject

## Detailed Description

The QMultiLineEdit widget is a simple editor for inputting text.

The QMultiLineEdit was a simple editor widget in former Qt versions. Qt 3.0 includes a new richtext engine which obsoletes QMultiLineEdit. It is still included for compatibility reasons. It is now a subclass of Q3TextEdit, and provides enough of the old QMultiLineEdit API to keep old applications working.

If you implement something new with QMultiLineEdit, we suggest using Q3TextEdit instead and call Q3TextEdit::setTextFormat(Qt::PlainText).

Although most of the old QMultiLineEdit API is still available, there is a few difference. The old QMultiLineEdit operated on lines, not on paragraphs. As lines change all the time during wordwrap, the new richtext engine uses paragraphs as basic elements in the data structure. All functions (numLines(), textLine(), etc.) that operated on lines, now operate on paragraphs. Further, getString() has been removed completely. It revealed too much of the internal data structure.

Applications which made normal and reasonable use of QMultiLineEdit should still work without problems. Some odd usage will require some porting. In these cases, it may be better to use Q3TextEdit now.

See also Q3TextEdit.

## Property Documentation

### alignment : Qt::Alignment

This property holds the editor's paragraph alignment.

Sets the alignment to flag, which must be `Qt::AlignLeft`, `Qt::AlignHCenter` or `Qt::AlignRight`.

If flag is an illegal flag, nothing happens.

Access functions:

- Qt::Alignment alignment () const
- void setAlignment ( Qt::Alignment flags )

### atBeginning : bool

This property holds whether the cursor is placed at the beginning of the text.

Access functions:

- bool atBeginning () const

See also atEnd.

### atEnd : bool

This property holds whether the cursor is placed at the end of the text.

Access functions:

- bool atEnd () const

See also atBeginning.

### edited : bool

This property holds whether the document has been edited by the user.

This is the same as Q3TextEdit's "modifed" property.

Access functions:

- bool edited () const
- void setEdited ( bool )

### numLines : int

This property holds the number of paragraphs in the editor.

The count includes any empty paragraph at top and bottom, so for an empty editor this method returns 1.

Access functions:

- int numLines () const

## Member Function Documentation

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

Constructs a new, empty, QMultiLineEdit with parent parent called name.

### QMultiLineEdit::~QMultiLineEdit ()

Destructor.

### bool QMultiLineEdit::autoUpdate () const

### 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 selected by the user (e.g. by clicking and dragging) the cursor is put at the beginning of the selected text and the selected text is removed.

del()

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

Moves the cursor one line down. If mark is true, the text is selected.

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 selected. The wrap parameter is currently ignored.

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

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

Returns the top center point where the cursor is drawn.

### 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 selected. The wrap parameter is currently ignored.

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 selected.

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 selected.

See also cursorWordForward().

### void QMultiLineEdit::cursorWordForward ( bool mark )

Moves the cursor one word to the right. If mark is true, the text is selected.

See also cursorWordBackward().

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

### 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 selected toward the last position. If it is false and the cursor is moved, all selected text is unselected.

See also home().

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

If there is selected text, sets line1, col1, line2 and col2 to the start and end of the selected region and returns true. Returns false if there is no selected text.

### bool QMultiLineEdit::hasMarkedText () const

Returns true if there is selected 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 selected toward the first position. If it is false and the cursor is moved, all selected text is unselected.

See also end().

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

Inserts str at the current cursor position and selects the text if mark is true.

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

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Inserts string s at paragraph number line, after character number col in the paragraph. If s contains newline characters, new lines are inserted. If mark is true the inserted string will be selected.

The cursor position is adjusted.

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

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

The cursor position is not changed.

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

Deletes text from the current cursor position to the end of the line. (Note that this function still operates on lines, not paragraphs.)

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

Returns the number of characters at paragraph number row. If row is out of range, -1 is returned.

### QString QMultiLineEdit::markedText () const

Returns a copy of the selected text.

### int QMultiLineEdit::maxLines () const

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

Splits the paragraph at the current cursor position.

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

Moves the cursor one page down. If mark is true, the text is selected.

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

Moves the cursor one page up. If mark is true, the text is selected.

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

Deletes the paragraph at paragraph number paragraph. If paragraph is less than zero or larger than the number of paragraphs, nothing is deleted.

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

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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

If mark is false, the selection is cleared. otherwise it is extended.

### void QMultiLineEdit::setMaxLines ( int max )

Sets the maximum number of lines this QMultiLineEdit will hold to max.

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

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

### int QMultiLineEdit::totalHeight () const

### int QMultiLineEdit::totalWidth () const