[Qt-interest] Connecting multiple QActions to a single SLOT

André Somers andre at familiesomers.nl
Wed Feb 17 07:45:12 CET 2010


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.  :)


Render me gone,                       |||
Bob                                 ^(===)^
---------------------------------oOO--(_)--OOo------------------------------
---
                I keep a Snow Leopard in a box under my Windows.

_______________________________________________
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