PDA

View Full Version : Emit Signal From Another Class



mardi
26th November 2012, 06:40
Hi All,

Why my slot does not display 'qdebug()' text?

Class A
--> instance to B
--> Catch Signal and running local slot.

Class B
--> emit signal


attached the complete code..

Regards,
Mardi

Lesiok
26th November 2012, 07:13
Because SecondClass emits signal before connecting.

mardi
26th November 2012, 07:16
Because SecondClass emits signal before connecting.
:) thanks for the correction..
stupid me

Gokulnathvc
26th November 2012, 12:42
Use connect in either first or second class and emit it after that.

iswaryasenthilkumar
24th December 2015, 11:55
i executed his code i to dont get that qDebug(),as you said before connecting it emit signals,my doubt is how to connect before it emit signals give me example please

Because SecondClass emits signal before connecting.

anda_skoa
24th December 2015, 12:17
The example is trying to emit a signal in an object's constructor.
Naturally it can't be connected yet since the object does not exist yet at this point.

So the fix is not to connect differently but to not emit signals from a constructor.

Cheers,
_