Close forward options box by Enter.

This commit is contained in:
John Preston 2023-04-21 14:15:19 +04:00
parent 0b5038aaa2
commit 8a64a9b2ad
1 changed files with 11 additions and 0 deletions

View File

@ -82,6 +82,17 @@ void ForwardOptionsBox(
box->addButton(tr::lng_box_done(), [=] { box->addButton(tr::lng_box_done(), [=] {
box->closeBox(); box->closeBox();
}); });
box->events(
) | rpl::start_with_next([=](not_null<QEvent*> e) {
if (e->type() == QEvent::KeyPress) {
const auto k = static_cast<QKeyEvent*>(e.get());
if (k->key() == Qt::Key_Enter || k->key() == Qt::Key_Return) {
box->closeBox();
}
}
}, box->lifetime());
box->addRow( box->addRow(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box.get(), box.get(),