[Qt-interest] main gui thread
Andreas Pakulat
apaku at gmx.de
Wed Feb 18 11:39:06 CET 2009
On 18.02.09 17:45:14, Puneet Bisht wrote:
> now from obj1 i create a thread which transfers the selected files , for
> each file i m creating a separate process , after completion of each
> process
> i m updating status of file as "completed" in the widget.
Why are you using a separate thread when you already do the downloading in
a separate process? QProcess allows to run the process asynchronously and
get notified when the process is done, there's no reason to run that in a
separate thread.
> here is the problem , documents says that gui should be updated from main
> thread but i m updating it from worker thread.
> can someone give me a code snip... on this or upgrade my code ,
> here in terms of this scenario can any one help me on how i should update
> the gui, and using qprocess in different thread other than main one is
> causing crashes.
> i want some code snippet
MyCustomEvent ev;
QApplication::postEvent( ev, obj1 );
then in obj1 class you need to catch the event and act accordingly (i.e.
update your gui).
But again, so far your description doesn't indicate any reason to use a
separate thread.
Andreas
--
Your supervisor is thinking about you.
More information about the Qt-interest-old
mailing list