You Are Here:

Community: Wiki

This page was last modified on 31 October 2009, at 08:33.

Create progress dialog using QProgressDialog

From Forum Nokia Wiki

Reviewer Approved   


ID ... Creation date 06 June 2009
Platform S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition Tested on devices Nokia 5800
Category Qt for Symbian Subcategory


Keywords (APIs, classes, methods, functions): QProgressDialog


Overview

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.

Preconditions

Source code

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
ProgressDialog w;
w.showMaximized();
 
 
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.
progress->setWindowModality(Qt::WindowModal);
 
layout->addWidget(progress,Qt::AlignCenter);
win->setLayout(layout);
 
for (int i = 0; i < 100; i++)
{
//set progress value.
progress->setValue(i);
win->show();
 
//if user click cancel button of dialog.
if (progress->wasCanceled())
break;
}
 
progress->setValue(100);
win->show();
 
return a.exec();
}


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.

Postconditions

The code snippet is expected to show a progress dialog with cancel button, as shown in below image.

Image:QtProgressDialog.PNG

Code Example

External reference

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fCS001433E5fE2dE5fWatchingE5faE5fYouTubeE5fvideoE5finE5fE51tX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZE71tQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qfnZuserE5ftagQSxE71tX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ