Fixes #2035039 [Quickview window opens in the background](https://bugs.launchpad.net/calibre/+bug/2035039)
This commit is contained in:
Kovid Goyal 2023-09-12 15:08:56 +05:30
commit 97ecdad95e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -6,7 +6,7 @@ __copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
from qt.core import QAction from qt.core import QAction, QTimer
from calibre.gui2.actions import InterfaceAction from calibre.gui2.actions import InterfaceAction
from calibre.gui2.dialogs.quickview import Quickview 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): if show or (self.current_instance and not self.current_instance.is_closed):
self.focus_quickview() self.focus_quickview()
self.current_instance.slave(idx) 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): def library_changed(self, db):
''' '''