When a signal is emitted, can all qt objects receive this signal ?
No. When a signal is emitted it is received only by QObjects with signals or slots connected to it.
Your MainWindow and your PushButton both have a signal with the same name... but they are still different signals. They are completely unrelated to each other. When MainWindow emits sigKK
, that has no effect on PushButton's sigKK
.
In your example, sigKK
seems to be entirely unneccessary. Perhaps you could instead connect clicked()
directly to the actions you want to perform?
connect(button, SIGNAL(clicked()),this,SLOT(showRecv1()));
connect(button, SIGNAL(clicked()),this,SLOT(showRecv2()));