Qt: Better highlight active key in control binding
Vicki Pfau vi@endrift.com
Sun, 25 Jun 2017 16:04:56 -0700
2 files changed,
13 insertions(+),
1 deletions(-)
M
CHANGES
→
CHANGES
@@ -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.cpp
→
src/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; }