Eneboo - Documentación para desarrolladores
Tipos públicos | Slots públicos | Señales | Métodos públicos | Métodos protegidos | Propiedades | Amigas
Referencia de la Clase QLineEdit

The QLineEdit widget is a one-line text editor. Más...

#include <qlineedit.h>

Diagrama de herencias de QLineEdit
QFrame QFrame QWidget QWidget QWidget QWidget QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject FLLineEdit QColNumLineEdit QCompletionEdit QRenameEdit VDateInternalYearSelector

Lista de todos los miembros.

Tipos públicos

enum  EchoMode {
  Normal, NoEcho, Password, Normal,
  NoEcho, Password
}
enum  EchoMode {
  Normal, NoEcho, Password, Normal,
  NoEcho, Password
}

Slots públicos

virtual void setText (const QString &)
virtual void selectAll ()
virtual void deselect ()
virtual void clearValidator ()
virtual void insert (const QString &)
virtual void clear ()
virtual void undo ()
virtual void redo ()
virtual void setMaxLength (int)
virtual void setFrame (bool)
virtual void setEchoMode (EchoMode)
virtual void setReadOnly (bool)
virtual void setValidator (const QValidator *)
virtual void setFont (const QFont &)
virtual void setPalette (const QPalette &)
virtual void setSelection (int, int)
virtual void setCursorPosition (int)
virtual void setAlignment (int flag)
virtual void cut ()
virtual void copy () const
virtual void paste ()
virtual void setDragEnabled (bool b)
virtual void setText (const QString &)
virtual void selectAll ()
virtual void deselect ()
virtual void clearValidator ()
virtual void insert (const QString &)
virtual void clear ()
virtual void undo ()
virtual void redo ()
virtual void setMaxLength (int)
virtual void setFrame (bool)
virtual void setEchoMode (EchoMode)
virtual void setReadOnly (bool)
virtual void setValidator (const QValidator *)
virtual void setFont (const QFont &)
virtual void setPalette (const QPalette &)
virtual void setSelection (int, int)
virtual void setCursorPosition (int)
virtual void setAlignment (int flag)
virtual void cut ()
virtual void copy () const
virtual void paste ()
virtual void setDragEnabled (bool b)

Señales

void textChanged (const QString &)
void returnPressed ()
void lostFocus ()
void selectionChanged ()
void textChanged (const QString &)
void returnPressed ()
void lostFocus ()
void selectionChanged ()

Métodos públicos

 QLineEdit (QWidget *parent, const char *name=0)
 QLineEdit (const QString &, QWidget *parent, const char *name=0)
 QLineEdit (const QString &, const QString &, QWidget *parent, const char *name=0)
 ~QLineEdit ()
QString text () const
QString displayText () const
int maxLength () const
bool frame () const
EchoMode echoMode () const
bool isReadOnly () const
const QValidatorvalidator () const
QSize sizeHint () const
QSize minimumSizeHint () const
int cursorPosition () const
bool validateAndSet (const QString &, int, int, int)
int alignment () const
void cursorLeft (bool mark, int steps=1)
void cursorRight (bool mark, int steps=1)
void cursorForward (bool mark, int steps=1)
void cursorBackward (bool mark, int steps=1)
void cursorWordForward (bool mark)
void cursorWordBackward (bool mark)
void backspace ()
void del ()
void home (bool mark)
void end (bool mark)
bool isModified () const
void clearModified ()
bool edited () const
void setEdited (bool)
bool hasSelectedText () const
QString selectedText () const
int selectionStart () const
bool isUndoAvailable () const
bool isRedoAvailable () const
bool hasMarkedText () const
QString markedText () const
bool dragEnabled () const
QString inputMask () const
void setInputMask (const QString &inputMask)
bool hasAcceptableInput () const
void setPasswordChar (QChar c)
QChar passwordChar () const
int characterAt (int, QChar *) const
bool getSelection (int *, int *)
 QLineEdit (QWidget *parent, const char *name=0)
 QLineEdit (const QString &, QWidget *parent, const char *name=0)
 QLineEdit (const QString &, const QString &, QWidget *parent, const char *name=0)
 ~QLineEdit ()
QString text () const
QString displayText () const
int maxLength () const
bool frame () const
EchoMode echoMode () const
bool isReadOnly () const
const QValidatorvalidator () const
QSize sizeHint () const
QSize minimumSizeHint () const
int cursorPosition () const
bool validateAndSet (const QString &, int, int, int)
int alignment () const
void cursorLeft (bool mark, int steps=1)
void cursorRight (bool mark, int steps=1)
void cursorForward (bool mark, int steps=1)
void cursorBackward (bool mark, int steps=1)
void cursorWordForward (bool mark)
void cursorWordBackward (bool mark)
void backspace ()
void del ()
void home (bool mark)
void end (bool mark)
bool isModified () const
void clearModified ()
bool edited () const
void setEdited (bool)
bool hasSelectedText () const
QString selectedText () const
int selectionStart () const
bool isUndoAvailable () const
bool isRedoAvailable () const
bool hasMarkedText () const
QString markedText () const
bool dragEnabled () const
QString inputMask () const
void setInputMask (const QString &inputMask)
bool hasAcceptableInput () const
void setPasswordChar (QChar c)
QChar passwordChar () const
int characterAt (int, QChar *) const
bool getSelection (int *, int *)

Métodos protegidos

bool event (QEvent *)
void mousePressEvent (QMouseEvent *)
void mouseMoveEvent (QMouseEvent *)
void mouseReleaseEvent (QMouseEvent *)
void mouseDoubleClickEvent (QMouseEvent *)
void keyPressEvent (QKeyEvent *)
void imStartEvent (QIMEvent *)
void imComposeEvent (QIMEvent *)
void imEndEvent (QIMEvent *)
void focusInEvent (QFocusEvent *)
void focusOutEvent (QFocusEvent *)
void resizeEvent (QResizeEvent *)
void drawContents (QPainter *)
void dragEnterEvent (QDragEnterEvent *)
void dragMoveEvent (QDragMoveEvent *e)
void dragLeaveEvent (QDragLeaveEvent *e)
void dropEvent (QDropEvent *)
void contextMenuEvent (QContextMenuEvent *)
virtual QPopupMenucreatePopupMenu ()
void windowActivationChange (bool)
void repaintArea (int, int)
bool event (QEvent *)
void mousePressEvent (QMouseEvent *)
void mouseMoveEvent (QMouseEvent *)
void mouseReleaseEvent (QMouseEvent *)
void mouseDoubleClickEvent (QMouseEvent *)
void keyPressEvent (QKeyEvent *)
void imStartEvent (QIMEvent *)
void imComposeEvent (QIMEvent *)
void imEndEvent (QIMEvent *)
void focusInEvent (QFocusEvent *)
void focusOutEvent (QFocusEvent *)
void resizeEvent (QResizeEvent *)
void drawContents (QPainter *)
void dragEnterEvent (QDragEnterEvent *)
void dragMoveEvent (QDragMoveEvent *e)
void dragLeaveEvent (QDragLeaveEvent *e)
void dropEvent (QDropEvent *)
void contextMenuEvent (QContextMenuEvent *)
virtual QPopupMenucreatePopupMenu ()
void windowActivationChange (bool)
void repaintArea (int, int)

Propiedades

QString text
 the line edit's text
int maxLength
 the maximum permitted length of the text
bool frame
 whether the line edit draws itself with a frame
EchoMode echoMode
 the line edit's echo mode
QString displayText
 the displayed text
int cursorPosition
 the current cursor position for this line edit
Alignment alignment
 the alignment of the line edit
bool edited
 whether the line edit has been edited. Use modified instead.
bool modified
 whether the line edit's contents has been modified by the user
bool hasMarkedText
 whether part of the text has been selected by the user. Use hasSelectedText instead.
bool hasSelectedText
 whether there is any text selected
QString markedText
 the text selected by the user. Use selectedText instead.
QString selectedText
 the selected text
bool dragEnabled
 whether the lineedit starts a drag if the user presses and moves the mouse on some selected text
bool readOnly
 whether the line edit is read only.
bool undoAvailable
 whether undo is available
bool redoAvailable
 whether redo is available
QString inputMask
 The validation input mask.
bool acceptableInput
 whether the input satisfies the inputMask and the validator.

Amigas

struct QLineEditPrivate

Descripción detallada

The QLineEdit widget is a one-line text editor.

A line edit allows the user to enter and edit a single line of plain text with a useful collection of editing functions, including undo and redo, cut and paste, and drag and drop.

By changing the echoMode() of a line edit, it can also be used as a "write-only" field, for inputs such as passwords.

The length of the text can be constrained to maxLength(). The text can be arbitrarily constrained using a validator() or an inputMask(), or both.

A related class is QTextEdit which allows multi-line, rich-text editing.

You can change the text with setText() or insert(). The text is retrieved with text(); the displayed text (which may be different, see {EchoMode}) is retrieved with displayText(). Text can be selected with setSelection() or selectAll(), and the selection can be cut(), copy()ied and paste()d. The text can be aligned with setAlignment().

When the text changes the textChanged() signal is emitted; when the Return or Enter key is pressed the returnPressed() signal is emitted. Note that if there is a validator set on the line edit, the returnPressed() signal will only be emitted if the validator returns Acceptable.

By default, QLineEdits have a frame as specified by the Windows and Motif style guides; you can turn it off by calling setFrame(FALSE).

The default key bindings are described below. The line edit also provides a context menu (usually invoked by a right mouse click) that presents some of these editing options. desc Keypress Action Left Arrow Moves the cursor one character to the left. Shift+Left Arrow Moves and selects text one character to the left. Right Arrow Moves the cursor one character to the right. Shift+Right Arrow Moves and selects text one character to the right. Home Moves the cursor to the beginning of the line. End Moves the cursor to the end of the line. Backspace Deletes the character to the left of the cursor. Ctrl+Backspace Deletes the word to the left of the cursor. Delete Deletes the character to the right of the cursor. Ctrl+Delete Deletes the word to the right of the cursor. Ctrl+A Moves the cursor to the beginning of the line. Ctrl+B Moves the cursor one character to the left. Ctrl+C Copies the selected text to the clipboard. (Windows also supports Ctrl+Insert for this operation.) Ctrl+D Deletes the character to the right of the cursor. Ctrl+E Moves the cursor to the end of the line. Ctrl+F Moves the cursor one character to the right. Ctrl+H Deletes the character to the left of the cursor. Ctrl+K Deletes to the end of the line. Ctrl+V Pastes the clipboard text into line edit. (Windows also supports Shift+Insert for this operation.) Ctrl+X Deletes the selected text and copies it to the clipboard. (Windows also supports Shift+Delete for this operation.) Ctrl+Z Undoes the last operation. Ctrl+Y Redoes the last undone operation.

Any other key sequence that represents a valid character, will cause the character to be inserted into the line edit.

qlined-m.png
qlined-w.png
Ver también:
QTextEdit QLabel QComboBox GUI Design Handbook: Field, Entry

Documentación de las enumeraciones miembro de la clase

This enum type describes how a line edit should display its contents.

Normal Display characters as they are entered. This is the default. NoEcho Do not display anything. This may be appropriate for passwords where even the length of the password should be kept secret. Password Display asterisks instead of the characters actually entered.

Ver también:
setEchoMode() echoMode()
Valores de enumeraciones:
Normal 
NoEcho 
Password 
Normal 
NoEcho 
Password 
Valores de enumeraciones:
Normal 
NoEcho 
Password 
Normal 
NoEcho 
Password 

Documentación del constructor y destructor

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

Constructs a line edit with no text.

The maximum text length is set to 32767 characters.

The parent and name arguments are sent to the QWidget constructor.

Ver también:
setText(), setMaxLength()
QLineEdit::QLineEdit ( const QString contents,
QWidget parent,
const char *  name = 0 
)

Constructs a line edit containing the text contents.

The cursor position is set to the end of the line and the maximum text length to 32767 characters.

The parent and name arguments are sent to the QWidget constructor.

Ver también:
text(), setMaxLength()
QLineEdit::QLineEdit ( const QString contents,
const QString inputMask,
QWidget parent,
const char *  name = 0 
)

Constructs a line edit with an input inputMask and the text contents.

The cursor position is set to the end of the line and the maximum text length is set to the length of the mask (the number of mask characters and separators).

The parent and name arguments are sent to the QWidget constructor.

Ver también:
setMask() text()
QLineEdit::~QLineEdit ( )

Destroys the line edit.

QLineEdit::QLineEdit ( QWidget parent,
const char *  name = 0 
)
QLineEdit::QLineEdit ( const QString ,
QWidget parent,
const char *  name = 0 
)
QLineEdit::QLineEdit ( const QString ,
const QString ,
QWidget parent,
const char *  name = 0 
)
QLineEdit::~QLineEdit ( )

Documentación de las funciones miembro

int QLineEdit::alignment ( ) const
int QLineEdit::alignment ( ) const
void QLineEdit::backspace ( )

If no text is selected, deletes the character to the left of the text cursor and moves the cursor one position to the left. If any text is selected, the cursor is moved to the beginning of the selected text and the selected text is deleted.

Ver también:
del()
void QLineEdit::backspace ( )
int QLineEdit::characterAt ( int  xpos,
QChar chr 
) const
int QLineEdit::characterAt ( int  ,
QChar  
) const
virtual void QLineEdit::clear ( ) [virtual, slot]

Reimplementado en QCompletionEdit.

void QLineEdit::clear ( void  ) [virtual, slot]

Clears the contents of the line edit.

Reimplementado en QCompletionEdit.

void QLineEdit::clearModified ( )

Resets the modified flag to FALSE.

Ver también:
isModified()
void QLineEdit::clearModified ( )
virtual void QLineEdit::clearValidator ( ) [virtual, slot]
void QLineEdit::clearValidator ( ) [virtual, slot]

This slot is equivalent to setValidator(0).

void QLineEdit::contextMenuEvent ( QContextMenuEvent e) [protected, virtual]

Reimplementado de QWidget.

void QLineEdit::contextMenuEvent ( QContextMenuEvent e) [protected, virtual]

This event handler, for event e, can be reimplemented in a subclass to receive widget context menu events.

The default implementation calls e->ignore(), which rejects the context event. See the QContextMenuEvent documentation for more details.

Ver también:
event(), QContextMenuEvent

Reimplementado de QWidget.

virtual void QLineEdit::copy ( ) const [virtual, slot]
void QLineEdit::copy ( ) const [virtual, slot]

Copies the selected text to the clipboard, if there is any, and if echoMode() is Normal.

Ver también:
cut() paste()
QPopupMenu * QLineEdit::createPopupMenu ( ) [protected, virtual]

This function is called to create the popup menu which is shown when the user clicks on the line edit with the right mouse button. If you want to create a custom popup menu, reimplement this function and return the popup menu you create. The popup menu's ownership is transferred to the caller.

virtual QPopupMenu* QLineEdit::createPopupMenu ( ) [protected, virtual]
void QLineEdit::cursorBackward ( bool  mark,
int  steps = 1 
)

Moves the cursor back steps characters. If mark is TRUE each character moved over is added to the selection; if mark is FALSE the selection is cleared.

Ver también:
cursorForward()
void QLineEdit::cursorBackward ( bool  mark,
int  steps = 1 
)
void QLineEdit::cursorForward ( bool  mark,
int  steps = 1 
)

Moves the cursor forward steps characters. If mark is TRUE each character moved over is added to the selection; if mark is FALSE the selection is cleared.

Ver también:
cursorBackward()
void QLineEdit::cursorForward ( bool  mark,
int  steps = 1 
)
void QLineEdit::cursorLeft ( bool  mark,
int  steps = 1 
) [inline]
void QLineEdit::cursorLeft ( bool  mark,
int  steps = 1 
) [inline]

For compatibilty with older applications only. Use cursorBackward() instead.

Ver también:
cursorBackward()
int QLineEdit::cursorPosition ( ) const
int QLineEdit::cursorPosition ( ) const
void QLineEdit::cursorRight ( bool  mark,
int  steps = 1 
) [inline]
void QLineEdit::cursorRight ( bool  mark,
int  steps = 1 
) [inline]

Use cursorForward() instead.

Ver también:
cursorForward()
void QLineEdit::cursorWordBackward ( bool  mark)

Moves the cursor one word backward. If mark is TRUE, the word is also selected.

Ver también:
cursorWordForward()
void QLineEdit::cursorWordBackward ( bool  mark)
void QLineEdit::cursorWordForward ( bool  mark)

Moves the cursor one word forward. If mark is TRUE, the word is also selected.

Ver también:
cursorWordBackward()
void QLineEdit::cursorWordForward ( bool  mark)
virtual void QLineEdit::cut ( ) [virtual, slot]
void QLineEdit::cut ( ) [virtual, slot]

Copies the selected text to the clipboard and deletes it, if there is any, and if echoMode() is Normal.

If the current validator disallows deleting the selected text, cut() will copy without deleting.

Ver también:
copy() paste() setValidator()
void QLineEdit::del ( )

If no text is selected, deletes the character to the right of the text cursor. If any text is selected, the cursor is moved to the beginning of the selected text and the selected text is deleted.

Ver también:
backspace()
void QLineEdit::del ( )
virtual void QLineEdit::deselect ( ) [virtual, slot]
void QLineEdit::deselect ( ) [virtual, slot]

Deselects any selected text.

Ver también:
setSelection() selectAll()
QString QLineEdit::displayText ( ) const
QString QLineEdit::displayText ( ) const
bool QLineEdit::dragEnabled ( ) const
bool QLineEdit::dragEnabled ( ) const
void QLineEdit::dragEnterEvent ( QDragEnterEvent e) [protected, virtual]

Reimplementado de QWidget.

void QLineEdit::dragEnterEvent ( QDragEnterEvent ) [protected, virtual]

This event handler is called when a drag is in progress and the mouse enters this widget.

See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application.

Ver también:
QTextDrag, QImageDrag, QDragEnterEvent

Reimplementado de QWidget.

void QLineEdit::dragLeaveEvent ( QDragLeaveEvent e) [protected, virtual]

Reimplementado de QWidget.

void QLineEdit::dragLeaveEvent ( QDragLeaveEvent ) [protected, virtual]

This event handler is called when a drag is in progress and the mouse leaves this widget.

See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application.

Ver también:
QTextDrag, QImageDrag, QDragLeaveEvent

Reimplementado de QWidget.

void QLineEdit::dragMoveEvent ( QDragMoveEvent e) [protected, virtual]

Reimplementado de QWidget.

void QLineEdit::dragMoveEvent ( QDragMoveEvent ) [protected, virtual]

This event handler is called when a drag is in progress and the mouse enters this widget, and whenever it moves within the widget.

See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application.

Ver también:
QTextDrag, QImageDrag, QDragMoveEvent

Reimplementado de QWidget.

void QLineEdit::drawContents ( QPainter p) [protected, virtual]

Reimplementado de QFrame.

void QLineEdit::drawContents ( QPainter ) [protected, virtual]

Virtual function that draws the contents of the frame.

The QPainter is already open when you get it, and you must leave it open. Painter transformations are switched off on entry. If you transform the painter, remember to take the frame into account and reset transformation before returning.

This function is reimplemented by subclasses that draw something inside the frame. It should only draw inside contentsRect(). The default function does nothing.

Ver también:
contentsRect(), QPainter::setClipRect()

Reimplementado de QFrame.

void QLineEdit::dropEvent ( QDropEvent e) [protected, virtual]

Reimplementado de QWidget.

void QLineEdit::dropEvent ( QDropEvent ) [protected, virtual]

This event handler is called when the drag is dropped on this widget.

See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application.

Ver también:
QTextDrag, QImageDrag, QDropEvent

Reimplementado de QWidget.

EchoMode QLineEdit::echoMode ( ) const
EchoMode QLineEdit::echoMode ( ) const
bool QLineEdit::edited ( ) const
bool QLineEdit::edited ( ) const
void QLineEdit::end ( bool  mark)

Moves the text cursor to the end of the line unless it is already there. If mark is TRUE, text is selected towards the last position; otherwise, any selected text is unselected if the cursor is moved.

Ver también:
home()
void QLineEdit::end ( bool  mark)
bool QLineEdit::event ( QEvent e) [protected, virtual]

Reimplementado de QWidget.

bool QLineEdit::event ( QEvent e) [protected, virtual]

This is the main event handler; it handles event e. You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.

The main event handler first passes an event through all event filters that have been installed. If none of the filters intercept the event, it calls one of the specialized event handlers.

Key press and release events are treated differently from other events. event() checks for Tab and Shift+Tab and tries to move the focus appropriately. If there is no widget to move the focus to (or the key press is not Tab or Shift+Tab), event() calls keyPressEvent().

This function returns TRUE if it is able to pass the event over to someone (i.e. someone wanted the event); otherwise returns FALSE.

Ver también:
closeEvent(), focusInEvent(), focusOutEvent(), enterEvent(), keyPressEvent(), keyReleaseEvent(), leaveEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), moveEvent(), paintEvent(), resizeEvent(), QObject::event(), QObject::timerEvent()

Reimplementado de QWidget.

void QLineEdit::focusInEvent ( QFocusEvent ) [protected, virtual]

Reimplementado de QWidget.

Reimplementado en FLLineEdit.

void QLineEdit::focusInEvent ( QFocusEvent ) [protected, virtual]

This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget.

A widget normally must setFocusPolicy() to something other than NoFocus in order to receive focus events. (Note that the application programmer can call setFocus() on any widget, even those that do not normally accept focus.)

The default implementation updates the widget (except for toplevel widgets that do not specify a focusPolicy() ). It also calls setMicroFocusHint(), hinting any system-specific input tools about the focus of the user's attention.

Ver también:
focusOutEvent(), setFocusPolicy(), keyPressEvent(), keyReleaseEvent(), event(), QFocusEvent

Reimplementado de QWidget.

Reimplementado en FLLineEdit.

void QLineEdit::focusOutEvent ( QFocusEvent ) [protected, virtual]

Reimplementado de QWidget.

Reimplementado en FLLineEdit y QRenameEdit.

void QLineEdit::focusOutEvent ( QFocusEvent ) [protected, virtual]

This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) for the widget.

A widget normally must setFocusPolicy() to something other than NoFocus in order to receive focus events. (Note that the application programmer can call setFocus() on any widget, even those that do not normally accept focus.)

The default implementation updates the widget (except for toplevel widgets that do not specify a focusPolicy() ). It also calls setMicroFocusHint(), hinting any system-specific input tools about the focus of the user's attention.

Ver también:
focusInEvent(), setFocusPolicy(), keyPressEvent(), keyReleaseEvent(), event(), QFocusEvent

Reimplementado de QWidget.

Reimplementado en FLLineEdit y QRenameEdit.

bool QLineEdit::frame ( ) const
bool QLineEdit::frame ( ) const
bool QLineEdit::getSelection ( int ,
int  
)
bool QLineEdit::getSelection ( int start,
int end 
)
bool QLineEdit::hasAcceptableInput ( ) const
bool QLineEdit::hasAcceptableInput ( ) const
bool QLineEdit::hasMarkedText ( ) const [inline]
bool QLineEdit::hasMarkedText ( ) const [inline]
bool QLineEdit::hasSelectedText ( ) const
bool QLineEdit::hasSelectedText ( ) const
void QLineEdit::home ( bool  mark)

Moves the text cursor to the beginning of the line unless it is already there. If mark is TRUE, text is selected towards the first position; otherwise, any selected text is unselected if the cursor is moved.

Ver también:
end()
void QLineEdit::home ( bool  mark)
void QLineEdit::imComposeEvent ( QIMEvent e) [protected, virtual]

Reimplementado de QWidget.

void QLineEdit::imComposeEvent ( QIMEvent e) [protected, virtual]

This event handler, for event e, can be reimplemented in a subclass to receive Input Method composition events. This handler is called when the user has entered some text using an Input Method.

The default implementation calls e->ignore(), which rejects the Input Method event. See the QIMEvent documentation for more details.

Ver también:
event(), QIMEvent

Reimplementado de QWidget.

void QLineEdit::imEndEvent ( QIMEvent e) [protected, virtual]

Reimplementado de QWidget.

void QLineEdit::imEndEvent ( QIMEvent e) [protected, virtual]

This event handler, for event e, can be reimplemented in a subclass to receive Input Method composition events. This handler is called when the user has finished inputting text via an Input Method.

The default implementation calls e->ignore(), which rejects the Input Method event. See the QIMEvent documentation for more details.

Ver también:
event(), QIMEvent

Reimplementado de QWidget.

void QLineEdit::imStartEvent ( QIMEvent e) [protected, virtual]

Reimplementado de QWidget.

void QLineEdit::imStartEvent ( QIMEvent e) [protected, virtual]

This event handler, for event e, can be reimplemented in a subclass to receive Input Method composition events. This handler is called when the user begins entering text using an Input Method.

The default implementation calls e->ignore(), which rejects the Input Method event. See the QIMEvent documentation for more details.

Ver también:
event(), QIMEvent

Reimplementado de QWidget.

QString QLineEdit::inputMask ( ) const
QString QLineEdit::inputMask ( ) const
virtual void QLineEdit::insert ( const QString ) [virtual, slot]
void QLineEdit::insert ( const QString newText) [virtual, slot]

Deletes any selected text, inserts newText, and validates the result. If it is valid, it sets it as the new contents of the line edit.

bool QLineEdit::isModified ( ) const
bool QLineEdit::isModified ( ) const
bool QLineEdit::isReadOnly ( ) const
bool QLineEdit::isReadOnly ( ) const
bool QLineEdit::isRedoAvailable ( ) const
bool QLineEdit::isRedoAvailable ( ) const
bool QLineEdit::isUndoAvailable ( ) const
bool QLineEdit::isUndoAvailable ( ) const
void QLineEdit::keyPressEvent ( QKeyEvent e) [protected, virtual]

Converts key press event e into a line edit action.

If Return or Enter is pressed and the current text is valid (or can be made valid by the validator), the signal returnPressed() is emitted.

The default key bindings are listed in the detailed description.

Reimplementado de QWidget.

Reimplementado en QRenameEdit.

void QLineEdit::keyPressEvent ( QKeyEvent e) [protected, virtual]

This event handler, for event e, can be reimplemented in a subclass to receive key press events for the widget.

A widget must call setFocusPolicy() to accept focus initially and have focus in order to receive a key press event.

If you reimplement this handler, it is very important that you explicitly ignore the event if you do not understand it, so that the widget's parent can interpret it; otherwise, the event will be implicitly accepted. Although top-level widgets are able to choose whether to accept or ignore unknown events because they have no parent widgets that could otherwise handle them, it is good practice to explicitly ignore events to make widgets as reusable as possible.

The default implementation closes popup widgets if the user presses Esc. Otherwise the event is ignored.

Ver también:
keyReleaseEvent(), QKeyEvent::ignore(), setFocusPolicy(), focusInEvent(), focusOutEvent(), event(), QKeyEvent

Reimplementado de QWidget.

Reimplementado en QRenameEdit.

void QLineEdit::lostFocus ( ) [signal]
void QLineEdit::lostFocus ( ) [signal]

This signal is emitted when the line edit has lost focus.

Ver también:
hasFocus(), QWidget::focusInEvent(), QWidget::focusOutEvent()
QString QLineEdit::markedText ( ) const [inline]
QString QLineEdit::markedText ( ) const [inline]
int QLineEdit::maxLength ( ) const
int QLineEdit::maxLength ( ) const
QSize QLineEdit::minimumSizeHint ( ) const [virtual]

Returns a minimum size for the line edit.

The width returned is enough for at least one character.

Reimplementado de QWidget.

QSize QLineEdit::minimumSizeHint ( ) const [virtual]

Reimplementado de QWidget.

void QLineEdit::mouseDoubleClickEvent ( QMouseEvent e) [protected, virtual]

Reimplementado de QWidget.

void QLineEdit::mouseDoubleClickEvent ( QMouseEvent e) [protected, virtual]

This event handler, for event e, can be reimplemented in a subclass to receive mouse double click events for the widget.

The default implementation generates a normal mouse press event.

Note that the widgets gets a mousePressEvent() and a mouseReleaseEvent() before the mouseDoubleClickEvent().

Ver también:
mousePressEvent(), mouseReleaseEvent() mouseMoveEvent(), event(), QMouseEvent

Reimplementado de QWidget.

void QLineEdit::mouseMoveEvent ( QMouseEvent e) [protected, virtual]

Reimplementado de QWidget.

void QLineEdit::mouseMoveEvent ( QMouseEvent e) [protected, virtual]

This event handler, for event e, can be reimplemented in a subclass to receive mouse move events for the widget.

If mouse tracking is switched off, mouse move events only occur if a mouse button is pressed while the mouse is being moved. If mouse tracking is switched on, mouse move events occur even if no mouse button is pressed.

QMouseEvent::pos() reports the position of the mouse cursor, relative to this widget. For press and release events, the position is usually the same as the position of the last mouse move event, but it might be different if the user's hand shakes. This is a feature of the underlying window system, not Qt.

Ver también:
setMouseTracking(), mousePressEvent(), mouseReleaseEvent(), mouseDoubleClickEvent(), event(), QMouseEvent

Reimplementado de QWidget.

void QLineEdit::mousePressEvent ( QMouseEvent e) [protected, virtual]

Reimplementado de QWidget.

void QLineEdit::mousePressEvent ( QMouseEvent e) [protected, virtual]

This event handler, for event e, can be reimplemented in a subclass to receive mouse press events for the widget.

If you create new widgets in the mousePressEvent() the mouseReleaseEvent() may not end up where you expect, depending on the underlying window system (or X11 window manager), the widgets' location and maybe more.

The default implementation implements the closing of popup widgets when you click outside the window. For other widget types it does nothing.

Ver también:
mouseReleaseEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), event(), QMouseEvent

Reimplementado de QWidget.

void QLineEdit::mouseReleaseEvent ( QMouseEvent e) [protected, virtual]

Reimplementado de QWidget.

void QLineEdit::mouseReleaseEvent ( QMouseEvent e) [protected, virtual]

This event handler, for event e, can be reimplemented in a subclass to receive mouse release events for the widget.

Ver también:
mouseReleaseEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), event(), QMouseEvent

Reimplementado de QWidget.

QChar QLineEdit::passwordChar ( ) const
QChar QLineEdit::passwordChar ( ) const
void QLineEdit::paste ( ) [virtual, slot]

Inserts the clipboard's text at the cursor position, deleting any selected text, providing the line edit is not read-only.

If the end result would not be acceptable to the current validator, nothing happens.

Ver también:
copy() cut()
virtual void QLineEdit::paste ( ) [virtual, slot]
virtual void QLineEdit::redo ( ) [virtual, slot]
void QLineEdit::redo ( ) [virtual, slot]

Redoes the last operation if redo is available.

void QLineEdit::repaintArea ( int  ,
int   
) [inline, protected]
void QLineEdit::repaintArea ( int  from,
int  to 
) [inline, protected]

Repaints all characters from from to to. If cursorPos is between from and to, ensures that cursorPos is visible.

void QLineEdit::resizeEvent ( QResizeEvent e) [protected, virtual]

Processes the resize event e.

Adjusts the frame rectangle for the resized widget. The frame rectangle is elastic, and the surrounding area is static.

The resulting frame rectangle may be null or invalid. You can use setMinimumSize() to avoid those possibilities.

Nothing is done if the frame rectangle is a null rectangle already.

Reimplementado de QFrame.

void QLineEdit::resizeEvent ( QResizeEvent e) [protected, virtual]

Reimplementado de QFrame.

void QLineEdit::returnPressed ( ) [signal]
void QLineEdit::returnPressed ( ) [signal]

This signal is emitted when the Return or Enter key is pressed. Note that if there is a validator() or inputMask() set on the line edit, the returnPressed() signal will only be emitted if the input follows the inputMask() and the validator() returns Acceptable.

void QLineEdit::selectAll ( ) [virtual, slot]

Selects all the text (i.e. highlights it) and moves the cursor to the end. This is useful when a default value has been inserted because if the user types before clicking on the widget, the selected text will be deleted.

Ver también:
setSelection() deselect()
virtual void QLineEdit::selectAll ( ) [virtual, slot]
QString QLineEdit::selectedText ( ) const
QString QLineEdit::selectedText ( ) const
void QLineEdit::selectionChanged ( ) [signal]
void QLineEdit::selectionChanged ( ) [signal]

This signal is emitted whenever the selection changes.

Ver también:
hasSelectedText(), selectedText()
int QLineEdit::selectionStart ( ) const

selectionStart() returns the index of the first selected character in the line edit or -1 if no text is selected.

Ver también:
selectedText()
int QLineEdit::selectionStart ( ) const
void QLineEdit::setAlignment ( int  flag) [virtual, slot]
virtual void QLineEdit::setAlignment ( int  flag) [virtual, slot]
virtual void QLineEdit::setCursorPosition ( int  ) [virtual, slot]
void QLineEdit::setCursorPosition ( int  pos) [virtual, slot]
void QLineEdit::setDragEnabled ( bool  b) [virtual, slot]
virtual void QLineEdit::setDragEnabled ( bool  b) [virtual, slot]
void QLineEdit::setEchoMode ( EchoMode  mode) [virtual, slot]
virtual void QLineEdit::setEchoMode ( EchoMode  ) [virtual, slot]
void QLineEdit::setEdited ( bool  )
void QLineEdit::setEdited ( bool  on)
virtual void QLineEdit::setFont ( const QFont ) [virtual, slot]

Reimplementado de QWidget.

void QLineEdit::setFont ( const QFont f) [virtual, slot]

Reimplementado de QWidget.

void QLineEdit::setFrame ( bool  enable) [virtual, slot]
virtual void QLineEdit::setFrame ( bool  ) [virtual, slot]
void QLineEdit::setInputMask ( const QString inputMask)
void QLineEdit::setInputMask ( const QString inputMask)
void QLineEdit::setMaxLength ( int  maxLength) [virtual, slot]
virtual void QLineEdit::setMaxLength ( int  ) [virtual, slot]
void QLineEdit::setPalette ( const QPalette p) [virtual, slot]

Reimplementado de QWidget.

virtual void QLineEdit::setPalette ( const QPalette ) [virtual, slot]

Reimplementado de QWidget.

void QLineEdit::setPasswordChar ( QChar  c)
void QLineEdit::setPasswordChar ( QChar  c)
void QLineEdit::setReadOnly ( bool  enable) [virtual, slot]
virtual void QLineEdit::setReadOnly ( bool  ) [virtual, slot]
virtual void QLineEdit::setSelection ( int  ,
int   
) [virtual, slot]
void QLineEdit::setSelection ( int  start,
int  length 
) [virtual, slot]

Selects text from position start and for length characters.

Note that this function sets the cursor's position to the end of the selection regardless of its current position.

Ver también:
deselect() selectAll() getSelection() cursorForward() cursorBackward()
virtual void QLineEdit::setText ( const QString ) [virtual, slot]

Reimplementado en FLLineEdit.

void QLineEdit::setText ( const QString text) [virtual, slot]

Reimplementado en FLLineEdit.

void QLineEdit::setValidator ( const QValidator v) [virtual, slot]

Sets this line edit to only accept input that the validator, v, will accept. This allows you to place any arbitrary constraints on the text which may be entered.

If v == 0, setValidator() removes the current input validator. The initial setting is to have no input validator (i.e. any input is accepted up to maxLength()).

Ver también:
validator() QIntValidator QDoubleValidator QRegExpValidator
virtual void QLineEdit::setValidator ( const QValidator ) [virtual, slot]
QSize QLineEdit::sizeHint ( ) const [virtual]

Returns a recommended size for the widget.

The width returned, in pixels, is usually enough for about 15 to 20 characters.

Reimplementado de QFrame.

Reimplementado en QColNumLineEdit.

QSize QLineEdit::sizeHint ( ) const [virtual]

Reimplementado de QFrame.

Reimplementado en QColNumLineEdit.

QString QLineEdit::text ( ) const

Reimplementado en FLLineEdit.

QString QLineEdit::text ( ) const

Reimplementado en FLLineEdit.

void QLineEdit::textChanged ( const QString t0) [signal]

This signal is emitted whenever the text changes. The argument is the new text.

void QLineEdit::textChanged ( const QString ) [signal]
void QLineEdit::undo ( ) [virtual, slot]

Undoes the last operation if undo is available. Deselects any current selection, and updates the selection start to the current cursor position.

virtual void QLineEdit::undo ( ) [virtual, slot]
bool QLineEdit::validateAndSet ( const QString newText,
int  newPos,
int  newMarkAnchor,
int  newMarkDrag 
)
bool QLineEdit::validateAndSet ( const QString ,
int  ,
int  ,
int   
)
const QValidator* QLineEdit::validator ( ) const
const QValidator * QLineEdit::validator ( ) const

Returns a pointer to the current input validator, or 0 if no validator has been set.

Ver también:
setValidator()
void QLineEdit::windowActivationChange ( bool  b) [protected, virtual]

Reimplementado de QWidget.

void QLineEdit::windowActivationChange ( bool  oldActive) [protected, virtual]

This virtual function is called for a widget when its window is activated or deactivated by the window system. oldActive is the previous state; you can get the new setting from isActiveWindow().

Reimplement this function if your widget needs to know when its window becomes activated or deactivated.

The default implementation updates the visible part of the widget if the inactive and the active colorgroup are different for colors other than the highlight and link colors.

Ver también:
setActiveWindow(), isActiveWindow(), update(), palette()

Reimplementado de QWidget.


Documentación de las funciones relacionadas y clases amigas

QLineEditPrivate [friend]

Documentación de propiedades

bool QLineEdit::acceptableInput [read]

whether the input satisfies the inputMask and the validator.

Ver también:
setInputMask(), setValidator()
Alignment QLineEdit::alignment [read, write]

the alignment of the line edit

Possible Values are Qt::AlignAuto, Qt::AlignLeft, Qt::AlignRight and Qt::AlignHCenter.

Attempting to set the alignment to an illegal flag combination does nothing.

Ver también:
Qt::AlignmentFlags
int QLineEdit::cursorPosition [read, write]

the current cursor position for this line edit

Setting the cursor position causes a repaint when appropriate.

QString QLineEdit::displayText [read]

the displayed text

If EchoMode is Normal this returns the same as text(); if EchoMode is Password it returns a string of asterisks text().length() characters long, e.g. "******"; if EchoMode is NoEcho returns an empty string, "".

Ver también:
setEchoMode() text() EchoMode
bool QLineEdit::dragEnabled [read, write]

whether the lineedit starts a drag if the user presses and moves the mouse on some selected text

EchoMode QLineEdit::echoMode [read, write]

the line edit's echo mode

The initial setting is Normal, but QLineEdit also supports NoEcho and Password modes.

The widget's display and the ability to copy or drag the text is affected by this setting.

Ver también:
EchoMode displayText()
bool QLineEdit::edited [read, write]

whether the line edit has been edited. Use modified instead.

bool QLineEdit::frame [read, write]

whether the line edit draws itself with a frame

If enabled (the default) the line edit draws itself inside a two-pixel frame, otherwise the line edit draws itself without any frame.

bool QLineEdit::hasMarkedText [read]

whether part of the text has been selected by the user. Use hasSelectedText instead.

bool QLineEdit::hasSelectedText [read]

whether there is any text selected

hasSelectedText() returns TRUE if some or all of the text has been selected by the user; otherwise returns FALSE.

Ver también:
selectedText()
QString QLineEdit::inputMask [read, write]

The validation input mask.

If no mask is set, inputMask() returns QString::null.

Sets the QLineEdit's validation mask. Validators can be used instead of, or in conjunction with masks; see setValidator().

Unset the mask and return to normal QLineEdit operation by passing an empty string ("") or just calling setInputMask() with no arguments.

The mask format understands these mask characters: Character Meaning A ASCII alphabetic character required. A-Z, a-z. a ASCII alphabetic character permitted but not required. N ASCII alphanumeric character required. A-Z, a-z, 0-9. n ASCII alphanumeric character permitted but not required. X Any character required. x Any character permitted but not required. 9 ASCII digit required. 0-9. 0 ASCII digit permitted but not required. D ASCII digit required. 1-9. d ASCII digit permitted but not required (1-9). # ASCII digit or plus/minus sign permitted but not required. > All following alphabetic characters are uppercased. < All following alphabetic characters are lowercased. ! Switch off case conversion. \ Use \ to escape the special characters listed above to use them as separators.

The mask consists of a string of mask characters and separators, optionally followed by a semi-colon and the character used for blanks: the blank characters are always removed from the text after editing. The default blank character is space.

Examples: Mask Notes 000.000.000.000;_ IP address; blanks are {_}. 0000-00-00 ISO Date; blanks are space >AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;# License number; blanks are - and all (alphabetic) characters are converted to uppercase.

To get range control (e.g. for an IP address) use masks together with validators.

Ver también:
maxLength
QString QLineEdit::markedText [read]

the text selected by the user. Use selectedText instead.

int QLineEdit::maxLength [read, write]

the maximum permitted length of the text

If the text is too long, it is truncated at the limit.

If truncation occurs any selected text will be unselected, the cursor position is set to 0 and the first part of the string is shown.

If the line edit has an input mask, the mask defines the maximum string length.

Ver también:
inputMask
bool QLineEdit::modified [read]

whether the line edit's contents has been modified by the user

The modified flag is never read by QLineEdit; it has a default value of FALSE and is changed to TRUE whenever the user changes the line edit's contents.

This is useful for things that need to provide a default value but do not start out knowing what the default should be (perhaps it depends on other fields on the form). Start the line edit without the best default, and when the default is known, if modified() returns FALSE (the user hasn't entered any text), insert the default value.

Calling clearModified() or setText() resets the modified flag to FALSE.

bool QLineEdit::readOnly [read, write]

whether the line edit is read only.

In read-only mode, the user can still copy the text to the clipboard or drag-and-drop the text (if echoMode() is Normal), but cannot edit it.

QLineEdit does not show a cursor in read-only mode.

Ver también:
setEnabled()
bool QLineEdit::redoAvailable [read]

whether redo is available

QString QLineEdit::selectedText [read]

the selected text

If there is no selected text this property's value is QString::null.

Ver también:
hasSelectedText()
QString QLineEdit::text [read, write]

the line edit's text

Note that setting this property clears the selection, clears the undo/redo history, moves the cursor to the end of the line and resets the modified property to FALSE. The text is not validated when inserted with setText().

The text is truncated to maxLength() length.

Ver también:
insert()
bool QLineEdit::undoAvailable [read]

whether undo is available


La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'