diff --git a/rpcs3/rpcs3qt/memory_viewer_panel.cpp b/rpcs3/rpcs3qt/memory_viewer_panel.cpp index 3ecc56bd02..143d125271 100644 --- a/rpcs3/rpcs3qt/memory_viewer_panel.cpp +++ b/rpcs3/rpcs3qt/memory_viewer_panel.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include "util/logs.hpp" #include "util/asm.hpp" @@ -888,6 +889,47 @@ void memory_viewer_panel::SetPC(const uint pc) m_addr = pc; } +void memory_viewer_panel::keyPressEvent(QKeyEvent* event) +{ + if (!isActiveWindow()) + { + QDialog::keyPressEvent(event); + return; + } + + if (event->modifiers() == Qt::ControlModifier) + { + switch (const auto key = event->key()) + { + case Qt::Key_PageUp: + case Qt::Key_PageDown: + { + scroll(key == Qt::Key_PageDown ? m_rowcount : 0u - m_rowcount); + break; + } + case Qt::Key_F5: + { + if (event->isAutoRepeat()) + { + break; + } + + // Single refresh + ShowMemory(); + break; + } + case Qt::Key_F: + { + m_addr_line->setFocus(); + break; + } + default: break; + } + } + + QDialog::keyPressEvent(event); +} + void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, color_format format, u32 width, u32 height, bool flipv) const { // If exceeds 32-bits it is invalid as well, UINT32_MAX always fails checks diff --git a/rpcs3/rpcs3qt/memory_viewer_panel.h b/rpcs3/rpcs3qt/memory_viewer_panel.h index c3aebf2743..b8f4e88d69 100644 --- a/rpcs3/rpcs3qt/memory_viewer_panel.h +++ b/rpcs3/rpcs3qt/memory_viewer_panel.h @@ -16,6 +16,7 @@ class QComboBox; class QLabel; class QThread; class QHBoxLayout; +class QKeyEvent; class cpu_thread; class CPUDisAsm; @@ -43,7 +44,7 @@ enum search_mode : unsigned search_mode_last = 256, }; -class memory_viewer_panel : public QDialog +class memory_viewer_panel final : public QDialog { Q_OBJECT @@ -112,10 +113,12 @@ private: void* to_ptr(u32 addr, u32 size = 1) const; void SetPC(const uint pc); - virtual void ShowMemory(); + void ShowMemory(); void ShowImage(QWidget* parent, u32 addr, color_format format, u32 width, u32 height, bool flipv) const; u64 OnSearch(std::string wstr, u32 mode); + + void keyPressEvent(QKeyEvent* event) override; }; // Lifetime management with IDM