mirror of https://github.com/mgba-emu/mgba.git
Qt: Better window size handling
This commit is contained in:
parent
a1808a2387
commit
742296b8b9
|
@ -51,10 +51,6 @@ GBAApp::GBAApp(int& argc, char* argv[])
|
||||||
});
|
});
|
||||||
m_windows[0] = w;
|
m_windows[0] = w;
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
|
||||||
w->show();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GBAArguments args;
|
GBAArguments args;
|
||||||
if (m_configController.parseArguments(&args, argc, argv)) {
|
if (m_configController.parseArguments(&args, argc, argv)) {
|
||||||
w->argumentsPassed(&args);
|
w->argumentsPassed(&args);
|
||||||
|
@ -62,14 +58,12 @@ GBAApp::GBAApp(int& argc, char* argv[])
|
||||||
w->loadConfig();
|
w->loadConfig();
|
||||||
}
|
}
|
||||||
freeArguments(&args);
|
freeArguments(&args);
|
||||||
|
w->show();
|
||||||
|
|
||||||
AudioProcessor::setDriver(static_cast<AudioProcessor::Driver>(m_configController.getQtOption("audioDriver").toInt()));
|
AudioProcessor::setDriver(static_cast<AudioProcessor::Driver>(m_configController.getQtOption("audioDriver").toInt()));
|
||||||
w->controller()->reloadAudioDriver();
|
w->controller()->reloadAudioDriver();
|
||||||
|
|
||||||
w->controller()->setMultiplayerController(&m_multiplayer);
|
w->controller()->setMultiplayerController(&m_multiplayer);
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
w->show();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GBAApp::event(QEvent* event) {
|
bool GBAApp::event(QEvent* event) {
|
||||||
|
@ -91,14 +85,9 @@ Window* GBAApp::newWindow() {
|
||||||
});
|
});
|
||||||
m_windows[windowId] = w;
|
m_windows[windowId] = w;
|
||||||
w->setAttribute(Qt::WA_DeleteOnClose);
|
w->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
#ifndef Q_OS_MAC
|
|
||||||
w->show();
|
|
||||||
#endif
|
|
||||||
w->loadConfig();
|
w->loadConfig();
|
||||||
w->controller()->setMultiplayerController(&m_multiplayer);
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
w->show();
|
w->show();
|
||||||
#endif
|
w->controller()->setMultiplayerController(&m_multiplayer);
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -172,6 +172,7 @@ void Window::argumentsPassed(GBAArguments* args) {
|
||||||
|
|
||||||
void Window::resizeFrame(int width, int height) {
|
void Window::resizeFrame(int width, int height) {
|
||||||
QSize newSize(width, height);
|
QSize newSize(width, height);
|
||||||
|
m_screenWidget->setSizeHint(newSize);
|
||||||
newSize -= m_screenWidget->size();
|
newSize -= m_screenWidget->size();
|
||||||
newSize += size();
|
newSize += size();
|
||||||
resize(newSize);
|
resize(newSize);
|
||||||
|
@ -434,6 +435,10 @@ void Window::resizeEvent(QResizeEvent*) {
|
||||||
m_config->setOption("fullscreen", isFullScreen());
|
m_config->setOption("fullscreen", isFullScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Window::showEvent(QShowEvent* event) {
|
||||||
|
resizeFrame(m_screenWidget->sizeHint().width(), m_screenWidget->sizeHint().height());
|
||||||
|
}
|
||||||
|
|
||||||
void Window::closeEvent(QCloseEvent* event) {
|
void Window::closeEvent(QCloseEvent* event) {
|
||||||
emit shutdown();
|
emit shutdown();
|
||||||
m_config->setQtOption("windowPos", pos());
|
m_config->setQtOption("windowPos", pos());
|
||||||
|
|
|
@ -104,6 +104,7 @@ protected:
|
||||||
virtual void keyPressEvent(QKeyEvent* event) override;
|
virtual void keyPressEvent(QKeyEvent* event) override;
|
||||||
virtual void keyReleaseEvent(QKeyEvent* event) override;
|
virtual void keyReleaseEvent(QKeyEvent* event) override;
|
||||||
virtual void resizeEvent(QResizeEvent*) override;
|
virtual void resizeEvent(QResizeEvent*) override;
|
||||||
|
virtual void showEvent(QShowEvent*) override;
|
||||||
virtual void closeEvent(QCloseEvent*) override;
|
virtual void closeEvent(QCloseEvent*) override;
|
||||||
virtual void focusInEvent(QFocusEvent*) override;
|
virtual void focusInEvent(QFocusEvent*) override;
|
||||||
virtual void focusOutEvent(QFocusEvent*) override;
|
virtual void focusOutEvent(QFocusEvent*) override;
|
||||||
|
|
Loading…
Reference in New Issue