[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] Keeping the GUI from freezing
From:       Andreas Pakulat <apaku () gmx ! de>
Date:       2007-02-19 16:27:23
Message-ID: 20070219162723.GC20122 () morpheus ! apaku ! dnsalias ! org
[Download RAW message or body]

On 19.02.07 08:05:17, Tony Cappellini wrote:
> Is it not sufficient to create a timer, and have it call the main
> window update function?
> Do I really need to use threads?

The problem is: There is no "main window update function". Painting is
done via events, which are scheduled in an event queue and run via an
even loop. A QTimer also uses the event loop, IIRC.

There is QApplication::processEvents which can be called to run through
the event loop at any given time, however that may have various
side-effects which you need to be aware of.

The "safest" way to do heavy work, without blocking the Ui is a separate
thread.  And unless you have to access main-thread-data from the
worker-thread (or vice versa) this is a relative no-brainer using only
events that are sent to the main thread.

Andreas

-- 
You would if you could but you can't so you won't.

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic