[PyQt] Threads with PyQt. Qt's or Python's?

Frédéric frederic.mantegazza at gbiloba.org
Mon Jan 19 17:23:47 GMT 2009


On lundi 19 janvier 2009, Giovanni Bajo wrote:

> On 1/19/2009 5:37 PM, Frédéric wrote:
> > I use python threads, but I have a serializer to push all Qt calls on
> > a queue, and this queue is processed from the main thread, using a
> > QTimer timeout signal.
>
> This would work on Qt4 as well, but of course it's not ideal as you need
> a timer to poll the queue. It's much easier to use QThreads and simply
> post the events (or use the asynchronous signals).
>
> Plus, you can now do non-trivial things from the secondary threads (eg:
> painting with QPainter over a QImage) so it's worth sitting down and
> analyzing all these possibilities before desiging the code with Qt4.
>
> This is the correct link to get a broad overview:
> http://doc.trolltech.com/4.4/threads.html

You convinced me ;o)

As I plan to use the MVC-delegate pattern provided in Qt, I will need to 
have some Qt-dependent code in my model, so, better use all Qt features...

-- 
    Frédéric

    http://www.gbiloba.org



More information about the PyQt mailing list