all repos — mgba @ b4698ab638e172b18892d9c16f392ae08d223e09

mGBA Game Boy Advance Emulator

Qt: Kick focus back to main window when clicking a chip
Vicki Pfau vi@endrift.com
Fri, 22 Feb 2019 18:45:54 -0800
commit

b4698ab638e172b18892d9c16f392ae08d223e09

parent

475c7790c5ddd94127eaa0f4b6b569e7beae2f79

3 files changed, 11 insertions(+), 3 deletions(-)

jump to
M src/platform/qt/BattleChipView.cppsrc/platform/qt/BattleChipView.cpp

@@ -8,6 +8,8 @@

#include "ConfigController.h" #include "CoreController.h" #include "GBAApp.h" +#include "ShortcutController.h" +#include "Window.h" #include <QtAlgorithms> #include <QFile>

@@ -18,9 +20,10 @@ #include <QStringList>

using namespace QGBA; -BattleChipView::BattleChipView(std::shared_ptr<CoreController> controller, QWidget* parent) +BattleChipView::BattleChipView(std::shared_ptr<CoreController> controller, Window* window, QWidget* parent) : QDialog(parent) , m_controller(controller) + , m_window(window) { QResource::registerResource(GBAApp::dataDir() + "/chips.rcc"); QResource::registerResource(ConfigController::configDir() + "/chips.rcc");

@@ -126,6 +129,8 @@ m_frameCounter = UNINSERTED_TIME;

} else { insertChip(true); } + m_window->setWindowState(m_window->windowState() & ~Qt::WindowActive); + m_window->setWindowState(m_window->windowState() | Qt::WindowActive); } void BattleChipView::addChip() {
M src/platform/qt/BattleChipView.hsrc/platform/qt/BattleChipView.h

@@ -16,12 +16,13 @@

namespace QGBA { class CoreController; +class Window; class BattleChipView : public QDialog { Q_OBJECT public: - BattleChipView(std::shared_ptr<CoreController> controller, QWidget* parent = nullptr); + BattleChipView(std::shared_ptr<CoreController> controller, Window* window, QWidget* parent = nullptr); ~BattleChipView(); public slots:

@@ -52,6 +53,8 @@ int m_flavor;

int m_frameCounter = -1; bool m_next = false; + + Window* m_window; }; }
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -1370,7 +1370,7 @@ #endif

#ifdef M_CORE_GBA QAction* bcGate = new QAction(tr("BattleChip Gate..."), emulationMenu); - connect(bcGate, &QAction::triggered, openControllerTView<BattleChipView>()); + connect(bcGate, &QAction::triggered, openControllerTView<BattleChipView>(this)); addControlledAction(emulationMenu, bcGate, "bcGate"); m_gbaActions.append(bcGate); m_gameActions.append(bcGate);