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 real temperature: 0.5
} }
property JsonObject cheatsheet: JsonObject {
property int tabIndex: 0
}
property JsonObject sidebar: JsonObject { property JsonObject sidebar: JsonObject {
property JsonObject bottomGroup: JsonObject { property JsonObject bottomGroup: JsonObject {
property bool collapsed: false property bool collapsed: false
@@ -4,6 +4,7 @@ import qs.modules.common.widgets
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Qt.labs.synchronizer
import Qt5Compat.GraphicalEffects import Qt5Compat.GraphicalEffects
import Quickshell.Io import Quickshell.Io
import Quickshell import Quickshell
@@ -135,7 +136,10 @@ Scope { // Scope
ToolbarTabBar { ToolbarTabBar {
id: tabBar id: tabBar
tabButtonList: root.tabButtonList tabButtonList: root.tabButtonList
currentIndex: swipeView.currentIndex
Synchronizer on currentIndex {
property alias source: swipeView.currentIndex
}
} }
} }
@@ -144,8 +148,11 @@ Scope { // Scope
Layout.topMargin: 5 Layout.topMargin: 5
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
currentIndex: tabBar.currentIndex
spacing: 10 spacing: 10
currentIndex: Persistent.states.cheatsheet.tabIndex
onCurrentIndexChanged: {
Persistent.states.cheatsheet.tabIndex = currentIndex;
}
implicitWidth: Math.max.apply(null, contentChildren.map(child => child.implicitWidth || 0)) implicitWidth: Math.max.apply(null, contentChildren.map(child => child.implicitWidth || 0))
implicitHeight: Math.max.apply(null, contentChildren.map(child => child.implicitHeight || 0)) implicitHeight: Math.max.apply(null, contentChildren.map(child => child.implicitHeight || 0))