[clug] long run function in trolltech qt widget

Brad Hards bradh at frogmouth.net
Thu Dec 4 06:44:31 GMT 2008

On Thursday 04 December 2008 09:50:11 am jm wrote:
> doWork() doesn't return until it's actually finished the calculation.
> There isn't a contiuation unfortunately. How do I call doWork() so that
> MyPage is displayed while the work is being done? I've been trying to
> avoid a thread for this as it only meant to be a prototype at this stage
> and QThread looks as if it will take a while to understand. Especially
> getting values in and out of threads.

Well. if you don't return to the event loop, it isn't going to update the GUI.

You could invoke a process (as Crash suggested) and read the results off 
stdout with QProcess, connecting the readyReadStandardOutput signal to
a slot that updates the QProgressBar.

You could use a QThread (its not hard, but make sure you read the docs).

If you are really just doing a prototype, and know how to connect up the 
bash / dbus (or dcop in KDE3) stuff, you can get a progress bar out of the 
kdialog(1) tool. You could also create enough dialogs to simulate the wizard.


More information about the linux mailing list