Skip to content

Commit

Permalink
Support ESC to close the production menu
Browse files Browse the repository at this point in the history
There were already a Cancel button and right click to close, but ESC is
more natural.

Closes longturn#2383.
  • Loading branch information
lmoureaux committed Oct 18, 2024
1 parent 7d1b0fc commit 82b31d8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client/citydlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2738,6 +2738,13 @@ bool production_widget::eventFilter(QObject *obj, QEvent *ev)

if (!pw_rect.contains(QCursor::pos())) {
close();
return true;
}
} else if (ev->type() == QEvent::KeyRelease) {
auto key_event = dynamic_cast<QKeyEvent *>(ev);
if (key_event && key_event->key() == Qt::Key_Escape) {
close();
return true;
}
}

Expand Down

0 comments on commit 82b31d8

Please sign in to comment.