feat(settings): when switching settings panel mode, close and reopen the settings to see the actual change

This commit is contained in:
Lemmy
2026-03-28 16:01:32 -04:00
parent a5fc309880
commit 1e068156ad
2 changed files with 22 additions and 2 deletions
@@ -38,6 +38,10 @@ FloatingWindow {
settingsContent._pendingSubTab = subTabId;
settingsContent.initialize();
isInitialized = true;
// Tab content persists in window mode; if no subtab specified and the
// tab content is still loaded (same tab), reset to first subtab
if (subTabId < 0 && settingsContent.activeTabContent)
settingsContent.setSubTabIndex(0);
}
}
@@ -3,6 +3,8 @@ import QtQuick.Controls
import QtQuick.Layouts
import Quickshell
import qs.Commons
import qs.Modules.Panels.Settings // For SettingsPanel
import qs.Services.UI
import qs.Widgets
ColumnLayout {
@@ -67,6 +69,7 @@ ColumnLayout {
label: I18n.tr("panels.user-interface.settings-panel-mode-label")
description: I18n.tr("panels.user-interface.settings-panel-mode-description")
Layout.fillWidth: true
minimumWidth: 220 * Style.uiScaleRatio
model: [
{
"key": "attached",
@@ -83,8 +86,21 @@ ColumnLayout {
]
currentKey: Settings.data.ui.settingsPanelMode
defaultValue: Settings.getDefaultValue("ui.settingsPanelMode")
onSelected: key => Settings.data.ui.settingsPanelMode = key
minimumWidth: 220 * Style.uiScaleRatio
onSelected: key => {
// Defer setup to next update so close can do its work properly
Qt.callLater(() => {
Settings.data.ui.settingsPanelMode = key;
});
if (Settings.data.ui.settingsPanelMode === "window" || key === "window") {
// Just switched from/to window, need to close panel
var screen = PanelService.openedPanel?.screen || SettingsPanelService.settingsWindow?.screen || PanelService.findScreenForPanels();
SettingsPanelService.close(screen);
Qt.callLater(() => {
SettingsPanelService.openToTab(SettingsPanel.Tab.UserInterface, 1, screen);
});
}
}
}
NToggle {