Qt: Windows no longer spawn in the top left on first launch

This commit is contained in:
Jeffrey Pfau 2015-08-17 23:03:20 -07:00
parent 46cf812db3
commit 1f899737d9
2 changed files with 11 additions and 5 deletions

View File

@ -1,4 +1,6 @@
0.4.0: (Future)
Bugfixes:
- Qt: Windows no longer spawn in the top left on first launch
Misc:
- Qt: Window size command line options are now supported
- Qt: Increase usability of key mapper

View File

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "Window.h"
#include <QDesktopWidget>
#include <QKeyEvent>
#include <QKeySequence>
#include <QMenuBar>
@ -88,11 +89,6 @@ Window::Window(ConfigController* config, int playerId, QWidget* parent)
m_screenWidget->setLockAspectRatio(m_logo.width(), m_logo.height());
setCentralWidget(m_screenWidget);
QVariant windowPos = m_config->getQtOption("windowPos");
if (!windowPos.isNull()) {
move(windowPos.toPoint());
}
connect(m_controller, SIGNAL(gameStarted(GBAThread*)), this, SLOT(gameStarted(GBAThread*)));
connect(m_controller, SIGNAL(gameStarted(GBAThread*)), &m_inputController, SLOT(suspendScreensaver()));
connect(m_controller, SIGNAL(gameStopped(GBAThread*)), m_display, SLOT(stopDrawing()));
@ -465,6 +461,14 @@ void Window::resizeEvent(QResizeEvent* event) {
void Window::showEvent(QShowEvent* event) {
resizeFrame(m_screenWidget->sizeHint().width(), m_screenWidget->sizeHint().height());
QVariant windowPos = m_config->getQtOption("windowPos");
if (!windowPos.isNull()) {
move(windowPos.toPoint());
} else {
QRect rect = frameGeometry();
rect.moveCenter(QApplication::desktop()->availableGeometry().center());
move(rect.topLeft());
}
}
void Window::closeEvent(QCloseEvent* event) {