all repos — mgba @ b69cbd433d8a93d0679d9623118dfc4adff37aad

mGBA Game Boy Advance Emulator

Qt: Better highlight active key in control binding
Vicki Pfau vi@endrift.com
Sun, 25 Jun 2017 16:04:56 -0700
commit

b69cbd433d8a93d0679d9623118dfc4adff37aad

parent

7b543df00225ce9c356f357e5f4c4c2de76ab61e

2 files changed, 13 insertions(+), 1 deletions(-)

jump to
M CHANGESCHANGES

@@ -141,6 +141,7 @@ - GB: Trust ROM header for number of SRAM banks (fixes mgba.io/i/726)

- Core: Config values can now be hexadecimal - GB: Reset with initial state of DIV register - GB MBC: New MBC7 implementation + - Qt: Better highlight active key in control binding 0.5.2: (2016-12-31) Bugfixes:
M src/platform/qt/GBAKeyEditor.cppsrc/platform/qt/GBAKeyEditor.cpp

@@ -5,6 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this

* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "GBAKeyEditor.h" +#include <QApplication> #include <QComboBox> #include <QHBoxLayout> #include <QPaintEvent>

@@ -182,10 +183,20 @@ return QWidget::event(event);

} bool GBAKeyEditor::eventFilter(QObject* obj, QEvent* event) { + KeyEditor* keyEditor = static_cast<KeyEditor*>(obj); + if (event->type() == QEvent::FocusOut) { + keyEditor->setPalette(QApplication::palette(keyEditor)); + } if (event->type() != QEvent::FocusIn) { return false; } - findFocus(static_cast<KeyEditor*>(obj)); + + QPalette palette = keyEditor->palette(); + palette.setBrush(keyEditor->backgroundRole(), palette.highlight()); + palette.setBrush(keyEditor->foregroundRole(), palette.highlightedText()); + keyEditor->setPalette(palette); + + findFocus(keyEditor); return true; }