There is an operation in my application that can take up-to few minutes to finish. I wish to show a simple dialog box which opens when the operation begins, displays a simple wait message like 'Operation in progress..' and closes automatically when the operation finishes.
To implement above functionality, I am trying to make use of a QProgressDialog which does not have a QProgressBar. It seems to work fine but I am unable to set the wait message. Following is the code:
QProgressDialog progress(this);
QLabel *lblCustom = new QLabel(&progress);
progress.setBar(new QProgressBar());
progress.setValue(0);
progress.setLabel(lblCustom);
progress.setLabelText("Operation in progress. Please wait...");
progress.setMaximum(0);
progress.setMinimum(0);
progress.setModal(true);
progress.setWindowTitle("Validate field data");
progress.setCancelButton(0);
progress.setFixedSize(400, 100);
progress.setWindowFlags(progress.windowFlags() & ~Qt::WindowCloseButtonHint);
progress.show();
// operation
progress.close();
Setting label text does not seem to work. Please let me know what is wrong here? I am relatively new to Qt.