PDA

View Full Version : action triggered no emit



waiter
26th September 2012, 11:18
allAssignMenu_->addMenu(menu);
QAction* action = menu->menuAction();

connect(action,SIGNAL(triggered()),this,SLOT(onTri ggered()));


the slot onTriggered() won't be executed anyway,,

wagmare
26th September 2012, 11:45
the signal is triggered(bool) .. its having an argument bool ... just change it to
connect(action,SIGNAL(triggered(bool)),this,SLOT(o nTri ggered()));

if it not works .. in run time it will display some connect error ... just post that error ...

waiter
27th September 2012, 02:38
no,it don't work,,,!!!
connect(action,SIGNAL(triggered(bool)),this,SLOT(o nTri ggered(bool)));

the QAction is menuAction :
QAction* action = menu->menuAction();

not the action like that:
QAction* action = new QAction;

ChrisW67
27th September 2012, 23:26
no,it don't work,,,!!!
This is not a useful description of the problem and what you have done to try and track down the cause.


if it not works .. in run time it will display some connect error ... just post that error ...
Wagmare means the debug output or console window will probably contain a warning message about bad connections. Have you looked?

If there is no warning then check the lifetime of the objects at each end of the connection. If either object is destroyed then the connect is lost.