johnc is right, but I don't see what use is the signal mapper here.
The signal mapper is good for when you have multiple dynamic, only in run time determined controls that need to be connected to slots by some rules.
But for finite number of known objects, I am not sure if using the a signal mapper is really less coding, or has any other advantage over regular old school connections.
You can implement the same functionality as the signal mapper by just connecting to one slot, and in the slot do:
void MyClass::mySmartSlot()
{
switch(sender())
{
case pButton1: //do button stuff;
break;
case pButton2: // do button 2 stuff;
break;
//or even
case pLineEdit: //we can even do other control stuff with the same slot
break;
}
}
void MyClass::mySmartSlot()
{
switch(sender())
{
case pButton1: //do button stuff;
break;
case pButton2: // do button 2 stuff;
break;
//or even
case pLineEdit: //we can even do other control stuff with the same slot
break;
}
}
To copy to clipboard, switch view to plain text mode
This approach gives far more flexibility, and is not more coding.
But this is usually not needed.
Bookmarks