[Qt-interest] Accessing QWidgets form different QThreads

Thiago Macieira thiago at kde.org
Fri May 14 19:37:28 CEST 2010


Em Sexta-feira 14. Maio 2010, às 19.18.24, Piotr Dąbrowski escreveu:
> Hi,
> 
> My program is divided into several threads. Each of them does some
> work and during it's execution has to add elements to QTree and log
> some lines to QTextEdit.
> However QWidgets should only be accessed from within the main thread
> (and indeed I get UI errors when doing otherwise).
> 
> Therefore my question is: what is a recommended way to access QWidgets
> from another thread?

You don't.

You write code that calls  back into the main thread and let that thread do 
the widget code.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100514/ea7e3920/attachment.bin 


More information about the Qt-interest-old mailing list