diff options
Diffstat (limited to 'src/yuzu/util')
-rw-r--r-- | src/yuzu/util/overlay_dialog.cpp | 9 | ||||
-rw-r--r-- | src/yuzu/util/overlay_dialog.h | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/yuzu/util/overlay_dialog.cpp b/src/yuzu/util/overlay_dialog.cpp index 3fa3d0afb..796f5bf41 100644 --- a/src/yuzu/util/overlay_dialog.cpp +++ b/src/yuzu/util/overlay_dialog.cpp @@ -3,6 +3,7 @@ #include <QKeyEvent> #include <QScreen> +#include <QWindow> #include "core/core.h" #include "core/hid/hid_types.h" @@ -162,7 +163,7 @@ void OverlayDialog::MoveAndResizeWindow() { const auto height = static_cast<float>(parentWidget()->height()); // High DPI - const float dpi_scale = qApp->screenAt(pos)->logicalDotsPerInch() / 96.0f; + const float dpi_scale = parentWidget()->windowHandle()->screen()->logicalDotsPerInch() / 96.0f; const auto title_text_font_size = BASE_TITLE_FONT_SIZE * (height / BASE_HEIGHT) / dpi_scale; const auto body_text_font_size = @@ -259,3 +260,9 @@ void OverlayDialog::InputThread() { std::this_thread::sleep_for(std::chrono::milliseconds(50)); } } + +void OverlayDialog::keyPressEvent(QKeyEvent* e) { + if (!ui->buttonsDialog->isHidden() || e->key() != Qt::Key_Escape) { + QDialog::keyPressEvent(e); + } +} diff --git a/src/yuzu/util/overlay_dialog.h b/src/yuzu/util/overlay_dialog.h index 39c44393c..872283d61 100644 --- a/src/yuzu/util/overlay_dialog.h +++ b/src/yuzu/util/overlay_dialog.h @@ -94,6 +94,7 @@ private: /// The thread where input is being polled and processed. void InputThread(); + void keyPressEvent(QKeyEvent* e) override; std::unique_ptr<Ui::OverlayDialog> ui; |