Look that the menu is in no way tied to the graphics view so pressing keys when the view has focus will not lead towards the appropriate actions. In your situation it is best to build the context menu differently. Instead of creating a custom QMenu object and adding actions to it, use the Qt::ActionsContextMenu context menu policy and use addAction() to add the actions directly to the view widget. Then all the shortcuts will be active the whole time the widget has focus and in addition if you right click the view, a context menu made of actions you added to the widget will be created for you. If you don't really want the context menu, just the shortcuts then don't set the context menu policy to ActionsContextMenu and only add the actions to the widget.





Reply With Quote

Bookmarks