Qt: Kick focus back to main window when clicking a chip

This commit is contained in:
Vicki Pfau 2019-02-22 18:45:54 -08:00
parent 475c7790c5
commit b4698ab638
3 changed files with 11 additions and 3 deletions

View File

@ -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 @@
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 @@ void BattleChipView::reinsert() {
} else {
insertChip(true);
}
m_window->setWindowState(m_window->windowState() & ~Qt::WindowActive);
m_window->setWindowState(m_window->windowState() | Qt::WindowActive);
}
void BattleChipView::addChip() {

View File

@ -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 @@ private:
int m_frameCounter = -1;
bool m_next = false;
Window* m_window;
};
}

View File

@ -1370,7 +1370,7 @@ void Window::setupMenu(QMenuBar* menubar) {
#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);