120 lines
3.7 KiB
QML
120 lines
3.7 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import FluentUI.Controls
|
|
import FluentUI.impl
|
|
|
|
Item{
|
|
id: control
|
|
width: parent.width
|
|
height: 460
|
|
signal clickMenu(var item)
|
|
property list<QtObject> originalItems : [
|
|
PaneItem{
|
|
key: "/"
|
|
title: "主页"
|
|
icon.name: FluentIcons.graph_Home
|
|
},
|
|
PaneItemSeparator{},
|
|
// PaneItemHeader{
|
|
// title: "Header Item"
|
|
// },
|
|
PaneItemExpander{
|
|
title: "充换电"
|
|
icon.name: FluentIcons.graph_Home
|
|
PaneItem{
|
|
key: "/test/mail"
|
|
title: "河津一号站"
|
|
}
|
|
PaneItem{
|
|
key: "/test/calendar"
|
|
title: "姚店"
|
|
}
|
|
},
|
|
PaneItemExpander{
|
|
title: "陆港"
|
|
icon.name: FluentIcons.graph_Home
|
|
PaneItem{
|
|
key: "/test/mail"
|
|
title: "耳字豪陆港"
|
|
}
|
|
}
|
|
]
|
|
property list<QtObject> originalFooterItems : [
|
|
PaneItem{
|
|
icon.name: FluentIcons.graph_Contact
|
|
key: "/newfolder"
|
|
title: "创建目录"
|
|
}
|
|
]
|
|
PageRouter{
|
|
id: page_router
|
|
routes: {
|
|
"/": "qrc:/qt/qml/Gallery/res/qml/component/RightMainContent.qml",
|
|
"/test/track": "qrc:/qt/qml/Gallery/res/qml/page/T_Test.qml",
|
|
"/test/mail": "qrc:/qt/qml/Gallery/res/qml/page/T_Test.qml",
|
|
"/test/calendar": "qrc:/qt/qml/Gallery/res/qml/page/T_Test.qml",
|
|
"/test/newitem": "qrc:/qt/qml/Gallery/res/qml/page/T_Test.qml",
|
|
"/test/settings": "qrc:/qt/qml/Gallery/res/qml/page/T_Test.qml",
|
|
"/newproject": "qrc:/qt/qml/Gallery/res/qml/window/NewProjectWindow.qml"
|
|
}
|
|
}
|
|
NavigationView{
|
|
id: nav_menu
|
|
anchors.fill: parent
|
|
// logo: "qrc:/qt/qml/Gallery/res/image/logo.png"
|
|
// title: "FluentUI Gallery"
|
|
router: page_router
|
|
appBarHeight: 0
|
|
topBarHeight: 0
|
|
items: originalItems
|
|
footerItems: originalFooterItems
|
|
displayMode: NavigationViewType.Open
|
|
sideBarShadow: false
|
|
// leading: Button{
|
|
// height: 40
|
|
// highlighted: true
|
|
// text: "Custom Header Content"
|
|
// }
|
|
// trailing: Button{
|
|
// height: 40
|
|
// text: "Custom Header2 Content"
|
|
// }
|
|
onTap:
|
|
(item)=>{
|
|
if(item.key){
|
|
if (item.key == "/newfolder") {
|
|
projectNew.launch({ title: "" })
|
|
} else {
|
|
page_router.go(item.key,{info:item.title})
|
|
control.clickMenu(item)
|
|
}
|
|
}
|
|
}
|
|
Component.onCompleted: {
|
|
nav_menu.goBackButton.visible = false
|
|
page_router.go("/",{info:"Home"})
|
|
}
|
|
}
|
|
|
|
// 新建项目弹框
|
|
WindowResultLauncher{
|
|
id: projectNew
|
|
path: "/newFolder"
|
|
onResult: (data)=>{
|
|
var ml = Qt.createComponent("qrc:/qt/qml/FluentUI/Controls/PaneItemExpander.qml");
|
|
if (ml.status === Component.Ready) {
|
|
var menu = ml.createObject(nav_menu,{title: data.title })
|
|
menu.icon.name = FluentIcons.graph_Home
|
|
menu.icon.color = Colors.white
|
|
control.originalItems.push(menu)
|
|
}
|
|
}
|
|
}
|
|
////////////
|
|
|
|
function visitUrl(path: string) {
|
|
page_router.go(path, {info: "Test"})
|
|
}
|
|
|
|
}
|