Gui: Save previous default for overlay widgets

For some reason the empty layout was not saved for users with existing
config. To ensure that the change does not affect existing users and is
persistent for current ones we need to save value with older default
before using it. Previous solution did not work correctly as the widgets
were not persisted correctly.
This commit is contained in:
Kacper Donat
2025-11-12 18:03:06 +01:00
committed by Chris Hennes
parent 4b50d72769
commit eb1e0d7f11

View File

@@ -801,14 +801,14 @@ void OverlayTabWidget::restore(ParameterGrp::handle handle)
return;
}
const char* defaultWidgets = "";
// If overlay was ever used and disabled by the user it should respect that choice
if (handle->GetInt("Width", 0) == 0 || handle->GetInt("Height", 0) == 0) {
defaultWidgets = getDockArea() == Qt::RightDockWidgetArea ? "Tasks," : "";
if (handle->GetInt("Width", 0) != 0 || handle->GetInt("Height", 0) != 0) {
// save current value with old default to prevent layout change
handle->SetASCII("Widgets", handle->GetASCII("Widgets", ""));
}
std::string widgets = handle->GetASCII("Widgets", defaultWidgets);
std::string widgets
= handle->GetASCII("Widgets", getDockArea() == Qt::RightDockWidgetArea ? "Tasks," : "");
for (auto& name : QString::fromUtf8(widgets.c_str()).split(QLatin1Char(','))) {
if (name.isEmpty()) {