Merge pull request #6510 from spycrab/qt_autoadjust

Qt: Implement "Auto-Adjust Window Size"
This commit is contained in:
Léo Lam 2018-03-24 17:36:48 +01:00 committed by GitHub
commit 304aeaa922
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -115,9 +115,12 @@ void Host_UpdateProgressDialog(const char* caption, int position, int total)
void Host_UpdateMainFrame()
{
}
void Host_RequestRenderWindowSize(int w, int h)
{
emit Host::GetInstance()->RequestRenderSize(w, h);
}
bool Host_UINeedsControllerState()
{
return Settings::Instance().IsControllerStateNeeded();

View File

@ -5,6 +5,7 @@
#include <QKeyEvent>
#include <QTimer>
#include "Core/ConfigManager.h"
#include "DolphinQt2/Host.h"
#include "DolphinQt2/RenderWidget.h"
#include "DolphinQt2/Settings.h"
@ -15,6 +16,12 @@ RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent)
setAttribute(Qt::WA_NoSystemBackground, true);
connect(Host::GetInstance(), &Host::RequestTitle, this, &RenderWidget::setWindowTitle);
connect(Host::GetInstance(), &Host::RequestRenderSize, this, [this](int w, int h) {
if (!SConfig::GetInstance().bRenderWindowAutoSize || isFullScreen() || isMaximized())
return;
resize(w, h);
});
// We have to use Qt::DirectConnection here because we don't want those signals to get queued
// (which results in them not getting called)