MonitorItem.qml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright (c) 2022 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. import Cura 1.0 as Cura
  6. Item
  7. {
  8. property string label: ""
  9. property string value: ""
  10. height: childrenRect.height
  11. property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
  12. Row
  13. {
  14. height: UM.Theme.getSize("setting_control").height
  15. width: Math.floor(base.width - 2 * UM.Theme.getSize("default_margin").width)
  16. anchors.left: parent.left
  17. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  18. UM.Label
  19. {
  20. width: Math.floor(parent.width * 0.4)
  21. anchors.verticalCenter: parent.verticalCenter
  22. text: label
  23. color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
  24. elide: Text.ElideRight
  25. }
  26. UM.Label
  27. {
  28. width: Math.floor(parent.width * 0.6)
  29. anchors.verticalCenter: parent.verticalCenter
  30. text: value
  31. color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
  32. elide: Text.ElideRight
  33. }
  34. }
  35. }