FluentUI/example/T_Menu.qml

92 lines
1.8 KiB
QML
Raw Normal View History

2023-03-30 21:52:55 +08:00
import QtQuick
import QtQuick.Layouts
import QtQuick.Window
import QtQuick.Controls
import FluentUI
2023-04-06 17:32:21 +08:00
import "./component"
2023-03-13 18:23:46 +08:00
FluScrollablePage{
title:"Menu"
2023-03-28 17:53:46 +08:00
leftPadding:10
rightPadding:10
bottomPadding:20
2023-04-06 17:32:21 +08:00
spacing: 0
2023-03-13 18:23:46 +08:00
2023-04-06 17:32:21 +08:00
FluArea{
Layout.fillWidth: true
height: 100
paddings: 10
2023-03-13 18:23:46 +08:00
Layout.topMargin: 20
2023-04-06 17:32:21 +08:00
Column{
id:layout_column
spacing: 15
anchors{
verticalCenter: parent.verticalCenter
left:parent.left
}
FluButton{
text:"左击菜单"
Layout.topMargin: 20
onClicked:{
menu.popup()
}
}
FluButton{
text:"右击菜单"
Layout.topMargin: 20
onClicked: {
showSuccess("请按鼠标右击")
}
MouseArea{
anchors.fill: parent
acceptedButtons: Qt.RightButton
onClicked: {
menu.popup()
}
}
}
2023-03-13 18:23:46 +08:00
}
}
2023-04-06 17:32:21 +08:00
CodeExpander{
Layout.fillWidth: true
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: {
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
FluMenu{
id:menu
FluMenuItem{
text:"删除"
onClicked: {
showError("删除")
}
}
FluMenuItem{
text:"修改"
onClicked: {
2023-04-06 17:32:21 +08:00
showInfo("修改")
2023-03-13 18:23:46 +08:00
}
}
}
}