| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- import QtQuick
- import QtQuick.Controls
- import FluentUI
- Item {
- default property alias content: d.children
- property alias currentIndex: nav_list.currentIndex
- property color normalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120
- property color hoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black
- id:control
- width: 400
- height: 300
- implicitHeight: height
- implicitWidth: width
- MouseArea{
- anchors.fill: parent
- preventStealing: true
- }
- FluObject{
- id:d
- }
- ListView{
- id:nav_list
- height: 40
- width: control.width
- model:d.children
- clip: true
- spacing: 20
- interactive: false
- orientation:ListView.Horizontal
- highlight: Item{
- clip: true
- Rectangle{
- height: 3
- radius: 1.5
- color: FluTheme.primaryColor.dark
- width: nav_list.currentItem ? nav_list.currentItem.width : 0
- y:37
- Behavior on width {
- NumberAnimation{
- duration: 150
- }
- }
- }
- }
- delegate: Button{
- id:item_button
- width: item_title.width
- height: nav_list.height
- background:Item{
- }
- contentItem: Item{
- FluText {
- id:item_title
- fontStyle: FluText.Title
- font.bold: false
- text: modelData.title
- anchors.centerIn: parent
- color: {
- if(item_button.hovered)
- return hoverColor
- return normalColor
- }
- }
- transitions: Transition {
- NumberAnimation{
- duration: 400;
- }
- }
- }
- onClicked: {
- nav_list.currentIndex = index
- }
- }
- }
- Item{
- id:container
- anchors{
- top: nav_list.bottom
- topMargin: 10
- left: parent.left
- right: parent.right
- bottom: parent.bottom
- }
- Repeater{
- model:d.children
- Loader{
- property var argument: modelData.argument
- anchors.fill: parent
- sourceComponent: modelData.contentItem
- visible: nav_list.currentIndex === index
- }
- }
- }
- }
|