From e922f91cc3e33ceb63e09881d8679820a63b66a7 Mon Sep 17 00:00:00 2001 From: spycrab Date: Mon, 14 May 2018 21:09:43 +0200 Subject: [PATCH] Qt/GeneralWidget: Restore the adapter properly --- .../DolphinQt2/Config/Graphics/GeneralWidget.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinQt2/Config/Graphics/GeneralWidget.cpp b/Source/Core/DolphinQt2/Config/Graphics/GeneralWidget.cpp index 6053420ed9..b9b5cfa3e3 100644 --- a/Source/Core/DolphinQt2/Config/Graphics/GeneralWidget.cpp +++ b/Source/Core/DolphinQt2/Config/Graphics/GeneralWidget.cpp @@ -131,7 +131,12 @@ void GeneralWidget::ConnectWidgets() { // Video Backend connect(m_backend_combo, static_cast(&QComboBox::currentIndexChanged), - [this](int) { SaveSettings(); }); + this, &GeneralWidget::SaveSettings); + connect(m_adapter_combo, static_cast(&QComboBox::currentIndexChanged), + this, [](int index) { + g_Config.iAdapter = index; + Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index); + }); for (QCheckBox* checkbox : {m_enable_fullscreen, m_render_main_window, m_autoadjust_window_size}) connect(checkbox, &QCheckBox::toggled, this, &GeneralWidget::SaveSettings); @@ -163,8 +168,6 @@ void GeneralWidget::LoadSettings() void GeneralWidget::SaveSettings() { - g_Config.iAdapter = m_adapter_combo->currentIndex(); - // Video Backend for (const auto& backend : g_available_video_backends) { @@ -329,6 +332,8 @@ void GeneralWidget::OnBackendChanged(const QString& backend_name) } } + const bool old = m_adapter_combo->blockSignals(true); + m_adapter_combo->clear(); const auto& adapters = g_Config.backend_info.Adapters; @@ -338,4 +343,6 @@ void GeneralWidget::OnBackendChanged(const QString& backend_name) m_adapter_combo->setCurrentIndex(g_Config.iAdapter); m_adapter_combo->setEnabled(!adapters.empty()); + + m_adapter_combo->blockSignals(old); }