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

QWaitWidget Class Reference
[QtBaseModule]

The QWaitWidget class provides an informative idle screen for a slow operation. More...

    #include <QWaitWidget>

Inherits QDialog.

Properties

Public Functions

Public Slots

Signals

Additional Inherited Members


Detailed Description

The QWaitWidget class provides an informative idle screen for a slow operation.

A wait widget is used to give the user an indication that an operation is going to take some time, and to demonstrate that the application has not frozen. It can also give the user an opportunity to abort the operation when setCancelEnabled() is set to be true.

For example, construct a QWaitWidget to popup over parent.

    QWaitWidget *waitWidget = new QWaitWidget(this);
    waitWidget->show();
    // do time consuming operations
    delete waitWidget;

Use setText() and setCancelEnabled() to give more feedback and control to the user. For example,

    QWaitWidget *waitWidget = new QWaitWidget(this);
    waitWidget->setCancelEnabled( true );
    waitWidget->setText( "Searching..." );
    waitWidget->show();

    QDir dir = QDir::current();
    QFileInfoList list = dir.entryInfoList();
    int totalSize = 0;

    for ( int i = 0; i < dir.count(); i++ ) {
        totalSize += list.at( i ).size();
       waitWidget->setText( QString( "Size: %1 bytes" ).arg( QString::number(totalSize) ) );
    }
    waitWidget->hide();

The wait widget, in this example, emits a signal cancelled() when the user presses the Cancel button.

"A wait widget with text"


Property Documentation

cancelEnabled : bool

This property holds indicates whether the Cancel button appears on the context menu.

Access functions:

wasCancelled : const bool

This property holds indicates whether the widget was cancelled by the user when it was last shown.

Access functions:


Member Function Documentation

QWaitWidget::QWaitWidget ( QWidget * parent = 0 )

Constructs an QWaitWidget object with the given parent.

QWaitWidget::~QWaitWidget ()

Destroys a QWaitWidget

void QWaitWidget::cancelled ()   [signal]

This signal is emitted whenever the wait widget dialog is cancelled by user.

void QWaitWidget::hide ()   [slot]

Hides the widget and its child widgets.

void QWaitWidget::setColor ( const QColor & col )   [slot]

Blends the image with color col.

void QWaitWidget::setExpiryTime ( int msec )   [slot]

Hides the widget after msec.

void QWaitWidget::setText ( const QString & label )   [slot]

Sets the informative text label for this wait widget.

void QWaitWidget::show ()   [slot]

Shows the widget and its child widgets. The widget is shown maximized.


Copyright © 2009 Nokia Trademarks
Qt Extended 4.4.3