Home · All Classes · Grouped Classes · Annotated · Functions

QWaitWidget Class Reference

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

    #include <QWaitWidget>

Inherits QDialog.

Public Functions

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"


Member Function Documentation

QWaitWidget::QWaitWidget ( QWidget * parent )

Constructs an QWaitWidget object with the given parent.

void QWaitWidget::cancelled ()   [signal]

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

void QWaitWidget::hide ()

Hides the widget and its child widgets.

void QWaitWidget::setCancelEnabled ( bool enabled )

Sets whether the Cancel button appears on the context menu to enabled. When the Cancel button is presed the signal cancelled() is emitted.

See also cancelled().

void QWaitWidget::setColor ( const QColor & col )

Blends the image with color col.

void QWaitWidget::setExpiryTime ( int msec )

Hides the widget after msec.

void QWaitWidget::setText ( const QString & label )

Sets the informative text label for this wait widget.

void QWaitWidget::show ()

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

bool QWaitWidget::wasCancelled () const

Returns whether the widget was cancelled by the user when it was last shown.


Copyright © 2007 Trolltech Trademarks
Qtopia 4.2.5