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

Ed Sutton ESutton at fescorp.com
Mon Jun 22 14:58:01 CEST 2009


> >>>> I take it you are looking for QObject::sender()
> >>>> (http://doc.trolltech.com/4.5/qobject.html#sender) ?
> >>> I am not sure I understand.
> >>>
> >>> I can get the sender if I use the SLOT(channelChanged(QWidget*))
> >>> signature.  How can QObject::sender() be used to associated the sender
> >>> with my data object?
> >>>
> >>> Forgive for being slow.
> >>>
> >>> -Ed
> >>>
> Don't your QRadioButtons have labels or icons that indicate the new
> channel? You should be able to retrieve those from the pointer returned
> by sender() and associate the label or icon with your data object.

I made an STL map that use the widget text name as the key to retrieve my QWidgetTagPair class (QRadioButton* +  MyObject* ).  

It is more work than I was used to as Microsoft widgets have a Tag object property that you use to associate with your data object.  As a lazy programmer I wanted to make sure I had not missed a similar existing approach in QT.  Thank you for your help.

-Ed


> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list