mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix focus issues with LoadSaveState
This commit is contained in:
parent
64b44efbf1
commit
18fc2cbdb2
1
CHANGES
1
CHANGES
|
@ -116,6 +116,7 @@ Bugfixes:
|
|||
- 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
|
||||
|
|
|
@ -27,8 +27,9 @@ LoadSaveState::LoadSaveState(std::shared_ptr<CoreController> controller, QWidget
|
|||
, 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 @@ LoadSaveState::LoadSaveState(std::shared_ptr<CoreController> controller, QWidget
|
|||
if (m_currentFocus < 0) {
|
||||
m_currentFocus = 0;
|
||||
}
|
||||
m_slots[m_currentFocus]->setFocus();
|
||||
|
||||
QAction* escape = new QAction(this);
|
||||
connect(escape, &QAction::triggered, this, &QWidget::close);
|
||||
|
@ -242,6 +244,10 @@ void LoadSaveState::showEvent(QShowEvent* event) {
|
|||
QWidget::showEvent(event);
|
||||
}
|
||||
|
||||
void LoadSaveState::focusInEvent(QFocusEvent*) {
|
||||
m_slots[m_currentFocus]->setFocus();
|
||||
}
|
||||
|
||||
void LoadSaveState::paintEvent(QPaintEvent*) {
|
||||
QPainter painter(this);
|
||||
QRect full(QPoint(), size());
|
||||
|
|
|
@ -41,6 +41,7 @@ protected:
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue