[Qt-interest] How associate slot sender with my data object?

John McClurkin jwm at nei.nih.gov
Sat Jun 20 21:53:27 CEST 2009


Ed Sutton wrote:
> I am getting started using signals and slots. I use QSignalMapper with QGroupBox collection of QRadioButtons that select video channels.  
> 
> In the received slot, how can I both retrieve the sender's checked state and associate the sender with it's related channel data object?  Do QT widgets support a pointer to a void* "tag object"?  Some way to associate my data object with the signal sender?  I tried to make my own but cannot seem to derive from QRadioButton.
> 
> In order to determine the QRadioButton checked state in the slot, the best choice seems to use the SLOT(channelChanged(QWidget*)) signature.  In order to associate the sender with my data object, must I make my own associative map collection?  Is this typical or is there a better approach?
> 
> Thanks in advance for sharing your experience,
> 
> -Ed



More information about the Qt-interest-old mailing list