Qt: Add per-page scrolling to memory view (fixes #1795)

This commit is contained in:
Vicki Pfau 2020-06-20 03:00:44 -07:00
parent 3f818f0735
commit aed783e1f7
2 changed files with 11 additions and 0 deletions

View File

@ -34,6 +34,7 @@ Misc:
- Qt: Renderer can be changed while a game is running - Qt: Renderer can be changed while a game is running
- Qt: Add hex index to palette view - Qt: Add hex index to palette view
- Qt: Add transformation matrix info to sprite 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) 0.8.2: (2020-06-14)
Emulation fixes: Emulation fixes:

View File

@ -93,6 +93,10 @@ MemoryModel::MemoryModel(QWidget* parent)
++m_top; ++m_top;
} else if (action == QSlider::SliderSingleStepSub) { } else if (action == QSlider::SliderSingleStepSub) {
--m_top; --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 { } else {
return; return;
} }
@ -590,6 +594,12 @@ void MemoryModel::keyPressEvent(QKeyEvent* event) {
case Qt::Key_Down: case Qt::Key_Down:
adjustCursor(16, event->modifiers() & Qt::ShiftModifier); adjustCursor(16, event->modifiers() & Qt::ShiftModifier);
return; 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: default:
return; return;
} }