[Qt-interest] Basic QThread question - part 2

Eirik Ulvik eiriku at simsurgery.com
Thu May 6 08:01:46 CEST 2010



Den 05.05.2010 20:41, skrev Constantin Makshin:
> Not necessarily — "emit" is an empty definition (my guess is that it's simply to show that secondTicked() is a signal), so both variants give the same result.
> 
> On Mon, 03 May 2010 15:44:39 +0400, Gabriel M. Beddingfield <gabrbedd at gmail.com> wrote:
>> On Mon, 3 May 2010, Phil wrote:
>>>    iSecondsAccu_++;
>>>    emit(secondTicked(iSeconds_ - iSecondsAccu_));
>>

emit is crucial in order to have the moc'er do process it as a signal
not as a regular function call. There is no difference when using
Qt::DirectConnection in signals, but as you are now in a mulit threaded
application all signals should go as Qt::QueuedConnection. If you skip
the emit word, a regular function call will be made and the processing
will take place in the calling thread.

Eirik

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 551 bytes
Desc: OpenPGP digital signature
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100506/c7d34138/attachment.bin 


More information about the Qt-interest-old mailing list