Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

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

The Widget class provides an abstract base class for all test widgets. More...

    #include <QtUiTest>

This class is under development and is subject to change.

Public Functions

Signals


Detailed Description

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.


Member Function Documentation

const QObjectList & Widget::children () const   [pure virtual]

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().

QRegion Widget::childrenVisibleRegion () const   [virtual]

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().

bool Widget::ensureVisiblePoint ( const QPoint & point )

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().

bool Widget::ensureVisibleRegion ( const QRegion & region )   [pure virtual]

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().

void Widget::focusOutEvent ()   [virtual]

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().

const QRect & Widget::geometry () const   [pure virtual]

Returns the geometry of this widget in parent coordinates.

See also QWidget::geometry().

void Widget::gotFocus ()   [signal]

This signal is emitted when this widget gains focus by any means.

See also QApplication::focusChanged().

bool Widget::hasEditFocus () const   [pure virtual]

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().

bool Widget::hasFocus () const   [pure virtual]

Returns true if this widget currently has keyboard focus.

See also QWidget::hasFocus().

bool Widget::inherits ( QtUiTest::WidgetType type ) const   [virtual]

Returns true if this widget is of the given type.

The base implementation always returns false.

bool Widget::isVisible () const   [pure virtual]

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().

QPoint Widget::mapFromGlobal ( const QPoint & pos ) const   [pure virtual]

Maps pos from global screen coordinates to widget coordinates and returns the result.

See also QWidget::mapFromGlobal().

QPoint Widget::mapToGlobal ( const QPoint & pos ) const   [pure virtual]

Maps pos from widget coordinates to global screen coordinates and returns the result.

See also QWidget::mapToGlobal().

QObject * Widget::parent () const   [pure virtual]

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().

QRect Widget::rect () const   [virtual]

Returns the bounding rect of this widget in widget coordinates.

The base implementation returns geometry(), transformed to widget coordinates.

See also QWidget::rect().

bool Widget::setEditFocus ( bool enable )   [pure virtual]

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().

bool Widget::setFocus ()   [virtual]

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().

QRegion Widget::visibleRegion () const   [pure virtual]

Returns the currently on-screen, unobscured region of this widget, in widget coordinates.

See also QWidget::visibleRegion().

Qt::WindowFlags Widget::windowFlags () const   [virtual]

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.

QString Widget::windowTitle () const   [virtual]

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().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Comment créer une fenêtre À propos

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtextended4.4
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web