added shortcut as argument to addAction
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
from PyQt5.QtGui import QKeySequence
|
||||
from PyQt5.QtWidgets import QAction, QActionGroup
|
||||
|
||||
|
||||
@ -10,8 +11,10 @@ class MenuBase:
|
||||
def __init__(self):
|
||||
self.checkboxes = {}
|
||||
|
||||
def addAction(self, name, triggered):
|
||||
def addAction(self, name, triggered, shortcut=None):
|
||||
action = QAction(name, triggered=triggered, parent=self.qmenu)
|
||||
if shortcut:
|
||||
action.setShortcut(QKeySequence(shortcut))
|
||||
self.qmenu.addAction(action)
|
||||
return action
|
||||
|
||||
|
Reference in New Issue
Block a user