From 8a64a9b2ad1b401990d634d61b8b96ebafd6b22e Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 21 Apr 2023 14:15:19 +0400 Subject: [PATCH] Close forward options box by Enter. --- Telegram/SourceFiles/ui/chat/forward_options_box.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Telegram/SourceFiles/ui/chat/forward_options_box.cpp b/Telegram/SourceFiles/ui/chat/forward_options_box.cpp index c619ee7194..760ab5dad6 100644 --- a/Telegram/SourceFiles/ui/chat/forward_options_box.cpp +++ b/Telegram/SourceFiles/ui/chat/forward_options_box.cpp @@ -82,6 +82,17 @@ void ForwardOptionsBox( box->addButton(tr::lng_box_done(), [=] { box->closeBox(); }); + + box->events( + ) | rpl::start_with_next([=](not_null e) { + if (e->type() == QEvent::KeyPress) { + const auto k = static_cast(e.get()); + if (k->key() == Qt::Key_Enter || k->key() == Qt::Key_Return) { + box->closeBox(); + } + } + }, box->lifetime()); + box->addRow( object_ptr( box.get(),