[SOLVED]How to get emitter of a signal in the slot?
Currently I have five QListEdit widgets in a widget of my program.
I need to connect their editingFinished() signal to a shared slot, but they have to be distinguished inside the slot.
I guess it's impossible to get emitter of a signal in Qt, but writing five clue slots which will call the shared slot with an extra parameter is too ugly.
So, any ideas?
UPDATE: Nevermind. I just found the "Advanced Signals and Slots Usage" section in "Signals & Slots".
I hope you've found QSignalMapper.
QObject::sender() will return you a pointer to signal sender when you call it from the slot.
Thanks guys, but both QSignalMapper and QObject::sender() are referred in the section I mentioned...
[quote author="Anticross" date="1325161551"]QObject::sender() will return you a pointer to signal sender when you call it from the slot.[/quote]
Be aware that sender() returns a null pointer, if the slot is called directly (i.e. not using a signal/slot connection).