Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing a "Please wait..." box while slot function is running

Tags:

qt

qt4

I have a slot function in my GUI that takes time to complete (10-15 seconds). I would like to gray the layout and show a box of "Please wait..." that will disappear when the slot function is done.

I need it to be async as I want to use a QProgressBar widget in the "Please wait..." Window.

How can this be done?

like image 718
iTayb Avatar asked Mar 10 '12 16:03

iTayb


1 Answers

Your long running slot should be running in a QThread, while your "Please wait..." widget should be modal in the main GUI thread.

You could use QProgressDialog and maybe choose a windowflag that suits your display needs, or a custom widget. But the long running operation should signal the modal blocking dialog when it has completed, causing the dialog to then hide.

like image 54
jdi Avatar answered Oct 31 '22 18:10

jdi