mirror of https://github.com/mgba-emu/mgba.git
Qt: Better highlight active key in control binding
This commit is contained in:
parent
7b543df002
commit
b69cbd433d
1
CHANGES
1
CHANGES
|
@ -141,6 +141,7 @@ Misc:
|
||||||
- Core: Config values can now be hexadecimal
|
- Core: Config values can now be hexadecimal
|
||||||
- GB: Reset with initial state of DIV register
|
- GB: Reset with initial state of DIV register
|
||||||
- GB MBC: New MBC7 implementation
|
- GB MBC: New MBC7 implementation
|
||||||
|
- Qt: Better highlight active key in control binding
|
||||||
|
|
||||||
0.5.2: (2016-12-31)
|
0.5.2: (2016-12-31)
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
#include "GBAKeyEditor.h"
|
#include "GBAKeyEditor.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
|
@ -182,10 +183,20 @@ bool GBAKeyEditor::event(QEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GBAKeyEditor::eventFilter(QObject* obj, QEvent* 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) {
|
if (event->type() != QEvent::FocusIn) {
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue