PDA

View Full Version : how to know which button emit the signal?



coder1985
12th January 2008, 11:11
hi, everybody
i have 3 button each of them emit the clicked() signal and that signal emit one slot
called writeToLineEdit() and i want to pass an argument to that slot to know which button
emit the signal but i know that the signal must has parameters just like it's slot
how can i know the button the emit the signal???
thank you.

toki83
12th January 2008, 11:54
Look at QObject::sender(). Called in a slot, returns a pointer to the object that sent the signal.

jacek
12th January 2008, 14:26
You can use also QSignalMapper.