Workaround for Qt 5 regression that prevented the keyboard shortcuts for the various Similar books actions from working

This commit is contained in:
Kovid Goyal 2014-08-24 13:49:25 +05:30
parent dfac964265
commit 73366a79d6

View File

@ -9,6 +9,7 @@ from functools import partial
from PyQt5.Qt import QToolButton
from calibre.constants import isosx
from calibre.gui2.actions import InterfaceAction
class SimilarBooksAction(InterfaceAction):
@ -30,6 +31,11 @@ class SimilarBooksAction(InterfaceAction):
ac = self.create_action(spec=(text, icon, None, shortcut),
attr=target)
m.addAction(ac)
if isosx:
# For some reason with Qt 5 the keyboard shortcuts for these
# actions dont work unless the actions are added to the main
# window
self.gui.addAction(ac)
ac.triggered.connect(partial(self.show_similar_books, target))
self.qaction.setMenu(m)