FluentUI/example/qml/page/T_BreadcrumbBar.qml

93 lines
2.1 KiB
QML
Raw Permalink Normal View History

2023-08-24 15:50:37 +08:00
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import FluentUI 1.0
2023-08-26 17:20:30 +08:00
import "../component"
2023-04-24 17:02:26 +08:00
FluScrollablePage{
2024-03-09 15:35:48 +08:00
title: qsTr("BreadcurmbBar")
2023-04-24 17:02:26 +08:00
Component.onCompleted: {
var items = []
for(var i=0;i<10;i++){
items.push({title:"Item_"+(i+1)})
}
breadcrumb_1.items = items
breadcrumb_2.items = items
}
2024-03-29 16:56:09 +08:00
FluFrame{
2023-04-24 17:02:26 +08:00
Layout.fillWidth: true
2024-03-29 16:23:16 +08:00
Layout.preferredHeight: 68
padding: 10
2023-04-24 17:02:26 +08:00
FluBreadcrumbBar{
id:breadcrumb_1
width:parent.width
anchors.verticalCenter: parent.verticalCenter
onClickItem:
(model)=>{
showSuccess(model.title)
}
}
}
2024-03-29 16:56:09 +08:00
FluFrame{
2023-04-24 17:02:26 +08:00
Layout.fillWidth: true
2024-03-29 16:23:16 +08:00
Layout.preferredHeight: 100
padding: 10
2023-04-24 17:02:26 +08:00
Layout.topMargin: 20
ColumnLayout{
anchors.verticalCenter: parent.verticalCenter
width:parent.width
spacing: 10
FluFilledButton{
2024-03-09 15:35:48 +08:00
text: qsTr("Reset sample")
2023-04-24 17:02:26 +08:00
onClicked:{
var items = []
for(var i=0;i<10;i++){
items.push({title:"Item_"+(i+1)})
}
breadcrumb_2.items = items
}
}
FluBreadcrumbBar{
id:breadcrumb_2
separator:">"
spacing:8
textSize:18
Layout.fillWidth: true
onClickItem:
(model)=>{
if(model.index+1!==count()){
breadcrumb_2.remove(model.index+1,count()-model.index-1)
}
showSuccess(model.title)
}
}
}
}
CodeExpander{
Layout.fillWidth: true
2024-03-29 16:23:16 +08:00
Layout.topMargin: -6
2023-04-24 17:02:26 +08:00
code:'FluBreadcrumbBar{
width:parent.width
separator:">"
spacing:8
textSize:18
onClickItem: (model)=>{
}
}'
}
}