From c7beac5efd10ddc0f6241fac77052af939352170 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 16 May 2021 03:23:53 +1000 Subject: [PATCH] Qt: Remove setting when string value is empty --- src/duckstation-qt/settingwidgetbinder.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/duckstation-qt/settingwidgetbinder.h b/src/duckstation-qt/settingwidgetbinder.h index 876b15afa..635f2f2d4 100644 --- a/src/duckstation-qt/settingwidgetbinder.h +++ b/src/duckstation-qt/settingwidgetbinder.h @@ -279,7 +279,11 @@ void BindWidgetToStringSetting(QtHostInterface* hi, WidgetType* widget, std::str Accessor::connectValueChanged(widget, [hi, widget, section, key]() { const QString new_value = Accessor::getStringValue(widget); - hi->SetStringSettingValue(section.c_str(), key.c_str(), new_value.toUtf8().constData()); + if (!new_value.isEmpty()) + hi->SetStringSettingValue(section.c_str(), key.c_str(), new_value.toUtf8().constData()); + else + hi->RemoveSettingValue(section.c_str(), key.c_str()); + hi->applySettings(); }); }