[Qt-interest] Connecting multiple QActions to a single SLOT
Bob Hood
bhood2 at comcast.net
Wed Feb 17 15:44:50 CET 2010
Ah, very cool. I did not know about QSignalMapper. Although doing the
qobject_cast<>() works perfectly for my needs, I'll have a look at
QSignalMapper as an alternative.
Thanks, André!
André Somers wrote:
> Better take a look at QSignalMapper instead.
>
> André
>
>
> -----Oorspronkelijk bericht-----
> Van: qt-interest-bounces at trolltech.com
> [mailto:qt-interest-bounces at trolltech.com] Namens Bob Hood
> Verzonden: woensdag 17 februari 2010 2:20
> Aan: qt-interest at trolltech.com
> Onderwerp: Re: [Qt-interest] Connecting multiple QActions to a single SLOT
>
> Sorry, I fired off too soon. I remembered just as I hit "Send" that I'd
> already solved this problem once, but it was a long time ago. Had to go
> back and find the code to that application.
>
> In case anybody needs it in the future, simply casting the sender() back
> to a QAction will get you what you need:
>
> QAction *action = qobject_cast<QAction *>(sender());
> if(!action)
> return;
>
> Sorry again to waste the bandwidth. :)
More information about the Qt-interest-old
mailing list