PDA

View Full Version : Interrupt QProcessDialog by other dialog



kiozen
22nd April 2015, 09:15
hi,

I have to store a lot of elements into a database. That takes some time and a progress dialog is necessary to give feedback to the user. Sometimes an element is already in the database and the user has to decide to skip or to replace it. Now the dialog querying the users decision pops up and the QProgressDialog shadows it. If the user closes the QProgressDialog to answer the query the progress dialog is flagged as cancelled resulting in an abort of the operation.

It would need some method to pause the progress dialog, hiding it and passing control to the query dialog and after the user has answered the progress dialog is reactivated again. Probably the solution is easy if I would have a clue what to look for. Any idea? hide() and show() won't work as the hide timeout of the QProgressDialog will interfere.

thanks

Oliver

anda_skoa
22nd April 2015, 10:51
You just need pass the progress dialog as the parent to the new dialog.

Cheers,
_

Santosh Reddy
22nd April 2015, 10:53
Just set the QProgressDialog as the parent of the new dialog which is being showed up.

A small example


int main(int argc, char * argv[])
{
QApplication app(argc, argv);

QProgressDialog dialog;

int value = 100;
dialog.setMaximum(value);
dialog.show();

for(int i = 0; i <= value; i++)
{
app.thread()->msleep(1000);
dialog.setValue(i);
app.processEvents();

if((i%10) == 0)
{
QMessageBox::information(&dialog, "Message", "Click OK to Continue");
}
}

return 0;
}

kiozen
22nd April 2015, 12:02
Thanks! Oh gosh, why didn't I think of this. I knew this will end up embarrassing for me.