python 2.7 - QMenu context menu initial size too small and w/o content in QtOpenGL.QGLWidget -


i using pyqt 4.8.6 bindings python 2.7.9. create context menu inside qtopengl.qglwidget:

class openglwidget(qtopengl.qglwidget):     def __init__(self, parent=none):         qtopengl.qglwidget.__init__(self, parent)         #    context menu properties         self.setcontextmenupolicy(qtcore.qt.customcontextmenu)      def contextmenuevent(self, event):         self.popmenu = qtgui.qmenu(parent=self)         print self.popmenu.sizehint()         print self.popmenu.size()         self.popmenu.setfixedwidth(100)         self.popmenu.setfixedheight(100)         print self.popmenu.size()         self.popmenu.addaction(qtgui.qaction('refresh', self.updategl()))         self.popmenu.addseparator()         self.popmenu.addaction(qtgui.qaction('test2', none))         self.popmenu.exec_(event.globalpos())      def mousepressevent(self, event):         self.last_pos = qtcore.qpoint(event.pos())          if event.button() == qtcore.qt.rightbutton:             self.contextmenuevent(event) 

it prints out:

>>> pyqt4.qtcore.qsize(2, 2) >>> pyqt4.qtcore.qsize(100, 30) >>> pyqt4.qtcore.qsize(100, 100) 

and context menu looks empty, below:

empty context menu

i know how set context menu size adjustable , seen initial settings? have ideas why there no menu text (function) inside? use context menu in tree view , there works ok, here have problem. , if dons set fixed menu size, menu smaller letters of coordinate system axes.

it looks way defining actions not quite ok, although found in example somewhere. context menu items (actions) should defined as:

_updateglaction = popmenu.addaction("refresh") _updateglaction.triggered.connect(self.repaintgl) 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -