[Qt-interest] Can Update() be called other than GUI thread

Arnold Krille arnold at arnoldarts.de
Wed Jan 20 14:47:07 CET 2010


Hi,

On Wednesday 20 January 2010 01:15:26 Malyushytsky, Alex wrote:
> You can't call update() directly from any thread except gui thread.

Actually I think you can. Because as the docs say, it doesn't cause an 
immediate repaint, but schedules a paintEvent to run when the eventloop needs 
it.

> This violates requirement that painting must be done in the gui thread.
> But other thread may schedule the update by sending event to the GUI
>  thread.

See above...

> The easiest way to do it is to use using a mechanism called queued
>  connections, it allows to connect signals from one thread to slots in
>  other thread.

Of course update() is also a slot which you can trigger via a 
QueuedConnection. Which means your signal becomes an event in the receivers 
thread to trigger update() which sends an event in the receivers thread to 
repaint... Sounds as if one connection can be skipped.

Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100120/6e5c2dd3/attachment.bin 


More information about the Qt-interest-old mailing list