From 3e0b78149b09303a9b68da8282cdf8a652e16697 Mon Sep 17 00:00:00 2001 From: uncor3 Date: Fri, 22 May 2026 12:13:11 +0000 Subject: [PATCH] move Windows SibebarTabButton into windows subfolder --- src/ui/SidebarTabButton.qml | 39 ++----------- src/ui/wIndows/SidebarTabButton.qml | 89 +++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 33 deletions(-) create mode 100644 src/ui/wIndows/SidebarTabButton.qml diff --git a/src/ui/SidebarTabButton.qml b/src/ui/SidebarTabButton.qml index 2fec1ff..04bcf24 100644 --- a/src/ui/SidebarTabButton.qml +++ b/src/ui/SidebarTabButton.qml @@ -1,10 +1,8 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 -import FluentUI - -FluExpander { +Item { id: root property int currentSection : 1 signal sectionChanged(int sectionIndex) @@ -18,18 +16,9 @@ FluExpander { } implicitWidth: 200 - contentHeight : 40 * 4 + 40 + // contentHeight : 40 * 4 + 40 - headerDelegate: Component { - Item { - FluToggleButton { - anchors.centerIn: parent - text: qsTr("TODO") - } - } - } - - content: Item { + Item { anchors.fill: parent ListView { @@ -43,23 +32,7 @@ FluExpander { interactive: false boundsBehavior: ListView.StopAtBounds currentIndex : root.currentSection - highlightMoveDuration: FluTheme.animationEnabled ? 167 : 0 - highlight: Item{ - z:99 - clip: true - Rectangle{ - height: 18 - radius: 1.5 - color: FluTheme.primaryColor - width: 3 - anchors{ - verticalCenter: parent.verticalCenter - left: parent.left - leftMargin: 6 - } - } - } - delegate: FluButton { + delegate: Button { text: name width: nav_list.width height: 40 @@ -68,10 +41,10 @@ FluExpander { background : Rectangle { color : { if (nav_list.currentIndex == index) { - return FluTheme.itemCheckColor + return "blue" } if (hovered) { - return FluTheme.itemHoverColor + return "red" } return "transparent" diff --git a/src/ui/wIndows/SidebarTabButton.qml b/src/ui/wIndows/SidebarTabButton.qml new file mode 100644 index 0000000..2fec1ff --- /dev/null +++ b/src/ui/wIndows/SidebarTabButton.qml @@ -0,0 +1,89 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Layouts 1.15 +import FluentUI + + +FluExpander { + id: root + property int currentSection : 1 + signal sectionChanged(int sectionIndex) + + ListModel { + id: nav_model + ListElement { name: qsTr("Info"); sectionIndex: 0 } + ListElement { name: qsTr("Apps"); sectionIndex: 1 } + ListElement { name: qsTr("Gallery"); sectionIndex: 2 } + ListElement { name: qsTr("Files"); sectionIndex: 3 } + } + + implicitWidth: 200 + contentHeight : 40 * 4 + 40 + + headerDelegate: Component { + Item { + FluToggleButton { + anchors.centerIn: parent + text: qsTr("TODO") + } + } + } + + content: Item { + anchors.fill: parent + + ListView { + id: nav_list + anchors.fill: parent + anchors.margins : 10 + clip: true + spacing : 5 + + model: nav_model + interactive: false + boundsBehavior: ListView.StopAtBounds + currentIndex : root.currentSection + highlightMoveDuration: FluTheme.animationEnabled ? 167 : 0 + highlight: Item{ + z:99 + clip: true + Rectangle{ + height: 18 + radius: 1.5 + color: FluTheme.primaryColor + width: 3 + anchors{ + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: 6 + } + } + } + delegate: FluButton { + text: name + width: nav_list.width + height: 40 + // verticalPadding: 5 + // horizontalPadding:20 + background : Rectangle { + color : { + if (nav_list.currentIndex == index) { + return FluTheme.itemCheckColor + } + if (hovered) { + return FluTheme.itemHoverColor + } + + return "transparent" + } + radius : 4 + + } + onClicked : { + nav_list.currentIndex = index + root.sectionChanged(sectionIndex) + } + } + } + } +}