From aed783e1f7e5f89c4d556ead59e7dead97fb5625 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 20 Jun 2020 03:00:44 -0700 Subject: [PATCH] Qt: Add per-page scrolling to memory view (fixes #1795) --- CHANGES | 1 + src/platform/qt/MemoryModel.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGES b/CHANGES index 2137b5509..bcc2b9b58 100644 --- a/CHANGES +++ b/CHANGES @@ -34,6 +34,7 @@ Misc: - Qt: Renderer can be changed while a game is running - Qt: Add hex index to palette view - Qt: Add transformation matrix info to sprite view + - Qt: Add per-page scrolling to memory view (fixes mgba.io/i/1795) 0.8.2: (2020-06-14) Emulation fixes: diff --git a/src/platform/qt/MemoryModel.cpp b/src/platform/qt/MemoryModel.cpp index 98d743067..856592a30 100644 --- a/src/platform/qt/MemoryModel.cpp +++ b/src/platform/qt/MemoryModel.cpp @@ -93,6 +93,10 @@ MemoryModel::MemoryModel(QWidget* parent) ++m_top; } else if (action == QSlider::SliderSingleStepSub) { --m_top; + } else if (action == QSlider::SliderPageStepAdd) { + m_top += (viewport()->size().height() - m_cellHeight) / m_cellHeight; + } else if (action == QSlider::SliderPageStepSub) { + m_top -= (viewport()->size().height() - m_cellHeight) / m_cellHeight; } else { return; } @@ -590,6 +594,12 @@ void MemoryModel::keyPressEvent(QKeyEvent* event) { case Qt::Key_Down: adjustCursor(16, event->modifiers() & Qt::ShiftModifier); return; + case Qt::Key_PageUp: + adjustCursor(-16 * ((viewport()->size().height() - m_cellHeight) / m_cellHeight), event->modifiers() & Qt::ShiftModifier); + return; + case Qt::Key_PageDown: + adjustCursor(16 * ((viewport()->size().height() - m_cellHeight) / m_cellHeight), event->modifiers() & Qt::ShiftModifier); + return; default: return; }