Qt: Fix issue with set frame sizes being the wrong height

This commit is contained in:
Jeffrey Pfau 2014-12-16 00:21:29 -08:00
parent fcac245b98
commit 1ee69deffb
3 changed files with 16 additions and 4 deletions

View File

@ -1,5 +1,8 @@
0.2.0: (Future) 0.2.0: (Future)
Features:
- Support for gamepad axes, e.g. analog sticks or triggers - Support for gamepad axes, e.g. analog sticks or triggers
Bugfixes:
- Qt: Fix issue with set frame sizes being the wrong height
0.1.0: (2014-12-13) 0.1.0: (2014-12-13)
- Initial release - Initial release

View File

@ -114,6 +114,13 @@ void Window::argumentsPassed(GBAArguments* args) {
} }
} }
void Window::resizeFrame(int width, int height) {
QSize newSize(width, height);
newSize -= m_screenWidget->size();
newSize += size();
resize(newSize);
}
void Window::setConfig(ConfigController* config) { void Window::setConfig(ConfigController* config) {
m_config = config; m_config = config;
} }
@ -479,25 +486,25 @@ void Window::setupMenu(QMenuBar* menubar) {
QAction* setSize = new QAction(tr("1x"), avMenu); QAction* setSize = new QAction(tr("1x"), avMenu);
connect(setSize, &QAction::triggered, [this]() { connect(setSize, &QAction::triggered, [this]() {
showNormal(); showNormal();
resize(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS); resizeFrame(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
}); });
frameMenu->addAction(setSize); frameMenu->addAction(setSize);
setSize = new QAction(tr("2x"), avMenu); setSize = new QAction(tr("2x"), avMenu);
connect(setSize, &QAction::triggered, [this]() { connect(setSize, &QAction::triggered, [this]() {
showNormal(); showNormal();
resize(VIDEO_HORIZONTAL_PIXELS * 2, VIDEO_VERTICAL_PIXELS * 2); resizeFrame(VIDEO_HORIZONTAL_PIXELS * 2, VIDEO_VERTICAL_PIXELS * 2);
}); });
frameMenu->addAction(setSize); frameMenu->addAction(setSize);
setSize = new QAction(tr("3x"), avMenu); setSize = new QAction(tr("3x"), avMenu);
connect(setSize, &QAction::triggered, [this]() { connect(setSize, &QAction::triggered, [this]() {
showNormal(); showNormal();
resize(VIDEO_HORIZONTAL_PIXELS * 3, VIDEO_VERTICAL_PIXELS * 3); resizeFrame(VIDEO_HORIZONTAL_PIXELS * 3, VIDEO_VERTICAL_PIXELS * 3);
}); });
frameMenu->addAction(setSize); frameMenu->addAction(setSize);
setSize = new QAction(tr("4x"), avMenu); setSize = new QAction(tr("4x"), avMenu);
connect(setSize, &QAction::triggered, [this]() { connect(setSize, &QAction::triggered, [this]() {
showNormal(); showNormal();
resize(VIDEO_HORIZONTAL_PIXELS * 4, VIDEO_VERTICAL_PIXELS * 4); resizeFrame(VIDEO_HORIZONTAL_PIXELS * 4, VIDEO_VERTICAL_PIXELS * 4);
}); });
frameMenu->addAction(setSize); frameMenu->addAction(setSize);
addAction(frameMenu->addAction(tr("Fullscreen"), this, SLOT(toggleFullScreen()), QKeySequence("Ctrl+F"))); addAction(frameMenu->addAction(tr("Fullscreen"), this, SLOT(toggleFullScreen()), QKeySequence("Ctrl+F")));

View File

@ -44,6 +44,8 @@ public:
void setConfig(ConfigController*); void setConfig(ConfigController*);
void argumentsPassed(GBAArguments*); void argumentsPassed(GBAArguments*);
void resizeFrame(int width, int height);
signals: signals:
void startDrawing(const uint32_t*, GBAThread*); void startDrawing(const uint32_t*, GBAThread*);
void shutdown(); void shutdown();