PDA

View Full Version : getting QAction text from the slot



roxton
18th April 2008, 11:31
Hello! I need to get the QAction text/title from the action's callback/slot. I.e. when an action is triggered and the foo() slot function is called I need to get an action's text/title inside of the foo(). How I can do that?

janus
18th April 2008, 11:39
What about QAction->text() (http://doc.trolltech.com/4.3/qaction.html#text-prop) ?

merlvingian
18th April 2008, 11:43
In your slot use


QAction *Act = qobject_cast<QAction *>(sender());

roxton
18th April 2008, 13:03
Thank's a lot! "QAction *Act = qobject_cast<QAction *>(sender());" is just what I need!