T_Menu.qml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import QtQuick
  2. import QtQuick.Layouts
  3. import QtQuick.Window
  4. import QtQuick.Controls
  5. import FluentUI
  6. import "../component"
  7. FluScrollablePage{
  8. title:"Menu"
  9. leftPadding:10
  10. rightPadding:10
  11. bottomPadding:20
  12. spacing: 0
  13. FluArea{
  14. Layout.fillWidth: true
  15. height: 100
  16. paddings: 10
  17. Layout.topMargin: 20
  18. Column{
  19. id:layout_column
  20. spacing: 15
  21. anchors{
  22. verticalCenter: parent.verticalCenter
  23. left:parent.left
  24. }
  25. FluButton{
  26. text:"左击菜单"
  27. Layout.topMargin: 20
  28. onClicked:{
  29. menu.popup()
  30. }
  31. }
  32. FluButton{
  33. text:"右击菜单"
  34. Layout.topMargin: 20
  35. onClicked: {
  36. showSuccess("请按鼠标右击")
  37. }
  38. MouseArea{
  39. anchors.fill: parent
  40. acceptedButtons: Qt.RightButton
  41. onClicked: {
  42. menu.popup()
  43. }
  44. }
  45. }
  46. }
  47. }
  48. CodeExpander{
  49. Layout.fillWidth: true
  50. Layout.topMargin: -1
  51. code:'FluMenu{
  52. id:menu
  53. FluMenuItem:{
  54. text:"删除"
  55. onClicked: {
  56. showError("删除")
  57. }
  58. }
  59. FluMenuItem:{
  60. text:"修改"
  61. onClicked: {
  62. showInfo"修改")
  63. }
  64. }
  65. }
  66. menu.popup()
  67. '
  68. }
  69. FluMenu{
  70. id:menu
  71. FluMenuItem{
  72. text:"删除"
  73. onClicked: {
  74. showError("删除")
  75. }
  76. }
  77. FluMenuItem{
  78. text:"修改"
  79. onClicked: {
  80. showInfo("修改")
  81. }
  82. }
  83. }
  84. }