how to connect different signals to one single slot?
-
@slimhs said in how to connect different signals to one single slot?:
does this correct?
no you need to connect each signal separately with the slot.
Just a note: a signal is connectable with a slot if the slot has the same parameters or the slot less parameters. Means the following is also valid:
connect( sender, SIGNAL(signal(QString)), receiver, SLOT(slot()) ); connect( sender, SIGNAL(signal(int,QString), receiver, SLOT(slot(int)) );
-
@slimhs said in how to connect different signals to one single slot?:
so I can't push the diffrent signal in the same connect instruction?
QObject::connect
is a static function, not an instruction, but yes, you can't do it in one call. -
@slimhs said in how to connect different signals to one single slot?:
connect(button,SIGNAL(signal_1()),SIGNAL(signal_2()),this,SLOT(slot1()));
does this correct?Syntax is :
connect(senderObject,SIGNAL(signalName()),receiverObject,SLOT(slotName()));
Both the signatures have to match.Thanks,