[Interest] Setting an QObjects dynamic property from another thread

Thiago Macieira thiago.macieira at intel.com
Thu Jan 30 18:24:14 CET 2014


On quinta-feira, 30 de janeiro de 2014 16:51:41, Philipp Kursawe wrote:
> Such operation should be possible, yet it fails cause setProperty calls:
> 
> QDynamicPropertyChangeEvent ev(name);
> QCoreApplication::sendEvent(this, &ev);
> 
> sendEvent cannot be called from another thread the object does not belong
> to. Is this a bug? Shouldn't that be postEvent instead?

No.

The mistake was trying to set a property from another thread. Do *not* touch a 
QObject from any thread other than the one it is is associated with.

If you add member functions to your QObject-derived class, you're welcome to 
call them. Just make sure that they do not call any other functions inherited 
from QObject.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140130/05bbe384/attachment.sig>


More information about the Interest mailing list