From ef0065a49c5c42c4d18023132cd30312206af7ef Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 3 Jan 2026 15:34:55 +0000 Subject: [PATCH] MainWindow: Save tab mode immediately when changed The sidebar mode (tabs on top, large sidebar, etc.) was only being saved when the application exits normally. This caused the setting to be lost if the application crashed or was force-closed, reverting to the default "Large Sidebar" mode on next startup. This fix connects the FancyTabWidget::ModeChanged signal to immediately save the tab_mode setting when the user changes it via the context menu. Fixes issue where sidebar keeps periodically reverting to Large mode. Co-authored-by: jonaski <10343810+jonaski@users.noreply.github.com> --- src/core/mainwindow.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index ea66e1b85..0d6480835 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -447,6 +447,14 @@ MainWindow::MainWindow(Application *app, ui_->tabs->SetBackgroundPixmap(QPixmap(u":/pictures/sidebar-background.png"_s)); ui_->tabs->LoadSettings(QLatin1String(MainWindowSettings::kSettingsGroup)); + // Save tab mode immediately when changed to avoid losing the setting + QObject::connect(ui_->tabs, &FancyTabWidget::ModeChanged, this, [this](FancyTabWidget::Mode mode) { + Settings s; + s.beginGroup(MainWindowSettings::kSettingsGroup); + s.setValue("tab_mode", static_cast(mode)); + s.endGroup(); + }); + track_position_timer_->setInterval(kTrackPositionUpdateTimeMs); QObject::connect(track_position_timer_, &QTimer::timeout, this, &MainWindow::UpdateTrackPosition); track_slider_timer_->setInterval(kTrackSliderUpdateTimeMs);