persistent cheatsheet tabs (closes #2681)

This commit is contained in:
end-4
2025-12-14 10:47:53 +01:00
parent f91ca59fb6
commit f1fdb941e1
2 changed files with 13 additions and 2 deletions
@@ -63,6 +63,10 @@ Singleton {
property real temperature: 0.5
}
property JsonObject cheatsheet: JsonObject {
property int tabIndex: 0
}
property JsonObject sidebar: JsonObject {
property JsonObject bottomGroup: JsonObject {
property bool collapsed: false
@@ -4,6 +4,7 @@ import qs.modules.common.widgets
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Qt.labs.synchronizer
import Qt5Compat.GraphicalEffects
import Quickshell.Io
import Quickshell
@@ -135,7 +136,10 @@ Scope { // Scope
ToolbarTabBar {
id: tabBar
tabButtonList: root.tabButtonList
currentIndex: swipeView.currentIndex
Synchronizer on currentIndex {
property alias source: swipeView.currentIndex
}
}
}
@@ -144,8 +148,11 @@ Scope { // Scope
Layout.topMargin: 5
Layout.fillWidth: true
Layout.fillHeight: true
currentIndex: tabBar.currentIndex
spacing: 10
currentIndex: Persistent.states.cheatsheet.tabIndex
onCurrentIndexChanged: {
Persistent.states.cheatsheet.tabIndex = currentIndex;
}
implicitWidth: Math.max.apply(null, contentChildren.map(child => child.implicitWidth || 0))
implicitHeight: Math.max.apply(null, contentChildren.map(child => child.implicitHeight || 0))