mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-01 08:31:33 +08:00
168 lines
3.6 KiB
QML
168 lines
3.6 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import QtQuick.Window
|
|
import QtQuick.Controls
|
|
import FluentUI
|
|
import "qrc:///example/qml/component"
|
|
|
|
FluScrollablePage{
|
|
|
|
title:"Menu"
|
|
|
|
FluMenu {
|
|
id:menu
|
|
title: qsTr("File")
|
|
Action { text: qsTr("New...")}
|
|
Action { text: qsTr("Open...") }
|
|
Action { text: qsTr("Save") }
|
|
FluMenuSeparator { }
|
|
Action {
|
|
text: qsTr("Quit")
|
|
onTriggered: {
|
|
showError("Quit")
|
|
}
|
|
}
|
|
Action {
|
|
text: qsTr("Disable")
|
|
enabled:false
|
|
onTriggered: {
|
|
showError("Disable")
|
|
}
|
|
}
|
|
FluMenuSeparator { }
|
|
Action { text: qsTr("Check");checkable: true;checked: true}
|
|
FluMenu{
|
|
title: "Save As..."
|
|
Action { text: qsTr("Doc") }
|
|
Action { text: qsTr("PDF") }
|
|
}
|
|
}
|
|
|
|
|
|
FluArea{
|
|
Layout.fillWidth: true
|
|
height: 100
|
|
paddings: 10
|
|
Layout.topMargin: 20
|
|
Column{
|
|
id:layout_column
|
|
spacing: 15
|
|
anchors{
|
|
verticalCenter: parent.verticalCenter
|
|
left:parent.left
|
|
}
|
|
|
|
FluText{
|
|
text:"Menu"
|
|
}
|
|
|
|
FluButton{
|
|
text:"Show Menu Popup"
|
|
Layout.topMargin: 20
|
|
onClicked:{
|
|
menu.popup()
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
CodeExpander{
|
|
Layout.fillWidth: true
|
|
Layout.topMargin: -1
|
|
code:'FluMenu{
|
|
id:menu
|
|
FluMenuItem:{
|
|
text:"删除"
|
|
onClicked: {
|
|
showError("删除")
|
|
}
|
|
}
|
|
FluMenuItem:{
|
|
text:"修改"
|
|
onClicked: {
|
|
showInfo("修改")
|
|
}
|
|
}
|
|
}
|
|
menu.popup()
|
|
'
|
|
}
|
|
|
|
|
|
FluArea{
|
|
Layout.fillWidth: true
|
|
height: 100
|
|
paddings: 10
|
|
Layout.topMargin: 20
|
|
Column{
|
|
spacing: 15
|
|
anchors{
|
|
verticalCenter: parent.verticalCenter
|
|
left:parent.left
|
|
}
|
|
|
|
FluText{
|
|
text:"MenuBar"
|
|
}
|
|
|
|
FluMenuBar {
|
|
id:menu_bar
|
|
FluMenu {
|
|
title: qsTr("File")
|
|
Action { text: qsTr("New...") }
|
|
Action { text: qsTr("Open...") }
|
|
Action { text: qsTr("Save") }
|
|
FluMenuSeparator { }
|
|
Action { text: qsTr("Quit") }
|
|
Action {
|
|
text: qsTr("Disable")
|
|
enabled:false
|
|
}
|
|
FluMenu{
|
|
title: "Save As..."
|
|
Action { text: qsTr("Doc") }
|
|
Action { text: qsTr("PDF") }
|
|
}
|
|
}
|
|
FluMenu {
|
|
title: qsTr("Edit")
|
|
Action { text: qsTr("Cut") }
|
|
Action { text: qsTr("Copy") }
|
|
Action { text: qsTr("Paste") }
|
|
}
|
|
FluMenu {
|
|
title: qsTr("Help")
|
|
Action { text: qsTr("About") }
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
CodeExpander{
|
|
Layout.fillWidth: true
|
|
Layout.topMargin: -1
|
|
code:'FluMenuBar{
|
|
id:menu
|
|
FluMenu:{
|
|
title:"File"
|
|
Action { text: qsTr("New...") }
|
|
}
|
|
FluMenu:{
|
|
title:"Edit"
|
|
Action { text: qsTr("Cut") }
|
|
Action { text: qsTr("Copy") }
|
|
Action { text: qsTr("Paste") }
|
|
}
|
|
}
|
|
menu.popup()
|
|
'
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|