Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

InputWidget Class Reference
(QtUiTest::InputWidget)
[QtUiTestModule]

The InputWidget class provides an abstract base class for all test widgets which allow the user to input text. More...

This class is under development and is subject to change.

Public Functions

Signals


Detailed Description

The InputWidget class provides an abstract base class for all test widgets which allow the user to input text.

QtUiTest::InputWidget encapsulates a widget in which a user may enter and remove text. This is closely related to QtUiTest::TextWidget, which provides an interface for retrieving text from a widget. Any widgets which contain user-editable text will typically implement both QtUiTest::InputWidget and QtUiTest::TextWidget.

Examples of widgets suitable for this interface include QLineEdit and QTextEdit.

See also QtUiTest::TextWidget.


Member Function Documentation

bool InputWidget::canEnter ( const QVariant & item ) const   [pure virtual]

Returns true if item can possibly be entered into this widget.

For example, for a QLineEdit, QLineEdit::validator() would be used to ensure that item.toString() constitutes valid input for this line edit.

bool InputWidget::enter ( const QVariant & item, bool noCommit )   [pure virtual]

Simulates the user input necessary to enter item into this widget. Returns true on success.

item can potentially be any type representable in a QVariant. Most widgets will only be interested in text, in which case item.toString() can be called to retrieve a string. Examples of widgets which may handle types other than text are QDateEdit and QTimeEdit, which may handle dates and times.

If noCommit is true, no attempt is made to commit the input (for example, by clicking the Select key). Normally this value will be false, which will result in the input being committed. This value is not applicable to all widget types.

If canEnter() returns true and this function returns false, an error has occurred and this widget is left in an undefined state.

void InputWidget::entered ( const QVariant & item )   [signal]

This signal is emitted when item is entered into the widget by the user.


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3