From 82b31d8b107740f81b9990049cc760931d781b43 Mon Sep 17 00:00:00 2001 From: Louis Moureaux Date: Fri, 18 Oct 2024 12:02:23 +0200 Subject: [PATCH] Support ESC to close the production menu There were already a Cancel button and right click to close, but ESC is more natural. Closes #2383. --- client/citydlg.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/citydlg.cpp b/client/citydlg.cpp index 2251f94352..acdadba01d 100644 --- a/client/citydlg.cpp +++ b/client/citydlg.cpp @@ -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(ev); + if (key_event && key_event->key() == Qt::Key_Escape) { + close(); + return true; } }