ApplicationSwitcher.qml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright (c) 2021 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Controls 2.3
  5. import QtQuick.Layouts 1.15
  6. import UM 1.4 as UM
  7. import Cura 1.1 as Cura
  8. Item
  9. {
  10. id: applicationSwitcherWidget
  11. width: Math.round(0.5 * UM.Theme.getSize("main_window_header").height)
  12. height: width
  13. Button
  14. {
  15. id: applicationSwitcherButton
  16. anchors.fill: parent
  17. background: Item
  18. {
  19. Rectangle
  20. {
  21. anchors.fill: parent
  22. radius: UM.Theme.getSize("action_button_radius").width
  23. color: UM.Theme.getColor("primary_text")
  24. opacity: applicationSwitcherButton.hovered ? 0.2 : 0
  25. Behavior on opacity { NumberAnimation { duration: 100; } }
  26. }
  27. UM.ColorImage
  28. {
  29. anchors.fill: parent
  30. color: UM.Theme.getColor("primary_text")
  31. source: UM.Theme.getIcon("BlockGrid")
  32. }
  33. }
  34. onClicked:
  35. {
  36. if (applicationSwitcherPopup.opened)
  37. {
  38. applicationSwitcherPopup.close()
  39. } else {
  40. applicationSwitcherPopup.open()
  41. }
  42. }
  43. }
  44. ApplicationSwitcherPopup
  45. {
  46. id: applicationSwitcherPopup
  47. y: parent.height + UM.Theme.getSize("default_arrow").height
  48. // Move the x position by the default margin so that the arrow isn't drawn exactly on the corner
  49. x: parent.width - width + UM.Theme.getSize("default_margin").width
  50. }
  51. }