From b99610f1a3b8714d716c206e25310132de8839eb Mon Sep 17 00:00:00 2001 From: spycrab Date: Wed, 2 May 2018 19:14:38 +0200 Subject: [PATCH] Qt/GeneralWidget: Fix empty adapter option --- Source/Core/DolphinQt2/Config/Graphics/GeneralWidget.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinQt2/Config/Graphics/GeneralWidget.cpp b/Source/Core/DolphinQt2/Config/Graphics/GeneralWidget.cpp index a39eee7976..b805933bf6 100644 --- a/Source/Core/DolphinQt2/Config/Graphics/GeneralWidget.cpp +++ b/Source/Core/DolphinQt2/Config/Graphics/GeneralWidget.cpp @@ -52,7 +52,7 @@ void GeneralWidget::CreateWidgets() m_aspect_combo = new GraphicsChoice({tr("Auto"), tr("Force 16:9"), tr("Force 4:3"), tr("Stretch to Window")}, Config::GFX_ASPECT_RATIO); - m_adapter_combo = new GraphicsChoice({}, Config::GFX_ADAPTER); + m_adapter_combo = new QComboBox; m_enable_vsync = new GraphicsBool(tr("V-Sync"), Config::GFX_VSYNC); m_enable_fullscreen = new QCheckBox(tr("Use Fullscreen")); @@ -311,6 +311,7 @@ void GeneralWidget::AddDescriptions() AddDescription(m_shader_compilation_mode[3], TR_SHADER_COMPILE_ASYNC_SKIP_DESCRIPTION); AddDescription(m_wait_for_shaders, TR_SHADER_COMPILE_BEFORE_START_DESCRIPTION); } + void GeneralWidget::OnBackendChanged(const QString& backend_name) { for (const auto& backend : g_available_video_backends) @@ -325,9 +326,11 @@ void GeneralWidget::OnBackendChanged(const QString& backend_name) m_adapter_combo->clear(); - for (const auto& adapter : g_Config.backend_info.Adapters) + const auto& adapters = g_Config.backend_info.Adapters; + + for (const auto& adapter : adapters) m_adapter_combo->addItem(QString::fromStdString(adapter)); m_adapter_combo->setCurrentIndex(g_Config.iAdapter); - m_adapter_combo->setEnabled(g_Config.backend_info.Adapters.size()); + m_adapter_combo->setEnabled(!adapters.empty()); }