[SOLVED] Finding the corresponding action from Toolbar
-
Hi All,
I used "for loop" to create file toolbar Action.
@
void TestDlg::addActionstoFileToolbar()
{
QAction *action;
for( int i=0;i<10;i++)
{
QString Name = QVariant(i).toString();
action = new QACtion( Name, this);
fileToolBar->addAction(action) // QToolBar *fileToolbar
connect( action, SIGNAL(triggered(), this, actionHandler());
}}
void TestDlg::actionHandler()
{
/// hope this is the handler for all actions in File Toolbar ,
///but i want to know..which Action has pressed each time inside this SLOT
}
@After executing these code, i am able to see all the action from the toolbar.
but i want to know..which Action has pressed each time inside this SLOT[edit, typo in title fixed, Eddy]
-
I would suggest you have a look at the "QSignalMapper":http://doc.qt.nokia.com/4.7-snapshot/qsignalmapper.html class.
-
One possibility would be to use "actionTriggered":http://doc.qt.nokia.com/4.7/qtoolbar.html#actionTriggered of the toolbar.