According to what I know, Qt Designer
is unable to work with signal/slot handling(a slot defined by me). Do you have documentation for user-defined slots
for menus?
Question: How can I define my own slot for a menu?
If you are asking how to make user-defined slots for menus in Qt, something like this should work:
Add a QAction
to the menu item, and connect the action's triggered
signal to a slot.
class Example(QtGui.QMainWindow):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
testAction = QtGui.QAction(QtGui.QIcon('test.png'), '&Exit', self)
testAction.triggered.connect(self.runExample)
menubar = self.menuBar()
testMenu = menubar.addMenu('&Test')
testMenu.addAction(testAction)
def runExample(self):
print "Running example."