Important: Please read the Qt Code of Conduct -

[SOLVED] QSignalMapper - How to identify many signals from same widget

  • Hi,

    I'm using QSignalMapper to connect many signals from different widgets to one unique widget, as posted "here":

    Now I'm trying to handle differents signals from the same Custom Widget, but cannot identify which of them has been activated, cause I always get the same int identifier. The only near approach I have tried, is to manage the signals direct from the sub widgets into the Custom Widget, but that implies to make them Public, and I don't think is appropriate (maybe it is?).

    So, is QSignalMapper the right approach in this situation?. Have not found info about it in the posts or docs, have I missed something?.



  • Lifetime Qt Champion


    Not it's not really the right approach, the idea behing QSignalMapper is to map the same signal for different (but generally of the same type) widgets on a given slot.

    You should rather use a separate mapper (and thus a different slot) for each signal you want to map

    Hope it helps

  • Thanks SGaist. Have tried this approach, works fine and looks better.


Log in to reply