KelvinS
KelvinS

Reputation: 3061

The QProgressDialog is not closing

I'm having some trouble with a QProgressDialog on my app.

When the user clicks on a calculation button, I show a QProgressDialog that is updated from a QThread (I don't think this is related to the problem), and when this QThread finishes I call a function that closes the QProgressDialog.

progressDialog->setValue(100);
progressDialog->close();

It seems to be working.

But if the user clicks on the calculation button and minimizes the app (main window), the QProgressDialog don't close:

enter image description here

I already checked and the code is reaching on the command:

progressDialog->close();

I don't know what is happening, can someone help me?

Thanks

Upvotes: 0

Views: 1415

Answers (1)

KelvinS
KelvinS

Reputation: 3061

I solved the problem by adding the following attribute to my progress dialog:

progressDialog->setAttribute(Qt::WA_DeleteOnClose, true);

Upvotes: 3

Related Questions