Archived:Create progress dialog using QProgressDialog
The QProgressDialog class provides feedback on the progress of a slow operation. A progress dialog is used to give the user an indication of how long an operation is going to take, and to demonstrate that the application has not frozen. Although QProgressDialog is similar to QProgressBar, it give the user an opportunity to abort the operation, while QProgressBar will just show progress. Here you can check How to use QProgressBar.
This snippet can be self-signed. As it not use any API which require signing.
- Download Qt for S60 Garden release from here: Qt for S60 "Garden" pre-release
- Install Qt for S60:Installing Qt on S60
- Check this link for installation guide: How to install the package.
- Go through this article: Getting started with Qt for S60
int main(int argc, char *argv)
QApplication a(argc, argv);
QVBoxLayout* layout = new QVBoxLayout;
QWidget* win = new QWidget;
//The minimum and maximum is the number of steps in the operation for which this progress dialog shows progress.
//for example here 0 and 100.
QProgressDialog* progress = new QProgressDialog("Fetching data...", "Cancel", 0, 100);
//Set dialog as modal dialog, if you want.
for (int i = 0; i < 100; i++)
//set progress value.
//if user click cancel button of dialog.
Other useful methods of QProgressDialog
Slots cancel () is resets the progress dialog. Signal canceled () is emitted when the cancel button is clicked. It is connected to the cancel() slot by default.
The code snippet is expected to show a progress dialog with cancel button, as shown in below image.
- Download the working Code Example.