Qt logo

QMultiLineEdit Class Reference


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

#include <qmultilinedit.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: mainlyMotif/editor.cpp mainlyQt/editor.cpp application/application.cpp pref/pref.cpp layout/layout.cpp mainlyXt/editor.cpp widgets/widgets.cpp


Member Function Documentation

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

Creates a new, empty, QMultiLineEdit.

QMultiLineEdit::~QMultiLineEdit ()

Destroys the QMultiLineEdit.

void QMultiLineEdit::append ( const char * 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::copyText () [slot]

Copies the marked text to the clipboard.

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

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

See also: cursorDown(), 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

Sets line to the current line and col to the current character position within that line.

See also: setCursorPosition().

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::cut () [slot]

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

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

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

Starts the cursor blinking.

Reimplemented from QWidget.

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

stops the cursor blinking.

Reimplemented from QWidget.

void QMultiLineEdit::getCursorPosition ( int * line, int * col )

Sets line to the current line and col to the current character position within that line.

OBSOLETE - Use cursorPosition() instead.

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.

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::insertAt ( const char * txt, int line, int col ) [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 poition, the cursor is placed after the end of the new text.

void QMultiLineEdit::insertChar ( char c ) [virtual protected]

Inserts c at the current cursor position.

void QMultiLineEdit::insertLine ( const char * 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::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().

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:

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.

void QMultiLineEdit::killLine () [virtual protected]

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

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

Handles auto-copy of selection (X11 only).

Reimplemented from QWidget.

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::maxLineWidth () const

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

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

Handles double click events.

Reimplemented from QWidget.

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

Handles mouse move events.

Reimplemented from QWidget.

void QMultiLineEdit::mousePressEvent ( QMouseEvent * m ) [virtual protected]

Handles mouse press events.

Reimplemented from QWidget.

void QMultiLineEdit::mouseReleaseEvent ( QMouseEvent * ) [virtual protected]

Handles mouse release events.

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 text from the clipboard onto the current cursor position. Any marked text is first deleted.

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 to set the column width, so that repaint(FALSE) is safe.

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::setAutoUpdate ( bool enable )

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.

See also: autoUpdate() and repaint().

void QMultiLineEdit::setCursorPosition ( int line, int col, bool mark = FALSE )

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::setFixedVisibleLines ( int lines )

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

See also: setFixedHeight().

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

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

Reimplemented from QWidget.

void QMultiLineEdit::setOverwriteMode ( bool on ) [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 ) [slot]

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

void QMultiLineEdit::setText ( const char * s ) [slot]

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

Examples: mainlyMotif/editor.cpp mainlyQt/editor.cpp mainlyXt/editor.cpp widgets/widgets.cpp

QString QMultiLineEdit::text () const

Returns a copy of the whole text. If the multi line edit contains no text, the empty 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().

const char * QMultiLineEdit::textLine ( int line ) const

Returns the text at line number line, or 0 if line is invalid.

int QMultiLineEdit::textWidth ( 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 * t ) [virtual protected]

Cursor blinking, drag scrolling.

Reimplemented from QObject.


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


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

It was generated from the following files:


Copyright © 1998 Troll TechTrademarks
Qt version 1.42