返回介绍

QtMultiLineEdit Class

发布于 2019-10-04 15:03:34 字数 39620 浏览 968 评论 0 收藏 0

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

#include <qtmultilineedit.h>

Inherits QtTableView.

List of all member functions.

Public Members

  • QtMultiLineEdit ( QWidget*parent = 0, constchar*name = 0 )
  • ~QtMultiLineEdit ()
  • QString textLine ( intline ) const
  • int numLines () const
  • virtual QSize minimumSizeHint () const
  • virtual void insertLine ( constQString&txt, intline = -1 )
  • virtual void insertAt ( constQString&s, intline, intcol, boolmark = FALSE )
  • virtual void removeLine ( intline )
  • void cursorPosition ( int*line, int*col ) const (obsolete)
  • virtual void setCursorPosition ( intline, intcol, boolmark = FALSE )
  • void getCursorPosition ( int*line, int*col ) const
  • bool atBeginning () const
  • bool atEnd () const
  • virtual void setFixedVisibleLines ( intlines )
  • int maxLineWidth () const
  • void setAlignment ( intflags )
  • int alignment () const
  • virtual void setValidator ( constQValidator*v )
  • const QValidator * validator () const
  • void setEdited ( bool )
  • bool edited () const
  • void cursorWordForward ( boolmark )
  • void cursorWordBackward ( boolmark )
  • enum EchoMode { Normal, NoEcho, Password }
  • virtual void setEchoMode ( EchoMode )
  • EchoMode echoMode () const
  • void setMaxLength ( int )
  • int maxLength () const
  • virtual void setMaxLineLength ( intm )
  • int maxLineLength () const
  • virtual void setMaxLines ( int )
  • int maxLines () const
  • virtual void setHMargin ( int )
  • int hMargin () const
  • virtual void setSelection ( introw_from, intcol_from, introw_to, intcol_to )
  • enum WordWrap { NoWrap, WidgetWidth, FixedPixelWidth, FixedColumnWidth }
  • void setWordWrap ( WordWrapmode )
  • WordWrap wordWrap () const
  • void setWrapColumnOrWidth ( int )
  • int wrapColumnOrWidth () const
  • enum WrapPolicy { AtWhiteSpace, Anywhere }
  • void setWrapPolicy ( WrapPolicypolicy )
  • 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 ( constQString&s )
  • void deselect ()
  • void selectAll ()
  • void paste ()
  • void pasteSubType ( constQCString&subtype )
  • void copyText () const (obsolete)
  • void copy () const
  • void cut ()
  • void insert ( constQString&s )
  • void undo ()
  • void redo ()

Signals

  • void textChanged ()
  • void returnPressed ()
  • void undoAvailable ( boolyes )
  • void redoAvailable ( boolyes )
  • void copyAvailable ( boolyes )

Static Public Members

  • void setDefaultTabStop ( intex )
  • int defaultTabStop ()

Properties

  • Alignment alignment- the alignment
  • bool atBeginning- whether the cursor is at the beginning (read only)
  • bool atEnd- whether the cursor is at the end (read only)
  • bool autoUpdate- whether auto update is enabled
  • EchoMode echoMode- the echo mode
  • bool edited- whether the text had been edited
  • int hMargin- the horizontal margin The horizontal margin current set. The default is 3
  • int length- the length of the text (read only)
  • int maxLength- the maximum length of the text
  • int maxLineWidth- the maximum line width in pixels Returns the width in pixels of the longest text line in this editor (read only)
  • int maxLines- the maximum number of lines The currently set line limit, or -1 if there is no limit (the default)
  • int numLines- the number of lines in the multi-line edit (read only)
  • bool overWriteMode- the overwrite mode
  • bool readOnly- whether the multi-line edit is read-only
  • QString text- the multi-line edit's text
  • int undoDepth- the undo depth
  • bool undoEnabled- whether undo is enabled
  • WordWrap wordWrap- the word wrap mode
  • int wrapColumnOrWidth- the wrap width in columns or pixels The wrap column or wrap width, depending on the word wrap mode
  • WrapPolicy wrapPolicy- the wrap policy mode The default is \c AtWhiteSpace

Protected Members

  • virtual void paintCell ( QPainter*painter, introw, intcol )
  • virtual void keyPressEvent ( QKeyEvent*e )
  • virtual void focusInEvent ( QFocusEvent * )
  • bool hasMarkedText () const
  • QString markedText () const
  • int textWidth ( intline )
  • int textWidth ( constQString&s )
  • QPoint cursorPoint () const
  • virtual void insert ( constQString&str, boolmark )
  • virtual void newLine ()
  • virtual void killLine ()
  • virtual void pageUp ( boolmark = FALSE )
  • virtual void pageDown ( boolmark = FALSE )
  • virtual void cursorLeft ( boolmark = FALSE, boolwrap = TRUE )
  • virtual void cursorRight ( boolmark = FALSE, boolwrap = TRUE )
  • virtual void cursorUp ( boolmark = FALSE )
  • virtual void cursorDown ( boolmark = FALSE )
  • virtual void backspace ()
  • virtual void del ()
  • virtual void home ( boolmark = FALSE )
  • virtual void end ( boolmark = FALSE )
  • bool getMarkedRegion ( int*line1, int*col1, int*line2, int*col2 ) const
  • int lineLength ( intline ) const
  • QString * getString ( intline ) const
  • bool isEndOfParagraph ( introw ) const
  • QString stringShown ( introw ) const
  • void insertChar ( QCharc )

Detailed Description

The QtMultiLineEdit widget is a simple editor for inputting text.

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

The QtMultiLineEdit 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.


Member Type Documentation

QtMultiLineEdit::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 echoMode, echoMode and QLineEdit::EchoMode.

QtMultiLineEdit::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 wordWrap.

QtMultiLineEdit::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 wrapPolicy.


Member Function Documentation

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

Constructs a new, empty, QtMultiLineEdit with parent parent and called name.

QtMultiLineEdit::~QtMultiLineEdit ()

Destroys the QtMultiLineEdit

int QtMultiLineEdit::alignment () const

Returns the alignment. See the "alignment" property for details.

void QtMultiLineEdit::append ( constQString&s ) [slot]

Appends s to the text.

bool QtMultiLineEdit::atBeginning () const

Returns TRUE if the cursor is at the beginning; otherwise returns FALSE. See the "atBeginning" property for details.

bool QtMultiLineEdit::atEnd () const

Returns TRUE if the cursor is at the end; otherwise returns FALSE. See the "atEnd" property for details.

bool QtMultiLineEdit::autoUpdate () const

Returns TRUE if auto update is enabled; otherwise returns FALSE. See the "autoUpdate" property for details.

void QtMultiLineEdit::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 QtMultiLineEdit::clear () [slot]

Removes all text.

void QtMultiLineEdit::copy () const [slot]

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

void QtMultiLineEdit::copyAvailable ( boolyes ) [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 QtMultiLineEdit::copyText () const [slot]

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

Backward compatibility.

void QtMultiLineEdit::cursorDown ( boolmark = FALSE ) [virtual protected]

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

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

void QtMultiLineEdit::cursorLeft ( boolmark = FALSE, boolwrap = 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 QtMultiLineEdit::cursorPoint () const [protected]

Returns the top center point where the cursor is drawn

void QtMultiLineEdit::cursorPosition ( int*line, int*col ) const

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

Use getCursorPosition() instead.

void QtMultiLineEdit::cursorRight ( boolmark = FALSE, boolwrap = 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 QtMultiLineEdit::cursorUp ( boolmark = FALSE ) [virtual protected]

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

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

void QtMultiLineEdit::cursorWordBackward ( boolmark )

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

See also cursorWordForward().

void QtMultiLineEdit::cursorWordForward ( boolmark )

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

See also cursorWordBackward().

void QtMultiLineEdit::cut () [slot]

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

int QtMultiLineEdit::defaultTabStop () [static]

Returns the distance between tab stops.

See also setDefaultTabStop().

void QtMultiLineEdit::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 QtMultiLineEdit::deselect () [slot]

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

EchoMode QtMultiLineEdit::echoMode () const

Returns the echo mode. See the "echoMode" property for details.

bool QtMultiLineEdit::edited () const

Returns TRUE if the text had been edited; otherwise returns FALSE. See the "edited" property for details.

void QtMultiLineEdit::end ( boolmark = 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 QtMultiLineEdit::focusInEvent ( QFocusEvent* ) [virtual protected]

Starts the cursor blinking.

Reimplemented from QWidget.

void QtMultiLineEdit::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 QtMultiLineEdit::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* QtMultiLineEdit::getString ( intline ) const [protected]

Returns a pointer to the text at line line.

int QtMultiLineEdit::hMargin () const

Returns the horizontal margin The horizontal margin current set. The default is 3. See the "hMargin" property for details.

bool QtMultiLineEdit::hasMarkedText () const [protected]

Returns TRUE if there is marked text.

void QtMultiLineEdit::home ( boolmark = 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 QtMultiLineEdit::insert ( constQString&s ) [slot]

Inserts s at the current cursor position.

void QtMultiLineEdit::insert ( constQString&str, boolmark ) [virtual protected]

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

Inserts string str at the current cursor position. If mark is TRUE the string is marked.

void QtMultiLineEdit::insertAt ( constQString&s, intline, intcol, boolmark = FALSE ) [virtual]

Inserts s at line number line, after character number col in the line. If s contains newline characters, new lines are inserted. If mark is TRUE the inserted text is selected.

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 QtMultiLineEdit::insertChar ( QCharc ) [protected]

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

void QtMultiLineEdit::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.

bool QtMultiLineEdit::isEndOfParagraph ( introw ) 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 wordWrap.

bool QtMultiLineEdit::isOverwriteMode () const

Returns the overwrite mode. See the "overWriteMode" property for details.

bool QtMultiLineEdit::isReadOnly () const

Returns TRUE if the multi-line edit is read-only; otherwise returns FALSE. See the "readOnly" property for details.

bool QtMultiLineEdit::isUndoEnabled () const

Returns TRUE if undo is enabled; otherwise returns FALSE. See the "undoEnabled" property for details.

void QtMultiLineEdit::keyPressEvent ( QKeyEvent*e ) [virtual protected]

The key press event handler converts a key press in event e 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 QtMultiLineEdit::killLine () [virtual protected]

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

int QtMultiLineEdit::length () const

Returns the length of the text. See the "length" property for details.

int QtMultiLineEdit::lineLength ( intline ) const [protected]

Returns the number of characters at line number line.

QString QtMultiLineEdit::markedText () const [protected]

Returns a copy of the marked text.

int QtMultiLineEdit::maxLength () const

Returns the maximum length of the text. See the "maxLength" property for details.

int QtMultiLineEdit::maxLineLength () const

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

See also setMaxLineLength().

int QtMultiLineEdit::maxLineWidth () const

Returns the maximum line width in pixels Returns the width in pixels of the longest text line in this editor. See the "maxLineWidth" property for details.

int QtMultiLineEdit::maxLines () const

Returns the maximum number of lines The currently set line limit, or -1 if there is no limit (the default). See the "maxLines" property for details.

QSize QtMultiLineEdit::minimumSizeHint () const [virtual]

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

Reimplemented from QWidget.

void QtMultiLineEdit::newLine () [virtual protected]

Makes a line break at the current cursor position.

int QtMultiLineEdit::numLines () const

Returns the number of lines in the multi-line edit. See the "numLines" property for details.

void QtMultiLineEdit::pageDown ( boolmark = FALSE ) [virtual protected]

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

void QtMultiLineEdit::pageUp ( boolmark = FALSE ) [virtual protected]

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

void QtMultiLineEdit::paintCell ( QPainter*painter, introw, intcol ) [virtual protected]

Implements the basic drawing logic. Paints the line at row row using painter painter. The col parameter is ignored.

Reimplemented from QtTableView.

void QtMultiLineEdit::paste () [slot]

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

void QtMultiLineEdit::pasteSubType ( constQCString&subtype ) [slot]

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

void QtMultiLineEdit::redo () [slot]

Redoes the last text operation.

void QtMultiLineEdit::redoAvailable ( boolyes ) [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 QtMultiLineEdit::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.

void QtMultiLineEdit::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 QtMultiLineEdit::selectAll () [slot]

Selects all text without moving the cursor.

void QtMultiLineEdit::setAlignment ( intflags )

Sets the alignment to flags. See the "alignment" property for details.

void QtMultiLineEdit::setAutoUpdate ( bool ) [virtual]

Sets whether auto update is enabled. See the "autoUpdate" property for details.

Reimplemented from QtTableView.

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

void QtMultiLineEdit::setDefaultTabStop ( intex ) [static]

Sets the distance between tab stops for all QtMultiLineEdit 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 QtMultiLineEdit widgets are shown.

See also defaultTabStop().

void QtMultiLineEdit::setEchoMode ( EchoMode ) [virtual]

Sets the echo mode. See the "echoMode" property for details.

void QtMultiLineEdit::setEdited ( bool )

Sets whether the text had been edited. See the "edited" property for details.

void QtMultiLineEdit::setFixedVisibleLines ( intlines ) [virtual]

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

See also maxLines and setFixedHeight().

void QtMultiLineEdit::setHMargin ( int ) [virtual]

Sets the horizontal margin The horizontal margin current set. The default is 3. See the "hMargin" property for details.

void QtMultiLineEdit::setMaxLength ( int )

Sets the maximum length of the text. See the "maxLength" property for details.

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

void QtMultiLineEdit::setMaxLines ( int ) [virtual]

Sets the maximum number of lines The currently set line limit, or -1 if there is no limit (the default). See the "maxLines" property for details.

void QtMultiLineEdit::setOverwriteMode ( bool ) [virtual slot]

Sets the overwrite mode. See the "overWriteMode" property for details.

void QtMultiLineEdit::setReadOnly ( bool ) [virtual slot]

Sets whether the multi-line edit is read-only. See the "readOnly" property for details.

void QtMultiLineEdit::setSelection ( introw_from, intcol_from, introw_to, intcol_to ) [virtual]

Marks the text starting at row_from, col_from and ending at row_to, col_to.

void QtMultiLineEdit::setText ( constQString& ) [virtual slot]

Sets the multi-line edit's text. See the "text" property for details.

void QtMultiLineEdit::setUndoDepth ( int )

Sets the undo depth. See the "undoDepth" property for details.

void QtMultiLineEdit::setUndoEnabled ( bool )

Sets whether undo is enabled. See the "undoEnabled" property for details.

void QtMultiLineEdit::setValidator ( constQValidator*v ) [virtual]

Not supported at this time. v is the validator to set.

void QtMultiLineEdit::setWordWrap ( WordWrapmode )

Sets the word wrap mode to mode. See the "wordWrap" property for details.

void QtMultiLineEdit::setWrapColumnOrWidth ( int )

Sets the wrap width in columns or pixels The wrap column or wrap width, depending on the word wrap mode. See the "wrapColumnOrWidth" property for details.

void QtMultiLineEdit::setWrapPolicy ( WrapPolicypolicy )

Sets the wrap policy mode The default is AtWhiteSpace to policy. See the "wrapPolicy" property for details.

QString QtMultiLineEdit::stringShown ( introw ) const [protected]

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

QString QtMultiLineEdit::text () const

Returns the multi-line edit's text. See the "text" property for details.

void QtMultiLineEdit::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 QtMultiLineEdit::textLine ( intline ) const

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

int QtMultiLineEdit::textWidth ( intline ) [protected]

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

int QtMultiLineEdit::textWidth ( constQString&s ) [protected]

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

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

void QtMultiLineEdit::undo () [slot]

Undoes the last text operation.

void QtMultiLineEdit::undoAvailable ( boolyes ) [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 QtMultiLineEdit::undoDepth () const

Returns the undo depth. See the "undoDepth" property for details.

constQValidator* QtMultiLineEdit::validator () const

Not supported at this time.

WordWrap QtMultiLineEdit::wordWrap () const

Returns the word wrap mode. See the "wordWrap" property for details.

int QtMultiLineEdit::wrapColumnOrWidth () const

Returns the wrap width in columns or pixels The wrap column or wrap width, depending on the word wrap mode. See the "wrapColumnOrWidth" property for details.

WrapPolicy QtMultiLineEdit::wrapPolicy () const

Returns the wrap policy mode The default is AtWhiteSpace. See the "wrapPolicy" property for details.


Property Documentation

Alignment alignment

This property holds the alignment.

Possible values are AlignLeft, Align(H)Center and AlignRight.

See also Qt::AlignmentFlags.

Set this property's value with setAlignment() and get this property's value with alignment().

bool atBeginning

This property holds whether the cursor is at the beginning.

atBeginning() returns TRUE if the cursor is placed at the beginning of the text.

Get this property's value with atBeginning().

bool atEnd

This property holds whether the cursor is at the end.

atEnd() returns TRUE if the cursor is placed at the end of the text.

Get this property's value with atEnd().

bool autoUpdate

This property holds whether auto update is enabled.

autoUpdate() returns TRUE if the view updates itself automatically whenever it is changed in some way.

If autoUpdate() 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 autoUpdate() 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 repaint().

Set this property's value with setAutoUpdate() and get this property's value with autoUpdate().

EchoMode echoMode

This property holds the echo mode.

Set this property's value with setEchoMode() and get this property's value with echoMode().

bool edited

This property holds whether the text had been edited.

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

setEdited() sets the edited flag of this line edit to e. The edited flag is never read by QtMultiLineEdit, 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.

Set this property's value with setEdited() and get this property's value with edited().

int hMargin

This property holds the horizontal margin The horizontal margin current set. The default is 3.

Set this property's value with setHMargin() and get this property's value with hMargin().

int length

This property holds the length of the text.

Get this property's value with length().

int maxLength

This property holds the maximum length of the text.

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

Set this property's value with setMaxLength() and get this property's value with maxLength().

int maxLineWidth

This property holds the maximum line width in pixels Returns the width in pixels of the longest text line in this editor.

Get this property's value with maxLineWidth().

int maxLines

This property holds the maximum number of lines The currently set line limit, or -1 if there is no limit (the default).

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.

Set this property's value with setMaxLines() and get this property's value with maxLines().

int numLines

This property holds the number of lines in the multi-line edit.

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

Get this property's value with numLines().

bool overWriteMode

This property holds the overwrite mode.

Set this property's value with setOverwriteMode() and get this property's value with isOverwriteMode().

bool readOnly

This property holds whether the multi-line edit is read-only.

Set this property's value with setReadOnly() and get this property's value with isReadOnly().

QString text

This property holds the multi-line edit's text.

Set this property's value with setText() and get this property's value with text().

int undoDepth

This property holds the undo depth.

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

See also undoDepth.

Set this property's value with setUndoDepth() and get this property's value with undoDepth().

bool undoEnabled

This property holds whether undo is enabled.

Set this property's value with setUndoEnabled() and get this property's value with isUndoEnabled().

WordWrap wordWrap

This property holds the word wrap mode.

By 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 wrapColumnOrWidth and wrapPolicy.

Set this property's value with setWordWrap() and get this property's value with wordWrap().

int wrapColumnOrWidth

This property holds the wrap width in columns or pixels The wrap column or wrap width, depending on the word wrap mode.

Set this property's value with setWrapColumnOrWidth() and get this property's value with wrapColumnOrWidth().

See also wordWrap and wrapColumnOrWidth.

WrapPolicy wrapPolicy

This property holds the wrap policy mode The default is AtWhiteSpace.

Set this property's value with setWrapPolicy() and get this property's value with wrapPolicy().

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文