From 260a10bea34c6d141ec636f30d2678265635cf1a Mon Sep 17 00:00:00 2001 From: Gres Date: Sun, 27 Mar 2022 11:37:32 +0300 Subject: [PATCH] Close result widgets with escape button For #86 --- src/represent/representer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/represent/representer.cpp b/src/represent/representer.cpp index 6ed975d..c3177a6 100644 --- a/src/represent/representer.cpp +++ b/src/represent/representer.cpp @@ -135,6 +135,10 @@ bool Representer::eventFilter(QObject * /*watched*/, QEvent *event) const auto casted = static_cast(event); if (casted->button() == Qt::LeftButton) hide(); + } else if (event->type() == QEvent::KeyPress) { + const auto casted = static_cast(event); + if (casted->key() == Qt::Key_Escape) + hide(); } return false; }