From 94687354bc1fc7eb7b85203c98b7463a7ba1dc3c Mon Sep 17 00:00:00 2001 From: Tobias Rehbein Date: Tue, 7 Jan 2025 19:59:33 +0100 Subject: [PATCH] Close Research View when F6 is pressed while the view is open An `if`-statement was missing, that was present in the other views. Unlike the over views, this condition checks `raise` to differentiate between calls to `science_report_dialog_popup` triggered by the user and the server. Without it, the Research View would be closed, for example, when the research goal is changed. --- client/views/view_research.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client/views/view_research.cpp b/client/views/view_research.cpp index 531c16c7d9..437f2bcb50 100644 --- a/client/views/view_research.cpp +++ b/client/views/view_research.cpp @@ -776,6 +776,17 @@ void science_report_dialog_popup(bool raise) } else { i = queen()->gimmeIndexOf(QStringLiteral("SCI")); w = queen()->game_tab_widget->widget(i); + + // This check includes raise, because science_report_dialog_popup is also + // called from packhand.cpp and we don't want to close an open view in + // this case. If the user triggers science_report_dialog_popup, raise is + // always set to true; it is set to false if it is called from + // packhand.cpp. + if (raise && w->isVisible()) { + top_bar_show_map(); + return; + } + sci_rep = reinterpret_cast(w); if (queen()->game_tab_widget->currentIndex() == i) { sci_rep->redraw();