QLineEdit Class Reference


The QLineEdit widget is a simple line editor for inputting text. (details) (complete member list)

#include <qlined.h>

Inherits QWidget.

Public Members

Public Slots

Signals

Protected Members


Detailed Description

The QLineEdit widget is a simple line editor for inputting text.

The default key bindings are described in keyPressEvent(); they cannot be customized except by inheriting the class.

To do:


Member Function Documentation

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

Constructs a line editor with an empty edit buffer.

The cursor position is set to the start of the line, the maximum buffer size to 32767 characters, and the buffer contents to "".

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

QLineEdit::~QLineEdit ()

Destroys the line editor.

void QLineEdit::backspace ()

Deletes the character on the left side of the text cursor and moves the cursor one position to the left.

See also: del().

void QLineEdit::cursorLeft ()

Moves the cursor leftwards one character.

See also: cursorRight().

void QLineEdit::cursorRight ()

Moves the cursor rightwards one character.

See also: cursorLeft().

void QLineEdit::del ()

Deletes the character on the right side of the text cursor.

See also: backspace().

void QLineEdit::end ()

Moves the text cursor to the right end of the line.

See also: home().

void QLineEdit::focusInEvent (QFocusEvent *)

.

void QLineEdit::focusOutEvent (QFocusEvent *)

.

void QLineEdit::home ()

Moves the text cursor to the left end of the line.

See also: end().

void QLineEdit::keyPressEvent (QKeyEvent *e)

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

If return or enter is pressed, the signal returnPressed will be emitted.

Here are the default key bindings:

Left Arrow
Move the cursor one character leftwards
Right Arrow
Move the cursor one character rightwards
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
Control-A
Move the cursor to the beginning of the line
Control-B
Move the cursor one character leftwards
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

Comments solicited

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

To do:

int QLineEdit::maxLength () const

Returns the current maximum length of the text in the editor.

See also: setMaxLength().

void QLineEdit::mousePressEvent (QMouseEvent *e)

.

void QLineEdit::paint (bool frame)

.

void QLineEdit::paintText (QPainter *p, const QSize &sz, bool frame = FALSE)

.

void QLineEdit::pixmapPaint ()

.

void QLineEdit::setMaxLength (int m)

Set the maximum length of the text in the editor. If the text is currently too long, it is chopped off at the limit.

See also: maxLength().

void QLineEdit::setText (const char *text)

Sets the line editor text to text.

If necessary the text is truncated to fit maxLength().

See also: text().

char * QLineEdit::text () const

Returns a pointer to the text currently in the line.

If you need to store the text, you should make a copy of it. This can conveniently be done with a QString object:

  QString s = lineEd->text();  // makes a copy and stores it in s

See also: setText().

void QLineEdit::textChanged (char *)

This signal is emitted every time the text has changed. The argument is the new text.

void QLineEdit::timerEvent (QTimerEvent *)

.


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

It was generated from the following files:


Generated at 16:17, 1995/06/30 by the webmaster at Troll Tech