Bug #2035039: Quickview window opens in the background

This commit is contained in:
Charles Haley 2023-09-12 10:05:11 +01:00
parent 2fe2e6b8bd
commit 7738fb8105

View File

@ -6,7 +6,7 @@ __copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from qt.core import QAction
from qt.core import QAction, QTimer
from calibre.gui2.actions import InterfaceAction
from calibre.gui2.dialogs.quickview import Quickview
@ -171,6 +171,10 @@ class ShowQuickviewAction(InterfaceAction):
if show or (self.current_instance and not self.current_instance.is_closed):
self.focus_quickview()
self.current_instance.slave(idx)
# This is needed because if this method is invoked from the library
# view header context menu, the library view takes back the focus. I
# don't know if this happens for any context menu.
QTimer.singleShot(0, self.current_instance.set_focus)
def library_changed(self, db):
'''