MonitorInfoBlurb.qml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright (c) 2019 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.3
  4. import QtQuick.Controls 2.0
  5. import UM 1.5 as UM
  6. /**
  7. * A MonitorInfoBlurb is an extension of the GenericPopUp used to show static information (vs. interactive context
  8. * menus). It accepts some text (text), an item to link to to (target), and a specification of which side of the target
  9. * to appear on (direction). It also sets the GenericPopUp's color to black, to differentiate itself from a menu.
  10. */
  11. Item
  12. {
  13. property alias text: innerLabel.text
  14. property alias target: popUp.target
  15. property alias direction: popUp.direction
  16. GenericPopUp
  17. {
  18. id: popUp
  19. // Which way should the pop-up point? Default is up, but will flip when required
  20. direction: "up"
  21. // Use dark grey for info blurbs and white for context menus
  22. color: UM.Theme.getColor("monitor_tooltip")
  23. contentItem: Item
  24. {
  25. id: contentWrapper
  26. implicitWidth: childrenRect.width
  27. implicitHeight: innerLabel.contentHeight + 2 * innerLabel.padding
  28. UM.Label
  29. {
  30. id: innerLabel
  31. padding: 12 * screenScaleFactor // TODO: Theme!
  32. text: ""
  33. wrapMode: Text.WordWrap
  34. width: 240 * screenScaleFactor // TODO: Theme!
  35. color: UM.Theme.getColor("monitor_tooltip_text")
  36. }
  37. }
  38. }
  39. function open() {
  40. popUp.open()
  41. }
  42. function close() {
  43. popUp.close()
  44. }
  45. }