[Solved] Problem with QSignalMapper and QAction never triger the Slot
Hi i try to bind slot with argument to QAction triggered SIGNAL
i have this code ,the context menu working great . BUT the OpenPublishWin never triggered .
- {
- QString groupID;
- groupID = modelIndx.model()->index(modelIndx.row(),0,modelIndx.parent()).data(Qt::UserRole).toString();
- QMenu myMenu;
- myMenu.addAction(OpenPublishAction);
- connect(OpenPublishAction, SIGNAL(triggered()),m_SignalMapper, SLOT(map()) );
- m_SignalMapper->setMapping(OpenPublishAction,groupID);
- }
- {
- WRITELOG(gid)
- }
8 replies
I just make a try , adding the following test codes to a QMainWindow example, and the signalMapper works well, the debugger can stop at the break point of OpenPublishWin().
- void MainWindow::MainWindow()
- {
- ....
- connect(cutAct, SIGNAL(triggered()),signalMapper, SLOT(map()) );
- signalMapper->setMapping(cutAct,groupID);
- }
- {
- // debugger stop here
- }
The line
- m_SignalMapper->setMapping(OpenPublishAction,groupID);
You must log in to post a reply. Not a member yet? Register here!





