Connect multiple signals to one slot
-
Hi all,
I have a
slotwhich can take twoQStringvalues:void setChannel(QString valueOne, QString valueTwo);and, I have two signals from two different windows:
&WindowOne:setValue(QString) &WindowTwo:targetValue(QString)Is it possible to connect those
signalsto the above slot ? for example:
setValue -->valueOne
targetValue-->valueTwoif yes, could you show me the syntax, please?
-
Hi all,
I have a
slotwhich can take twoQStringvalues:void setChannel(QString valueOne, QString valueTwo);and, I have two signals from two different windows:
&WindowOne:setValue(QString) &WindowTwo:targetValue(QString)Is it possible to connect those
signalsto the above slot ? for example:
setValue -->valueOne
targetValue-->valueTwoif yes, could you show me the syntax, please?
@viniltc said in Connect multiple signals to one slot:
Is it possible to connect those signals to the above slot ?
It's not working like this.
Why do you want to use another parameter for each signal?
This is bad design (as slot would need to know how many signals are connected) and does not work as signal has to pass all parameters the slot expects.
Why not simply have one parameter in the slot?
If you need to know who emitted the signal you can use sender(). Or use more than one slot.