added shortcut as argument to addAction

This commit is contained in:
2023-01-26 23:33:12 +01:00
parent d5d8401178
commit 87da48400f

View File

@ -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