FluentUI/Gallery/res/qml/page/T_Breadcrumb.qml
yxdy a44db97aa3
Some checks failed
Gallery App Build / Windows (push) Has been cancelled
Gallery App Build / macOS (push) Has been cancelled
Gallery App Build / Ubuntu (push) Has been cancelled
init
2025-02-12 10:31:20 +08:00

80 lines
1.9 KiB
QML

import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import FluentUI.Controls
import Gallery
ScrollablePage {
title: qsTr("Breadcrumb")
CardHighlight{
Layout.fillWidth: true
showDisabled: false
codeSnippet:
`import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import FluentUI.Controls
ColumnLayout{
width: parent.width
spacing: 10
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
}
Frame{
Layout.fillWidth: true
Layout.preferredHeight: 68
padding: 10
Breadcrumb{
id: breadcrumb_1
width: parent.width
anchors.verticalCenter: parent.verticalCenter
}
}
Frame{
Layout.fillWidth: true
Layout.preferredHeight: 120
padding: 10
Layout.topMargin: 20
ColumnLayout{
anchors.verticalCenter: parent.verticalCenter
width:parent.width
spacing: 10
FilledButton{
text: qsTr("Reset sample")
onClicked:{
var items = []
for(var i=0;i<10;i++){
items.push({title:"Item_"+(i+1)})
}
breadcrumb_2.items = items
}
}
Breadcrumb{
id:breadcrumb_2
spacing: 8
moreSize: 32
font: Typography.subtitle
Layout.fillWidth: true
Layout.preferredHeight: 40
onClickItem:
(model)=>{
if(model.index+1!==count()){
breadcrumb_2.remove(model.index+1,count()-model.index-1)
}
}
}
}
}
}
`}
}