PDA

View Full Version : MousePress Events on ContextMenu items



Naveen
22nd February 2006, 05:19
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

wysota
22nd February 2006, 07:26
It's not how it's done. You should connect their activated() or triggered() signal to a slot which implements the functionality. For example:


connect(act2, SIGNAL(triggered()), this, SLOT(close()));