MonitorInfoBlurb.qml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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.3 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. 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. font: UM.Theme.getFont("default")
  37. }
  38. }
  39. }
  40. function open() {
  41. popUp.open()
  42. }
  43. function close() {
  44. popUp.close()
  45. }
  46. }