Qt: Make LoadSaveState row/column manipulation a bit more readable
Jeffrey Pfau jeffrey@endrift.com
Thu, 23 Apr 2015 23:59:44 -0700
1 files changed,
5 insertions(+),
5 deletions(-)
M
src/platform/qt/LoadSaveState.cpp
→
src/platform/qt/LoadSaveState.cpp
@@ -61,13 +61,13 @@
bool LoadSaveState::eventFilter(QObject* object, QEvent* event) { if (event->type() == QEvent::KeyPress) { int column = m_currentFocus % 3; - int row = m_currentFocus - column; + int row = m_currentFocus / 3; switch (static_cast<QKeyEvent*>(event)->key()) { case Qt::Key_Up: - row += 6; + row += 2; break; case Qt::Key_Down: - row += 3; + row += 1; break; case Qt::Key_Left: column += 2;@@ -94,8 +94,8 @@ default:
return false; } column %= 3; - row %= 9; - m_currentFocus = column + row; + row %= 3; + m_currentFocus = column + row * 3; m_slots[m_currentFocus]->setFocus(); return true; }