Close UserInfoPopup when Escape is pressed

This commit is contained in:
Rasmus Karlsson 2020-06-14 12:26:50 +02:00
parent dad9677bba
commit 666b577bd5

View file

@ -12,6 +12,7 @@
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
#include "util/LayoutCreator.hpp" #include "util/LayoutCreator.hpp"
#include "util/PostToThread.hpp" #include "util/PostToThread.hpp"
#include "util/Shortcut.hpp"
#include "widgets/Label.hpp" #include "widgets/Label.hpp"
#include "widgets/helper/EffectLabel.hpp" #include "widgets/helper/EffectLabel.hpp"
#include "widgets/helper/Line.hpp" #include "widgets/helper/Line.hpp"
@ -60,6 +61,9 @@ UserInfoPopup::UserInfoPopup()
this->setWindowFlag(Qt::Popup); this->setWindowFlag(Qt::Popup);
#endif #endif
// Close the popup when Escape is pressed
createWindowShortcut(this, "Escape", [this] { this->deleteLater(); });
auto layout = LayoutCreator<QWidget>(this->getLayoutContainer()) auto layout = LayoutCreator<QWidget>(this->getLayoutContainer())
.setLayoutType<QVBoxLayout>(); .setLayoutType<QVBoxLayout>();