mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 12:47:11 -05:00
add context menu to browser
This commit is contained in:
parent
7981db1466
commit
405cea6a60
1 changed files with 13 additions and 0 deletions
|
|
@ -450,6 +450,19 @@ class Browser(QMainWindow):
|
|||
runHook('browser.setupMenus', self)
|
||||
self.mw.maybeHideAccelerators(self)
|
||||
|
||||
# context menu
|
||||
self.form.tableView.setContextMenuPolicy(Qt.CustomContextMenu)
|
||||
self.form.tableView.customContextMenuRequested.connect(self.onContextMenu)
|
||||
|
||||
def onContextMenu(self, _point):
|
||||
m = QMenu()
|
||||
for act in self.form.menu_Cards.actions():
|
||||
m.addAction(act)
|
||||
m.addSeparator()
|
||||
for act in self.form.menu_Notes.actions():
|
||||
m.addAction(act)
|
||||
m.exec_(QCursor.pos())
|
||||
|
||||
def updateFont(self):
|
||||
# we can't choose different line heights efficiently, so we need
|
||||
# to pick a line height big enough for any card template
|
||||
|
|
|
|||
Loading…
Reference in a new issue