From 7738fb810546e22a3bb87f5614cea1cd801686c8 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Tue, 12 Sep 2023 10:05:11 +0100 Subject: [PATCH] Bug #2035039: Quickview window opens in the background --- src/calibre/gui2/actions/show_quickview.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/actions/show_quickview.py b/src/calibre/gui2/actions/show_quickview.py index 61358d2a5a..8cb390b1c9 100644 --- a/src/calibre/gui2/actions/show_quickview.py +++ b/src/calibre/gui2/actions/show_quickview.py @@ -6,7 +6,7 @@ __copyright__ = '2010, Kovid Goyal ' __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): '''