MonitorPrinterPill.qml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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 QtQuick.Controls 1.4
  5. import UM 1.2 as UM
  6. /**
  7. * A MonitorPrinterPill is a blue-colored tag indicating which printers a print
  8. * job is compatible with. It is used by the MonitorPrintJobCard component.
  9. */
  10. Item
  11. {
  12. id: monitorPrinterPill
  13. property var text: ""
  14. implicitHeight: 18 * screenScaleFactor // TODO: Theme!
  15. implicitWidth: Math.max(printerNameLabel.contentWidth + 12 * screenScaleFactor, 36 * screenScaleFactor) // TODO: Theme!
  16. Rectangle {
  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. Label {
  23. id: printerNameLabel
  24. anchors.centerIn: parent
  25. color: UM.Theme.getColor("monitor_text_primary")
  26. text: monitorPrinterPill.text
  27. font.pointSize: 10 // TODO: Theme!
  28. visible: monitorPrinterPill.text !== ""
  29. renderType: Text.NativeRendering
  30. }
  31. }