Qt, Config controls system: Remove signal block so signals can refresh the enabled status of certain options when a new config is loaded (such as on starting a game). Blocks previously unwanted behavior with a new safety check.

QCheckBox::toggled and other similar signals are used to save changes and to update widget status (such as enabled).. OnConfigChanged needs to load new values and trigger widget updates, but the new value shouldn't trigger a save. A save is unnecessary (the config has the correct values and the UI is being updated to those values) and it'd trigger another ConfigChanged signal.   This commit blocks the save without blocking the signal entirely.
This commit is contained in:
TryTwo
2025-01-02 03:04:13 -07:00
parent b8921b1338
commit 5395f21ae5
3 changed files with 14 additions and 4 deletions

View File

@ -232,7 +232,10 @@ void GeneralWidget::OnEmulationStateChanged(bool running)
std::string current_backend = m_backend_combo->currentData().toString().toStdString();
if (Config::Get(Config::MAIN_GFX_BACKEND) != current_backend)
{
m_backend_combo->Load();
{
const QSignalBlocker blocker(m_backend_combo);
m_backend_combo->Load();
}
emit BackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)));
}
}