From 206669e5f022cfb19c49c75c385ccea3393286a9 Mon Sep 17 00:00:00 2001 From: zhuzihcu Date: Tue, 4 Apr 2023 15:09:34 +0800 Subject: [PATCH] update --- example/T_Pivot.qml | 51 ++++++++++++++ example/global/ItemsOriginal.qml | 11 +++ example/qml.qrc | 1 + src/Fluent.cpp | 2 + src/controls/FluMediaPlayer.qml | 2 - src/controls/FluNavigationView.qml | 25 ++++--- src/controls/FluPivot.qml | 104 +++++++++++++++++++++++++++++ src/controls/FluPivotItem.qml | 8 +++ src/res.qrc | 2 + 9 files changed, 193 insertions(+), 13 deletions(-) create mode 100644 example/T_Pivot.qml create mode 100644 src/controls/FluPivot.qml create mode 100644 src/controls/FluPivotItem.qml diff --git a/example/T_Pivot.qml b/example/T_Pivot.qml new file mode 100644 index 00000000..7e5534f1 --- /dev/null +++ b/example/T_Pivot.qml @@ -0,0 +1,51 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtQuick.Window +import FluentUI + +FluScrollablePage{ + + title:"Pivot" + leftPadding:10 + rightPadding:10 + bottomPadding:20 + + + FluArea{ + Layout.fillWidth: true + Layout.topMargin: 20 + height: 400 + paddings: 10 + + FluPivot{ + anchors.fill: parent + FluPivotItem{ + title:"All" + contentItem:FluText{ + text:"All emails go here." + } + } + FluPivotItem{ + title:"Unread" + contentItem:FluText{ + text:"Unread emails go here." + } + } + FluPivotItem{ + title:"Flagged" + contentItem:FluText{ + text:"Flagged emails go here." + } + } + FluPivotItem{ + title:"Urgent" + contentItem:FluText{ + text:"Urgent emails go here." + } + } + } + } + + +} diff --git a/example/global/ItemsOriginal.qml b/example/global/ItemsOriginal.qml index fa1fabe8..d414a3e6 100644 --- a/example/global/ItemsOriginal.qml +++ b/example/global/ItemsOriginal.qml @@ -172,6 +172,17 @@ FluObject{ FluPaneItemExpander{ title:"Navigation" icon:FluentIcons.AllApps + + FluPaneItem{ + title:"Pivot" + image:"qrc:/res/image/control/Pivot.png" + recentlyAdded:true + order:3 + desc:"Presents information from different sources in atabbed view." + onTap:{ + navigationView.push("qrc:/T_Pivot.qml") + } + } FluPaneItem{ title:"TabView" image:"qrc:/res/image/control/TabView.png" diff --git a/example/qml.qrc b/example/qml.qrc index 8c85501d..d58eeb62 100644 --- a/example/qml.qrc +++ b/example/qml.qrc @@ -154,5 +154,6 @@ global/ItemsFooter.qml page/MediaPage.qml T_FlipView.qml + T_Pivot.qml diff --git a/src/Fluent.cpp b/src/Fluent.cpp index 9abfab55..b6c59bd9 100644 --- a/src/Fluent.cpp +++ b/src/Fluent.cpp @@ -33,6 +33,8 @@ void Fluent::registerTypes(const char *uri){ qmlRegisterType(uri,major,minor,"WindowHelper"); qmlRegisterType(uri,major,minor,"FluColorSet"); + qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPivotItem.qml"),uri,major,minor,"FluPivotItem"); + qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPivot.qml"),uri,major,minor,"FluPivot"); qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluFlipView.qml"),uri,major,minor,"FluFlipView"); qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPaneItemExpander.qml"),uri,major,minor,"FluPaneItemExpander"); qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTabView.qml"),uri,major,minor,"FluTabView"); diff --git a/src/controls/FluMediaPlayer.qml b/src/controls/FluMediaPlayer.qml index 12b8e801..b6cc1456 100644 --- a/src/controls/FluMediaPlayer.qml +++ b/src/controls/FluMediaPlayer.qml @@ -121,7 +121,6 @@ Rectangle { text: formatDuration(slider.value*mediaplayer.duration/slider.maxValue) } - FluText{ id:end_time anchors{ @@ -132,7 +131,6 @@ Rectangle { text: formatDuration(mediaplayer.duration) } - Row{ spacing: 10 anchors{ diff --git a/src/controls/FluNavigationView.qml b/src/controls/FluNavigationView.qml index 749b148e..567174d8 100644 --- a/src/controls/FluNavigationView.qml +++ b/src/controls/FluNavigationView.qml @@ -227,16 +227,6 @@ Item { leftMargin: 6 rightMargin: 6 } - Rectangle{ - width: 3 - height: 18 - radius: 1.5 - color: FluTheme.primaryColor.dark - visible: nav_list.currentIndex === position && type===0 - anchors{ - verticalCenter: parent.verticalCenter - } - } MouseArea{ id:item_mouse hoverEnabled: true @@ -468,8 +458,21 @@ Item { stackIndex.push(currentIndex) } } + highlight: Item{ + clip: true + Rectangle{ + height: 18 + radius: 1.5 + color: FluTheme.primaryColor.dark + width: 3 + anchors{ + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: 6 + } + } + } ScrollBar.vertical: FluScrollBar {} - model:handleItems() delegate: Loader{ property var model: modelData diff --git a/src/controls/FluPivot.qml b/src/controls/FluPivot.qml new file mode 100644 index 00000000..70915568 --- /dev/null +++ b/src/controls/FluPivot.qml @@ -0,0 +1,104 @@ +import QtQuick +import QtQuick.Controls +import FluentUI + +Item { + + + id:control + default property alias content: d.children + property color normalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120 + property color hoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black + + + width: 400 + height: 300 + + FluObject{ + id:d + } + + Component.onCompleted: { + for(var i =0 ;i controls/FluTextBoxMenu.qml controls/FluMultilineTextBox.qml controls/FluFlipView.qml + controls/FluPivot.qml + controls/FluPivotItem.qml