Hi Henning,
Thanks for your replies. (I'm returning the conversation to the pyqt list as
I like using old archives for looking for answers to my own questions. :-) )
First of all, let me describe what I am striving for. A while back I wrote
an application called GemTcl that loads user interfaces built through the
Glade Gui builder. GemTcl lets the user right click on all the buttons,
which popups up a context menu which allows the user to edit the a callback
script that is called when left clicking on the button.
And that's what I wanted to replicate in PyQt.
Regarding contextMenuPolicy, how would you use that. I tried the following,
but it didn't work...
class MyApp(QtGui.QWidget):
def clicked(self):
print "Processing left button"
def context_menu(self):
print "Processing context menu"
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setGeometry(300, 300, 250, 150)
self.setWindowTitle('Icon')
self.button = MyButton(self)
self.button.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.connect(self.button, QtCore.SIGNAL('clicked()'), self.clicked)
self.connect(self.button,
QtCore.SIGNAL('customContextMenuRequested()'), self.context_menu)
Thanks,
Dov
2009/7/30 Henning Schröder <[email protected]>
> I forgot to mention that every widget also has a
> customContextMenuRequested signal. This gets emitted if you set the
> contextMenuPolicy to Qt.CustomContextMenu.
>
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt