Is there a way to allow for the right-click of the mouse? I want a menu to pop up when the right-button is clicked, Currently when the right button is clicked the program will exit. I have found information for keyboard shortcuts but i have not found any information for the mouse. I did look on the android developers site.
Asked
Active
Viewed 5,182 times
0
-
@AndyG should i delete my question then? – kyle k Aug 18 '13 at 00:16
-
If that other topic answers then you could do, to prevent it being closed by others. – Andy G Aug 18 '13 at 00:18
1 Answers
1
Depending on which environment you use it is different. But the scenario is the same. You need to create an event for that (extra you can calculate your mouse position to decide where to allow the right click). In Qt You can do something like following :
void xxx::onRightClick()
{
QPopupMenu* contextMenu = new QPopupMenu ( this );
Q_CHECK_PTR ( contextMenu );
contextMenu->insertItem ( "Copy" , this , SLOT (Copy()) );
contextMenu->exec ( QCursor::pos() );
delete contextMenu;
contextMenu = 0;
}
Or you can just use an event filter. You can find the documentation for doing that in Qt here: Qt documentation for mouse events.
I hope this will help you.
Regards, Mikael

SuTron
- 387
- 5
- 16