Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
The Widget class provides an abstract base class for all test widgets. More...
This class is under development and is subject to change.
The Widget class provides an abstract base class for all test widgets.
QtUiTest::Widget contains functionality which maps closely to QWidget. It encapsulates important information and functionality related to two-dimensional GUI elements.
All Qt Extended test widgets should implement the QtUiTest::Widget interface, using multiple inheritance to implement other QtUiTest interfaces where suitable.
Returns all children of this widget.
The returned objects may be actual QWidget instances, or may be wrapping test widgets. Therefore, the only safe way to use the returned objects are to cast them to the desired QtUiTest interface using qtuitest_cast.
Reimplementing this function allows widgets which are conceptually widgets but are not QObject subclasses to be wrapped. This can be achieved by returning a list of test widgets which do not necessarily have underlying QWidget instances.
See also QObject::children() and parent().
Returns the currently on-screen, unobscured region of all child widgets of this widget, in widget coordinates. This does not include the visible region of this widget.
The base implementation calculates the visible region by calling visibleRegion() and childrenVisibleRegion() on all children().
See also QWidget::visibleRegion(), children(), and visibleRegion().
Simulate whatever user input is necessary to ensure that point (in local coordinates) is on-screen and unobscured.
This convenience function calls ensureVisibleRegion() with a region containing only point.
Returns true if point was successfully made visible.
See also visibleRegion() and ensureVisibleRegion().
Simulate whatever user input is necessary to ensure that region (in local coordinates) is on-screen and unobscured.
Returns true if region was successfully made visible.
See also visibleRegion().
This function is called when this widget is about to lose keyboard focus. The base implementation does nothing.
This function should be reimplemented to put this widget in a state where subsequent up/down key clicks will result in non-destructive navigation between widgets.
For example, if this function is called on a combo box which currently has a list popped up, it should dismiss the list so that subsequent key clicks will navigate between widgets rather than navigating within the list.
void MyComboBox::focusOutEvent() { // Assuming q is a QComboBox... // If the list is currently popped up... if (q->view()->isVisible()) { // Press the Select key to commit the currently highlighted // item and ensure we are ready to navigate by keys. QtUiTest::keyClick(Qt::Key_Select); } }
See also QWidget::focusOutEvent(), setFocus(), and hasFocus().
Returns the geometry of this widget in parent coordinates.
See also QWidget::geometry().
This signal is emitted when this widget gains focus by any means.
See also QApplication::focusChanged().
Returns true if this widget currently has edit focus.
The concept of edit focus only exists in Qt Embedded. This function must be implemented on Qt Embedded. On other platforms, the base implementation will return the same as hasFocus().
See also QWidget::hasEditFocus() and setEditFocus().
Returns true if this widget currently has keyboard focus.
See also QWidget::hasFocus().
Returns true if this widget is of the given type.
The base implementation always returns false.
Returns true if this widget is currently visible.
In this context, "visible" has the same meaning as in QWidget::isVisible(). Therefore, this function returning true is not a guarantee that this widget is currently on screen and unobscured. To test this, visibleRegion() can be used.
See also QWidget::isVisible() and visibleRegion().
Maps pos from global screen coordinates to widget coordinates and returns the result.
See also QWidget::mapFromGlobal().
Maps pos from widget coordinates to global screen coordinates and returns the result.
See also QWidget::mapToGlobal().
Returns the parent of this widget, or 0 if this widget has no parent.
The returned object may be an actual QWidget, or may be a wrapping test widget. Therefore, the only safe way to use the returned value of this function is to cast it to the desired QtUiTest interface using qtuitest_cast.
See also QObject::parent(), QWidget::parentWidget(), and children().
Returns the bounding rect of this widget in widget coordinates.
The base implementation returns geometry(), transformed to widget coordinates.
See also QWidget::rect().
Simulate the user input necessary to enable or disable edit focus for this widget. Enabling edit focus will implicitly call setFocus() when necessary.
The concept of edit focus only exists in Qt Embedded. This function must be implemented when using Qt Embedded. On other platforms, this function will behave the same as setFocus() when enable is true, and will have no effect when enable is false.
Returns true if edit focus was successfully enabled or disabled for this widget, false otherwise.
See also QWidget::setEditFocus() and hasEditFocus().
Simulate the user input necessary to move keyboard focus to this widget.
The base implementation uses the result of hasFocus() to determine if the widget currently has focus. If in keypad mode, a sequence of Up or Down key presses will be used to move focus until this widget has focus. If in mouse mode, the center of this widget will be clicked once.
Due to the way this function works in keypad mode, it is very important that focusOutEvent() is correctly implemented for all widgets to dismiss any "grab" effects on keyboard focus.
When reimplementing this function, it is necessary to call focusOutEvent() on any widget before taking any action which could cause that widget to lose focus.
Returns true if focus was successfully given to this widget, false otherwise.
See also hasFocus(), QWidget::setFocus(), and focusOutEvent().
Returns the currently on-screen, unobscured region of this widget, in widget coordinates.
See also QWidget::visibleRegion().
Returns the flags set on this widget.
The default implementation returns 0, which is equivalent to a plain Qt::Widget with no special flags set.
Returns the window title (caption).
The returned string will typically be empty for all widgets other than top-level widgets.
The default implementation returns an empty string.
See also QWidget::windowTitle().
Copyright © 2009 Trolltech | Trademarks | Qt Extended 4.4.3 |