The argument to QtCore.SLOT
should be a string matching the signature of the slot, whereas you are trying to pass in the return value of notifyaction1
(which is None
). Also, since notifyaction1
isn't a Qt slot, you would need to decorate it accordingly so that it could be used as one:
@QtCore.pyqtSlot()
def notifyaction1(self):
print "action1"
...
object_cntext_Menu.addAction("action2", self, QtCore.SLOT("notifyaction1()"))
However, I wouldn't recommend this approach, as it is over-complicated. The signature of QMenu.addAction works differently in PyQt, in that it can accept any python callable:
object_cntext_Menu.addAction("action2", self.notifyaction1)
And in fact, wherever you see Qt functions with argument pairs like this:
const QObject * receiver, const char * member
you can generally use a single python callable argument instead.