Qt logo

QMultiLineEdit Class Reference


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

#include <qmultilineedit.h>

Inherits QTableView.

List of all member functions.

Public Members

Public Slots

Signals

Protected Members


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

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

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:

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


Member Function Documentation

QMultiLineEdit::QMultiLineEdit(QWidget*parent=0, constchar*name=0)

Creates a new, empty, QMultiLineEdit.

QMultiLineEdit::~QMultiLineEdit()

Destroys the QMultiLineEdit.

intQMultiLineEdit::alignment()const

Not supported at this time.

voidQMultiLineEdit::append(constQString&s) [slot]

Appends s to the text.

boolQMultiLineEdit::atBeginning()const

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

boolQMultiLineEdit::atEnd()const

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

boolQMultiLineEdit::autoUpdate()const

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

See also: setAutoUpdate().

voidQMultiLineEdit::backspace() [virtualprotected]

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().

voidQMultiLineEdit::clear() [slot]

Removes all text.

voidQMultiLineEdit::copy()const [slot]

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

voidQMultiLineEdit::cursorDown(boolmark=FALSE) [virtualprotected]

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

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

voidQMultiLineEdit::cursorLeft(boolmark=FALSE, boolwrap=TRUE) [virtualprotected]

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().

QPointQMultiLineEdit::cursorPoint()const [protected]

Returns the top center point where the cursor is drawn.

voidQMultiLineEdit::cursorPosition(int*line, int*col)const

This function is obsolete. It is provided to keep old programs working. We strongly advise against using it in new code.

Use getCursorPosition() instead.

voidQMultiLineEdit::cursorRight(boolmark=FALSE, boolwrap=TRUE) [virtualprotected]

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().

voidQMultiLineEdit::cursorUp(boolmark=FALSE) [virtualprotected]

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

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

voidQMultiLineEdit::cursorWordBackward(boolmark)

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

See also: cursorWordForward().

voidQMultiLineEdit::cursorWordForward(boolmark)

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

See also: cursorWordBackward().

voidQMultiLineEdit::cut() [slot]

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

voidQMultiLineEdit::del() [virtualprotected]

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().

voidQMultiLineEdit::deselect() [slot]

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

voidQMultiLineEdit::dragLeaveEvent(QDragLeaveEvent*) [virtualprotected]

Handles drag leave events, cancelling any auto-scrolling.

Reimplemented from QWidget.

voidQMultiLineEdit::dragMoveEvent(QDragMoveEvent*event) [virtualprotected]

Handles drag motion events, accepting text and positioning the cursor.

Reimplemented from QWidget.

voidQMultiLineEdit::dropEvent(QDropEvent*event) [virtualprotected]

Handles drop events, pasting text.

Reimplemented from QWidget.

QMultiLineEdit::EchoModeQMultiLineEdit::echoMode()const

Returns the currently set echo mode.

See also: setEchoMode().

boolQMultiLineEdit::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().

voidQMultiLineEdit::end(boolmark=FALSE) [virtualprotected]

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().

voidQMultiLineEdit::focusInEvent(QFocusEvent*) [virtualprotected]

Starts the cursor blinking.

Reimplemented from QWidget.

voidQMultiLineEdit::focusOutEvent(QFocusEvent*) [virtualprotected]

stops the cursor blinking.

Reimplemented from QWidget.

voidQMultiLineEdit::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().

boolQMultiLineEdit::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(intline)const [protected]

Returns a pointer to the text at line line.

intQMultiLineEdit::hMargin()const

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

See also: setHMargin().

boolQMultiLineEdit::hasMarkedText()const [protected]

Returns TRUE if there is marked text.

voidQMultiLineEdit::home(boolmark=FALSE) [virtualprotected]

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().

voidQMultiLineEdit::insert(constQString&s) [slot]

Inserts s at the current cursor position.

voidQMultiLineEdit::insert(constQString&str, boolmark) [virtualprotected]

Inserts c at the current cursor position.

voidQMultiLineEdit::insertAt(constQString&txt, intline, intcol, boolmark=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.

voidQMultiLineEdit::insertChar(QCharc) [protected]

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

voidQMultiLineEdit::insertLine(constQString&txt, intline=-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.

boolQMultiLineEdit::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().

boolQMultiLineEdit::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().

voidQMultiLineEdit::keyPressEvent(QKeyEvent*e) [virtualprotected]

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

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

All other keys with valid ASCII codes insert themselves into the line.

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

Reimplemented from QWidget.

voidQMultiLineEdit::killLine() [virtualprotected]

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

voidQMultiLineEdit::leaveEvent(QEvent*) [virtualprotected]

Handles auto-copy of selection (X11 only).

Reimplemented from QWidget.

intQMultiLineEdit::lineLength(intline)const [protected]

Returns the number of characters at line number line.

QStringQMultiLineEdit::markedText()const [protected]

Returns a copy of the marked text.

intQMultiLineEdit::maxLineLength()const

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

See also: setMaxLineLength().

intQMultiLineEdit::maxLineWidth()const

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

intQMultiLineEdit::maxLines()const

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

See also: setMaxLines().

QSizeQMultiLineEdit::minimumSizeHint()const [virtual]

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

Reimplemented from QWidget.

voidQMultiLineEdit::mouseDoubleClickEvent(QMouseEvent*m) [virtualprotected]

Handles double click events.

Reimplemented from QWidget.

voidQMultiLineEdit::mouseMoveEvent(QMouseEvent*e) [virtualprotected]

Handles mouse move events.

Reimplemented from QWidget.

voidQMultiLineEdit::mousePressEvent(QMouseEvent*m) [virtualprotected]

Handles mouse press events.

Reimplemented from QWidget.

voidQMultiLineEdit::mouseReleaseEvent(QMouseEvent*e) [virtualprotected]

Handles mouse release events.

Reimplemented from QWidget.

voidQMultiLineEdit::newLine() [virtualprotected]

Makes a line break at the current cursor position.

intQMultiLineEdit::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.

voidQMultiLineEdit::pageDown(boolmark=FALSE) [virtualprotected]

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

voidQMultiLineEdit::pageUp(boolmark=FALSE) [virtualprotected]

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

voidQMultiLineEdit::paintCell(QPainter*painter, introw, int) [virtualprotected]

Implements the basic drawing logic.

Reimplemented from QTableView.

voidQMultiLineEdit::paste() [slot]

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

voidQMultiLineEdit::removeLine(intline) [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.

voidQMultiLineEdit::resizeEvent(QResizeEvent*e) [virtualprotected]

Reimplemented for internal purposes.

Reimplemented from QWidget.

voidQMultiLineEdit::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().

voidQMultiLineEdit::selectAll() [slot]

Selects all text without moving the cursor.

voidQMultiLineEdit::setAlignment(intflags)

Not supported at this time.

voidQMultiLineEdit::setAutoUpdate(boolenable) [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().

voidQMultiLineEdit::setCursorPosition(intline, intcol, boolmark=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().

voidQMultiLineEdit::setEchoMode(EchoModeem) [virtual]

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

The display is updated according.

See also: setEchoMode().

voidQMultiLineEdit::setEdited(boole)

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().

voidQMultiLineEdit::setFixedVisibleLines(intlines) [virtual]

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

See also: setMaxLines() and setFixedHeight().

voidQMultiLineEdit::setFont(constQFont&font) [virtual]

Reimplements QWidget::setFont() to update the list box line height.

voidQMultiLineEdit::setHMargin(intm) [virtual]

Sets the horizontal margin.

See also: hMargin().

voidQMultiLineEdit::setMaxLineLength(intm) [virtual]

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

See also: maxLineLength().

voidQMultiLineEdit::setMaxLines(intm) [virtual]

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

See also: maxLines().

voidQMultiLineEdit::setOverwriteMode(boolon) [virtualslot]

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

See also: isOverwriteMode().

voidQMultiLineEdit::setReadOnly(boolon) [virtualslot]

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

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

voidQMultiLineEdit::setSelection(int, int, int, int) [virtual]

Not supported at this time.

voidQMultiLineEdit::setText(constQString&s) [virtualslot]

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

voidQMultiLineEdit::setValidator(constQValidator*v) [virtual]

Not supported at this time.

QSizeQMultiLineEdit::sizeHint()const [virtual]

Returns a size sufficient for a few lines of text, or any value set by setFixedVisibleLines().

Reimplemented from QWidget.

QSizePolicyQMultiLineEdit::sizePolicy()const [virtual]

Specifies that this widget can use additional space, and that it can survive on less than sizeHint().

Reimplemented from QWidget.

QStringQMultiLineEdit::stringShown(introw)const [protected]

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

QStringQMultiLineEdit::text()const

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

voidQMultiLineEdit::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().

QStringQMultiLineEdit::textLine(intline)const

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

intQMultiLineEdit::textWidth(constQString&s) [protected]

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

intQMultiLineEdit::textWidth(intline) [protected]

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

voidQMultiLineEdit::timerEvent(QTimerEvent*t) [virtualprotected]

Cursor blinking, drag scrolling.

Reimplemented from QObject.

constQValidator*QMultiLineEdit::validator()const

Not supported at this time.

voidQMultiLineEdit::wheelEvent(QWheelEvent*e) [virtualprotected]

An override - pass wheel events to the vertical scrollbar.

Reimplemented from QWidget.


Search the documentation, FAQ, qt-interest archive and more (uses www.troll.no):


This file is part of the Qt toolkit, copyright © 1995-99 Troll Tech, all rights reserved.


Copyright 1999 Troll TechTrademarks
Qt version 2.0.2