PDA

View Full Version : How to connect a 'silent' signal to a slot with parameter?



tonnot
26th August 2011, 07:07
I have 4 buttons (play first, play last, play next, play last).
I'd like to connect them with the same slot, passing a parameter.
I can't ( or I dont know how to ) - I need something like this :

connect (widget, SIGNAL(clicked),this,play_action(0));
connect (widget, SIGNAL(clicked),this,play_action(1));
connect (widget, SIGNAL(clicked),this,play_action(2));
connect (widget, SIGNAL(clicked),this,play_action(3));

Any idea ?
Thanks

Lesiok
26th August 2011, 07:14
Read about QSignalMapper

gkarthick5
26th August 2011, 07:15
Look at QSignalMapper (http://doc.qt.nokia.com/latest/qsignalmapper.html)

stampede
26th August 2011, 07:17
http://doc.qt.nokia.com/4.7/qsignalmapper.html