all repos — mgba @ 18fc2cbdb222d94424044fa3155964f534c4fab4

mGBA Game Boy Advance Emulator

Qt: Fix focus issues with LoadSaveState
Vicki Pfau vi@endrift.com
Tue, 02 Oct 2018 10:00:57 -0700
commit

18fc2cbdb222d94424044fa3155964f534c4fab4

parent

64b44efbf15168b03ee5f02ca03f55f519e4824f

3 files changed, 9 insertions(+), 1 deletions(-)

jump to
M CHANGESCHANGES

@@ -116,6 +116,7 @@ - GB, GBA: Fix broken opposing button filter (fixes mgba.io/i/1191)

- Qt: Fix jumbled background when paused - Qt: Fix FPS counter on Windows - GB, GBA Savedata: Fix leaks when loading masked save (fixes mgba.io/i/1197) + - Qt: Fix focus issues with load/save state overlay Misc: - mGUI: Add SGB border configuration option - mGUI: Add support for different settings types
M src/platform/qt/LoadSaveState.cppsrc/platform/qt/LoadSaveState.cpp

@@ -27,8 +27,9 @@ , m_controller(controller)

, m_mode(LoadSave::LOAD) , m_currentFocus(controller->stateSlot() - 1) { - setAttribute(Qt::WA_TranslucentBackground); m_ui.setupUi(this); + m_ui.lsLabel->setFocusProxy(this); + setFocusPolicy(Qt::ClickFocus); m_slots[0] = m_ui.state1; m_slots[1] = m_ui.state2;

@@ -56,6 +57,7 @@ }

if (m_currentFocus < 0) { m_currentFocus = 0; } + m_slots[m_currentFocus]->setFocus(); QAction* escape = new QAction(this); connect(escape, &QAction::triggered, this, &QWidget::close);

@@ -240,6 +242,10 @@

void LoadSaveState::showEvent(QShowEvent* event) { m_slots[m_currentFocus]->setFocus(); QWidget::showEvent(event); +} + +void LoadSaveState::focusInEvent(QFocusEvent*) { + m_slots[m_currentFocus]->setFocus(); } void LoadSaveState::paintEvent(QPaintEvent*) {
M src/platform/qt/LoadSaveState.hsrc/platform/qt/LoadSaveState.h

@@ -41,6 +41,7 @@ virtual bool eventFilter(QObject*, QEvent*) override;

virtual void closeEvent(QCloseEvent*) override; virtual void showEvent(QShowEvent*) override; virtual void paintEvent(QPaintEvent*) override; + virtual void focusInEvent(QFocusEvent*) override; private: void loadState(int slot);