Skip to content

Commit

Permalink
Close Research View when F6 is pressed while the view is open
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
blabber committed Jan 7, 2025
1 parent b61d25a commit 9468735
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions client/views/view_research.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<science_report *>(w);
if (queen()->game_tab_widget->currentIndex() == i) {
sci_rep->redraw();
Expand Down

0 comments on commit 9468735

Please sign in to comment.