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

Bob Hood bhood2 at comcast.net
Wed Feb 17 02:14:58 CET 2010


I'm pretty sure this has been covered before on this list before, but a
cursory scan of the archives failed to give me the answer I need.  Sorry
for any repeats.

I am constructing a sub-menu of a QMenu using run-time values.  I don't
know the names of the items on the menu.  I'm connecting QAction's
triggered() signal to a common SLOT for each entry, thus:

    connect(action, SIGNAL(triggered(bool)), this,
SLOT(slot_move_to_folder()));

so each "dyanamic" menu entry goes to that single SLOT.  In
slot_move_to_folder(), I need to process the menu entry based on its
text (or even positional index, if I must).  How can I get at that
particular QAction in the the callback to mine its properties?

Thanks!


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




More information about the Qt-interest-old mailing list