From 13de6dfdc74aa12756b22f18ef62b93777a38b69 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Mon, 5 Jan 2015 04:21:56 -0800 Subject: [PATCH] Qt: Merge findFocus from master --- src/platform/qt/GBAKeyEditor.cpp | 14 ++++++++++++++ src/platform/qt/GBAKeyEditor.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/platform/qt/GBAKeyEditor.cpp b/src/platform/qt/GBAKeyEditor.cpp index 470263908..fe852207a 100644 --- a/src/platform/qt/GBAKeyEditor.cpp +++ b/src/platform/qt/GBAKeyEditor.cpp @@ -179,6 +179,20 @@ void GBAKeyEditor::save() { m_controller->saveConfiguration(m_type); } +bool GBAKeyEditor::findFocus() { + if (m_currentKey != m_keyOrder.end() && (*m_currentKey)->hasFocus()) { + return true; + } + + for (auto key = m_keyOrder.begin(); key != m_keyOrder.end(); ++key) { + if ((*key)->hasFocus()) { + m_currentKey = key; + return true; + } + } + return false; +} + #ifdef BUILD_SDL void GBAKeyEditor::testGamepad() { QSet activeKeys = m_controller->activeGamepadButtons(); diff --git a/src/platform/qt/GBAKeyEditor.h b/src/platform/qt/GBAKeyEditor.h index 9389bb48d..473187914 100644 --- a/src/platform/qt/GBAKeyEditor.h +++ b/src/platform/qt/GBAKeyEditor.h @@ -31,6 +31,7 @@ protected: private slots: void setNext(); void save(); + bool findFocus(); #ifdef BUILD_SDL void testGamepad(); #endif