diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-28 21:42:21 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-28 21:42:21 +1000 |
| commit | 1518b37b9b8fd5cbd6531d641d3d0679e2155be0 (patch) | |
| tree | 9a8b5e2f81e4acc7f7220cb507ef84ffb7055acc /modules/dashboard/Tabs.qml | |
| parent | picker: sort client rects (diff) | |
| download | caelestia-shell-1518b37b9b8fd5cbd6531d641d3d0679e2155be0.tar.gz caelestia-shell-1518b37b9b8fd5cbd6531d641d3d0679e2155be0.tar.bz2 caelestia-shell-1518b37b9b8fd5cbd6531d641d3d0679e2155be0.zip | |
dashboard: loader content
Diffstat (limited to 'modules/dashboard/Tabs.qml')
| -rw-r--r-- | modules/dashboard/Tabs.qml | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/modules/dashboard/Tabs.qml b/modules/dashboard/Tabs.qml index e6b59e7..b7aca5f 100644 --- a/modules/dashboard/Tabs.qml +++ b/modules/dashboard/Tabs.qml @@ -1,6 +1,9 @@ +pragma ComponentBehavior: Bound + import "root:/widgets" import "root:/services" import "root:/config" +import Quickshell import Quickshell.Widgets import QtQuick import QtQuick.Controls @@ -9,8 +12,8 @@ Item { id: root required property real nonAnimWidth - property alias currentIndex: bar.currentIndex - readonly property TabBar bar: bar + required property PersistentProperties state + readonly property alias count: bar.count implicitHeight: bar.implicitHeight + indicator.implicitHeight + indicator.anchors.topMargin + separator.implicitHeight @@ -21,6 +24,7 @@ Item { anchors.right: parent.right anchors.top: parent.top + currentIndex: root.state.currentTab background: null Tab { @@ -108,7 +112,7 @@ Item { cursorShape: Qt.PointingHandCursor onPressed: event => { - tab.TabBar.tabBar.setCurrentIndex(tab.TabBar.index); + root.state.currentTab = tab.TabBar.index; const stateY = stateWrapper.y; rippleAnim.x = event.x; @@ -122,9 +126,9 @@ Item { } onWheel: event => { if (event.angleDelta.y < 0) - tab.TabBar.tabBar.incrementCurrentIndex(); + root.state.currentTab = Math.min(root.state.currentTab + 1, bar.count - 1); else if (event.angleDelta.y > 0) - tab.TabBar.tabBar.decrementCurrentIndex(); + root.state.currentTab = Math.max(root.state.currentTab - 1, 0); } SequentialAnimation { |