Hi,
if I connect two QAbstractButton::clicked(bool) signals to a slot buttonsClicked(bool), is there a way to determine which button was clicked ?
Hi,
if I connect two QAbstractButton::clicked(bool) signals to a slot buttonsClicked(bool), is there a way to determine which button was clicked ?
ouekah (26th April 2010)
and then you will need to cast it to the type you want..
like in the slot :
QPushButton *pSender = qobject_cast<QPushButton *>(sender());
ouekah (26th April 2010)
See also QSignalMapper!
ouekah (26th April 2010)
With QSignalMapper being much more OO than ugly type casting of sender()
The result can also be used in switch/case statements, as the return value is constant, so can make for more readable, more optimisable code.
ouekah (26th April 2010)
Bookmarks