Home · All Classes · Grouped Classes · Annotated · Functions

QLineEditSoftKeyLabelHelper Class Reference

The QLineEditSoftKeyLabelHelper class is a handler for the softkeys for the QLineEdit class. More...

    #include <QLineEditSoftKeyLabelHelper>

Inherits QAbstractSoftKeyLabelHelper.

Public Functions

Public Slots

Protected Functions

Additional Inherited Members


Detailed Description

The QLineEditSoftKeyLabelHelper class is a handler for the softkeys for the QLineEdit class.

The QLineEditSoftKeyLabelHelper is installed on the QLineEdit class by Qtopia, and will therefor act on all QLineEdits, as well as all classes derived from QLineEdit, unless those derived classes have their own SoftKeyHelper.

See also QAbstractSoftKeyLabelHelper.


Member Function Documentation

QLineEditSoftKeyLabelHelper::QLineEditSoftKeyLabelHelper ( QString className = "QLineEdit" )

Constructs a QLineEditSoftKeyLabelHelper for all QWidgets that inherit the class className, or derive from it. Generally this will already have been done automatically by the server.

QLineEditSoftKeyLabelHelper::QLineEditSoftKeyLabelHelper ( QLineEdit * l )

Constructs a QLineEditSoftKeyLabelHelper for QLineEdit l

QLineEditSoftKeyLabelHelper::~QLineEditSoftKeyLabelHelper ()

Destroys this QLineEditSoftKeyLabelHelper and cleans up.

void QLineEditSoftKeyLabelHelper::currentWidgetChangeNotification ( QWidget * newWidget, QWidget * oldWidget )   [virtual protected]

This function responds to changing widgets, and is specific to the "class" mode. A QLineEditSoftKeyLabelHelper that is instantiated on a specific widget should never recieve this signal.

In response to changing widgets, the Softkey Helper only takes note of the new widgets and resets it's internal state, specifically clearing any preedit text it has been tracking.

If newWidget is non-null, it is set as the current widget for this helper.

oldWidget is ignored.

Reimplemented from QAbstractSoftKeyLabelHelper.

See also enterEditFocus() and leaveEditFocus().

void QLineEditSoftKeyLabelHelper::cursorPositionChanged ( int old, int current )   [virtual slot]

Responds to cursor movements to ensure that the softkeys are always relevant. This is necessary because moving to or from the beginning of the lineedit should supress or activate the QSoftMenuBar::BackSpace label respectively.

old and current are ignored by QLineEditSoftKeyLabelHelper.

bool QLineEditSoftKeyLabelHelper::enterEditFocus ( QWidget * widget )   [virtual]

This function responds to the QLineEdit gaining edit focus. It sets the softkey labels depending on the content of the QLineEdit. It also connects signals for QLineEdit::textChanged() and QLineEdit::cursorPosition(), and returns true if this is successful. If widget is not a valid QLineEdit then the connections are not made, and this function returns false.

Reimplemented from QAbstractSoftKeyLabelHelper.

See also updateAllLabels(), QObject::connect(), QLineEdit::textChanged(), and QLineEdit::cursorPosition().

bool QLineEditSoftKeyLabelHelper::eventFilter ( QObject * watched, QEvent * event )   [virtual protected]

This eventFilter is to keep track of preedit text for the QObject watched. If watched is not a valid QWidget, and the QLineEditSoftKeyLabelHelper uses its own currently watched QWidget instead. If it cannot find a valid QWidget, the QLineEditSoftKeyLabelHelper aborts and returns false.

If event is a preedit event, the QLineEditSoftKeyLabelHelper keeps track of its contents to be able so that the helper can know whether or not the preedit text is empty.

It never consumes any events, so it always returns false.

Reimplemented from QObject.

See also QObject::installEventFilter(), QInputMethodEvent, and QWSEvent::IMEvent.

bool QLineEditSoftKeyLabelHelper::focusIn ( QWidget * widget )   [virtual]

This function responds to the QLineEdit gaining focus. It updates all labels, and installs an event filter on widget to recieve input method events.

Reimplemented from QAbstractSoftKeyLabelHelper.

See also enterEditFocus(), updateAllLabels(), and QObject::installEventFilter().

bool QLineEditSoftKeyLabelHelper::focusOut ( QWidget * widget )   [virtual]

This function responds to the QLineEdit losing focus completely. It disconnects the various signals from widget, and removes the eventFilter.

Reimplemented from QAbstractSoftKeyLabelHelper.

See also focusIn(), leaveEditFocus(), QObject::disconnect(), and QObject::removeEventFilter().

bool QLineEditSoftKeyLabelHelper::leaveEditFocus ( QWidget * widget )   [virtual]

This function responds to the helper's QLineEdit losing edit focus. It updates the Softkey labels and disconnects the QLineEdit::textChanged() and QLineEdit::cursorPositionChanged() signals from widget.

Reimplemented from QAbstractSoftKeyLabelHelper.

See also focusOut(), enterEditFocus(), QObject::disconnect(), QLineEdit::textChanged(), and QLineEdit::cursorPositionChanged().

void QLineEditSoftKeyLabelHelper::textChanged ( QString newText )   [virtual slot]

The function responds to changes in the text of the current target QLineEdit by calling updateAllLabels(). newText is not currently used, as information about the text content is available as needed.

See also updateAllLabels().

void QLineEditSoftKeyLabelHelper::updateAllLabels ( QWidget * widget = 0 )   [virtual slot]

This function polls the given widget and updates the softkey labels accordingly. The behaviour of the softkeys relative to the QLineEdit with focus is as follows:

Focus StateText contentSelect ButtonBack Button
Navigation FocusAnyQSoftMenuBar::EditQSoftMenuBar::Back
Edit FocusEmptyQSoftMenuBar::EndEditQSoftMenuBar::RevertEdit
Edit FocusText or Preedit TextQSoftMenuBar::EndEditQSoftMenuBar::BackSpace
Edit FocusText or Preedit Text and cursor at beginning of lineQSoftMenuBar::EndEditQSoftMenuBar::NoLabel

If there is text or preedit text to the left of the cursor, the back button acts like as a backspace key to delete that text. When the cursor reaches the left edge of the QLineEdit, its behaviour depends on the contents of the QLineEdit - if it's empty, the back button becomes QSoftMenuBar::RevertEdit, and if there is text to the right of the cursor it becomes blank. Both of these behaviours are to prevent accidental loss of data.

At all times the enter button toggles edit focus. when in navigation focus the enter button enters edit focus. When in edit focus, the enter key leaves edit focus, and enters navigation focus, saving the contents of the QLineEdit.

The changing of the labels themselves is handled through the ContextKeyManager. This should not normally be relevant for the use of this class.

Reimplemented from QAbstractSoftKeyLabelHelper.

See also enterEditFocus(), leaveEditFocus(), QSoftMenuBar::StandardLabel, and QLineEdit.


Copyright © 2007 Trolltech Trademarks
Qtopia 4.3.0