Qt: Fix "Render To Main"

This commit is contained in:
spycrab 2018-05-06 04:42:23 +02:00
parent 2588b5e40e
commit 6f65238efc
2 changed files with 10 additions and 2 deletions

View File

@ -212,6 +212,8 @@ void GeneralWidget::SaveSettings()
SConfig::GetInstance().bFullscreen = m_enable_fullscreen->isChecked(); SConfig::GetInstance().bFullscreen = m_enable_fullscreen->isChecked();
// Autoadjust window size // Autoadjust window size
SConfig::GetInstance().bRenderWindowAutoSize = m_autoadjust_window_size->isChecked(); SConfig::GetInstance().bRenderWindowAutoSize = m_autoadjust_window_size->isChecked();
// Render To Main
SConfig::GetInstance().bRenderToMain = m_render_main_window->isChecked();
} }
void GeneralWidget::OnEmulationStateChanged(bool running) void GeneralWidget::OnEmulationStateChanged(bool running)

View File

@ -158,8 +158,14 @@ bool RenderWidget::event(QEvent* event)
const QResizeEvent* se = static_cast<QResizeEvent*>(event); const QResizeEvent* se = static_cast<QResizeEvent*>(event);
QSize new_size = se->size(); QSize new_size = se->size();
const auto dpr = auto* desktop = QApplication::desktop();
QGuiApplication::screens()[QApplication::desktop()->screenNumber(this)]->devicePixelRatio();
int screen_nr = desktop->screenNumber(this);
if (screen_nr == -1)
screen_nr = desktop->screenNumber(parentWidget());
const auto dpr = desktop->screen(screen_nr)->devicePixelRatio();
emit SizeChanged(new_size.width() * dpr, new_size.height() * dpr); emit SizeChanged(new_size.width() * dpr, new_size.height() * dpr);
break; break;