I create this object when I want to create a QAction. I then add this QAction to a menu:
class ActionObject(object):
def __init__(self, owner, command):
action = QtGui.QAction(command.name, owner)
self.action = action
self.command = command
action.setShortcut(command.shortcut)
action.setStatusTip(command.name)
QtCore.QObject.connect(action, QtCore.SIGNAL('triggered()'), self.triggered)
def triggered(self):
print("got triggered " + self.command.id + " " + repr(checked))
Unfortunately, when the menu item is selected, the 'triggered' function is not called. QtCore.QObject.connect() returns True. Nothing is printed on the console to indicate that anything is wrong, and no exception is thrown.
How can I debug this? (or, what am I doing wrong?)