2023-08-24 15:50:37 +08:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtQuick.Window 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import FluentUI 1.0
|
2023-08-26 17:20:30 +08:00
|
|
|
import "../component"
|
2023-03-13 18:23:46 +08:00
|
|
|
|
|
|
|
FluScrollablePage{
|
|
|
|
|
2024-03-09 15:35:48 +08:00
|
|
|
title: qsTr("Menu")
|
2023-03-13 18:23:46 +08:00
|
|
|
|
2023-06-18 13:56:30 +08:00
|
|
|
FluMenu {
|
|
|
|
id:menu
|
|
|
|
title: qsTr("File")
|
|
|
|
Action { text: qsTr("New...")}
|
|
|
|
Action { text: qsTr("Open...") }
|
|
|
|
Action { text: qsTr("Save") }
|
|
|
|
FluMenuSeparator { }
|
2023-08-22 22:27:05 +08:00
|
|
|
FluMenuItem{
|
2023-06-20 18:02:15 +08:00
|
|
|
text: qsTr("Quit")
|
|
|
|
onTriggered: {
|
|
|
|
showError("Quit")
|
|
|
|
}
|
|
|
|
}
|
2023-08-22 22:27:05 +08:00
|
|
|
FluMenuItem{
|
|
|
|
text: qsTr("Search")
|
|
|
|
iconSource: FluentIcons.Zoom
|
|
|
|
iconSpacing: 3
|
|
|
|
onTriggered: {
|
2024-03-09 18:40:32 +08:00
|
|
|
showError(qsTr("Search"))
|
2023-08-22 22:27:05 +08:00
|
|
|
}
|
|
|
|
}
|
2023-06-20 18:02:15 +08:00
|
|
|
Action {
|
|
|
|
text: qsTr("Disable")
|
|
|
|
enabled:false
|
|
|
|
onTriggered: {
|
2024-03-09 15:35:48 +08:00
|
|
|
showError(qsTr("Disable"))
|
2023-06-20 18:02:15 +08:00
|
|
|
}
|
|
|
|
}
|
2023-06-18 13:56:30 +08:00
|
|
|
FluMenuSeparator { }
|
|
|
|
Action { text: qsTr("Check");checkable: true;checked: true}
|
|
|
|
FluMenu{
|
2024-03-09 15:35:48 +08:00
|
|
|
title: qsTr("Save As...")
|
2023-06-18 13:56:30 +08:00
|
|
|
Action { text: qsTr("Doc") }
|
|
|
|
Action { text: qsTr("PDF") }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-04-06 17:32:21 +08:00
|
|
|
FluArea{
|
|
|
|
Layout.fillWidth: true
|
2024-03-29 16:23:16 +08:00
|
|
|
Layout.preferredHeight: 100
|
|
|
|
padding: 10
|
2023-04-06 17:32:21 +08:00
|
|
|
Column{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: layout_column
|
2023-04-06 17:32:21 +08:00
|
|
|
spacing: 15
|
|
|
|
anchors{
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
left:parent.left
|
|
|
|
}
|
|
|
|
|
2023-06-18 13:56:30 +08:00
|
|
|
FluText{
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Menu")
|
2023-06-18 13:56:30 +08:00
|
|
|
}
|
|
|
|
|
2023-04-06 17:32:21 +08:00
|
|
|
FluButton{
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Show Menu Popup")
|
2023-04-06 17:32:21 +08:00
|
|
|
Layout.topMargin: 20
|
|
|
|
onClicked:{
|
|
|
|
menu.popup()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-18 13:56:30 +08:00
|
|
|
|
2023-03-13 18:23:46 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-06 17:32:21 +08:00
|
|
|
CodeExpander{
|
|
|
|
Layout.fillWidth: true
|
2024-03-29 16:23:16 +08:00
|
|
|
Layout.topMargin: -6
|
2023-04-06 17:32:21 +08:00
|
|
|
code:'FluMenu{
|
|
|
|
id:menu
|
|
|
|
FluMenuItem:{
|
|
|
|
text:"删除"
|
2023-03-13 18:23:46 +08:00
|
|
|
onClicked: {
|
2023-04-06 17:32:21 +08:00
|
|
|
showError("删除")
|
2023-03-13 18:23:46 +08:00
|
|
|
}
|
2023-04-06 17:32:21 +08:00
|
|
|
}
|
|
|
|
FluMenuItem:{
|
|
|
|
text:"修改"
|
|
|
|
onClicked: {
|
2023-06-07 09:49:39 +08:00
|
|
|
showInfo("修改")
|
2023-03-13 18:23:46 +08:00
|
|
|
}
|
|
|
|
}
|
2023-04-06 17:32:21 +08:00
|
|
|
}
|
|
|
|
menu.popup()
|
|
|
|
'
|
|
|
|
}
|
2023-03-13 18:23:46 +08:00
|
|
|
|
2023-06-18 13:56:30 +08:00
|
|
|
|
|
|
|
FluArea{
|
|
|
|
Layout.fillWidth: true
|
2024-03-29 16:23:16 +08:00
|
|
|
Layout.preferredHeight: 100
|
|
|
|
padding: 10
|
2023-06-18 13:56:30 +08:00
|
|
|
Layout.topMargin: 20
|
|
|
|
Column{
|
|
|
|
spacing: 15
|
|
|
|
anchors{
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
left:parent.left
|
2023-03-13 18:23:46 +08:00
|
|
|
}
|
2023-06-18 13:56:30 +08:00
|
|
|
|
|
|
|
FluText{
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("MenuBar")
|
2023-06-18 13:56:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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") }
|
2023-06-20 18:02:15 +08:00
|
|
|
Action {
|
|
|
|
text: qsTr("Disable")
|
|
|
|
enabled:false
|
|
|
|
}
|
2023-06-18 13:56:30 +08:00
|
|
|
FluMenu{
|
2024-03-09 15:35:48 +08:00
|
|
|
title: qsTr("Save As...")
|
2023-06-18 13:56:30 +08:00
|
|
|
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") }
|
|
|
|
}
|
2023-03-13 18:23:46 +08:00
|
|
|
}
|
2023-06-18 13:56:30 +08:00
|
|
|
|
2023-03-13 18:23:46 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-18 13:56:30 +08:00
|
|
|
CodeExpander{
|
|
|
|
Layout.fillWidth: true
|
2024-03-29 16:23:16 +08:00
|
|
|
Layout.topMargin: -6
|
2023-06-18 13:56:30 +08:00
|
|
|
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()
|
|
|
|
'
|
|
|
|
}
|
2023-03-13 18:23:46 +08:00
|
|
|
}
|