From 5ca2b1200dba1e397681a9320cba5874a4b4a322 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Fri, 30 Oct 2020 23:37:48 +0100 Subject: [PATCH] Qt: Fix Resolution combobox default value --- rpcs3/rpcs3qt/settings_dialog.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index 690fa72db2..0b200e04da 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -342,16 +342,22 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std } } } - const int res_index = ui->resBox->findData("1280x720"); - if (res_index >= 0) + for (int i = 0; i < ui->resBox->count(); i++) { - // Rename the default resolution for users - ui->resBox->setItemText(res_index, tr("1280x720 (Recommended)", "Resolution")); + const QVariantList var_list = ui->resBox->itemData(i).toList(); + ASSERT(var_list.size() == 2 && var_list[0].canConvert()); - // Set the current selection to the default if the original setting wasn't valid - if (saved_index_removed) + if (var_list[0].toString() == "1280x720") { - ui->resBox->setCurrentIndex(res_index); + // Rename the default resolution for users + ui->resBox->setItemText(i, tr("1280x720 (Recommended)", "Resolution")); + + // Set the current selection to the default if the original setting wasn't valid + if (saved_index_removed) + { + ui->resBox->setCurrentIndex(i); + } + break; } }