MousePress Events on ContextMenu items
I have a CustomContext menu and have added items to that like this
QAction* act = menu.addAction("Restore");
QAction* act2 = menu.addAction("Close");
I want to implement MousePressEvent for this CustomContextMenu and give the corresponding functionality to their press.....
like if Close is pressed i want to execute exit() method.....on this click...
How can I capture these mousePress event on a CustomContextMenu items:confused:
Thanks in Advance
Naveen
Re: MousePress Events on ContextMenu items
It's not how it's done. You should connect their activated() or triggered() signal to a slot which implements the functionality. For example:
Code:
connect(act2, SIGNAL(triggered()), this, SLOT(close()));