MonitorPrinterPill.qml 994 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright (c) 2019 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  4. import UM 1.5 as UM
  5. /**
  6. * A MonitorPrinterPill is a blue-colored tag indicating which printers a print
  7. * job is compatible with. It is used by the MonitorPrintJobCard component.
  8. */
  9. Item
  10. {
  11. id: monitorPrinterPill
  12. property var text: ""
  13. implicitHeight: 18 * screenScaleFactor // TODO: Theme!
  14. implicitWidth: Math.max(printerNameLabel.contentWidth + 12 * screenScaleFactor, 36 * screenScaleFactor) // TODO: Theme!
  15. Rectangle
  16. {
  17. id: background
  18. anchors.fill: parent
  19. color: printerNameLabel.visible ? UM.Theme.getColor("monitor_printer_family_tag") : UM.Theme.getColor("monitor_skeleton_loading")
  20. radius: 2 * screenScaleFactor // TODO: Theme!
  21. }
  22. UM.Label
  23. {
  24. id: printerNameLabel
  25. anchors.centerIn: parent
  26. text: monitorPrinterPill.text
  27. visible: monitorPrinterPill.text !== ""
  28. }
  29. }