FluMenu.qml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import QtQuick
  2. import QtQuick.Layouts
  3. import QtQuick.Controls
  4. import FluentUI
  5. Menu {
  6. default property alias content: container.data
  7. property bool enableAnimation: true
  8. id: popup
  9. width: 140
  10. height: container.height
  11. modal:true
  12. dim:false
  13. enter: Transition {
  14. reversible: true
  15. NumberAnimation {
  16. property: "opacity"
  17. from:0
  18. to:1
  19. duration: enableAnimation ? 83 : 0
  20. }
  21. }
  22. exit:Transition {
  23. NumberAnimation {
  24. property: "opacity"
  25. from:1
  26. to:0
  27. duration: enableAnimation ? 83 : 0
  28. }
  29. }
  30. background:Item{
  31. FluShadow{
  32. radius: 5
  33. }
  34. }
  35. contentItem: Item {
  36. clip: true
  37. Rectangle{
  38. anchors.fill: parent
  39. color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(249/255,249/255,249/255,1)
  40. border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
  41. border.width: 1
  42. radius: 5
  43. }
  44. Column{
  45. id:container
  46. spacing: 5
  47. topPadding: 5
  48. bottomPadding: 5
  49. width: popup.width
  50. function closePopup(){
  51. popup.close()
  52. }
  53. }
  54. }
  55. function getContainerHeight(){
  56. return container.height
  57. }
  58. }