DEV9: Use a signal blocker instead of disconnecting signal

This commit is contained in:
TheLastRar 2024-04-16 20:39:01 +01:00 committed by Connor McLaughlin
parent 5af5fe8387
commit cd907584ee
1 changed files with 2 additions and 3 deletions

View File

@ -836,8 +836,8 @@ void DEV9SettingsWidget::showEvent(QShowEvent* event)
//This means that this setting can get out of sync with true value, so revert to that if the ui is closed and opened //This means that this setting can get out of sync with true value, so revert to that if the ui is closed and opened
const std::string value = m_dialog->getStringValue("DEV9/Eth", "EthApi", Pcsx2Config::DEV9Options::NetApiNames[static_cast<int>(Pcsx2Config::DEV9Options::NetApi::Unset)]).value(); const std::string value = m_dialog->getStringValue("DEV9/Eth", "EthApi", Pcsx2Config::DEV9Options::NetApiNames[static_cast<int>(Pcsx2Config::DEV9Options::NetApi::Unset)]).value();
//disconnect temporally to prevent saving a vaule already in the config file //SignalBlocker to prevent saving a value already in the config file
disconnect(m_ui.ethDev, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DEV9SettingsWidget::onEthDeviceChanged); QSignalBlocker sb(m_ui.ethDev);
for (int i = 0; m_api_namelist[i] != nullptr; i++) for (int i = 0; m_api_namelist[i] != nullptr; i++)
{ {
if (value == m_api_valuelist[i]) if (value == m_api_valuelist[i])
@ -846,7 +846,6 @@ void DEV9SettingsWidget::showEvent(QShowEvent* event)
break; break;
} }
} }
connect(m_ui.ethDev, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DEV9SettingsWidget::onEthDeviceChanged);
} }
/* /*