Right-click menu position
Asked the same question in another qt forum, trying this one as well...
Working on a project http://code.google.com/p/subdms/ where I'm using pyqt4 for creating the user interface. I think my question is a general Qt-question the fact that I'm using pyqt4 does not matter.
I have a question regarding positioning of a right-click menu. I can't for my life get the menu to popup on the lower right side of the mouse pointer, instead it is positioned dead center under the mouse pointer. How do I get the the correct positioning of the menu?
Here is the code snipet. Guess that mapToGlobal should be something else, or something more added to this statement.
Code:
self.connect(self.ui.documentlist, \
QtCore.SIGNAL('customContextMenuRequested(const QPoint &)'), \
self.showrightclickmenu)
def showrightclickmenu(self, coord):
coord = self.mapToGlobal(coord)
self.ui.menuTools.popup(coord)
Thanks for your help, I'm really stuck on this one.:confused:
Re: Right-click menu position
Try opening the menu at as suggested in the documentation for QMenu::exec()
Re: Right-click menu position
Quote:
Originally Posted by
drhex
Try opening the menu at
as suggested in the documentation for
QMenu::exec()
Ahh, that simple, it worked. Thanks!