In my Qt app, I create some of my widgets dynamically. Among them are QToolButtons that need to have a similar behavior.
Here is how the widgets are created:
Although using QObject::sender() is perfectly fine, the idealistic approach would be QSignalMapper
QObject::sender()
Use QObject::sender() inside your slot to get the Sender. It will return the object that emit the signal. hope this helps.