MonitorItem.qml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright (c) 2017 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 2.2
  5. import QtQuick.Controls.Styles 2.2
  6. import QtQuick.Layouts 1.1
  7. import UM 1.2 as UM
  8. import Cura 1.0 as Cura
  9. Item
  10. {
  11. property string label: ""
  12. property string value: ""
  13. height: childrenRect.height;
  14. property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
  15. Row
  16. {
  17. height: UM.Theme.getSize("setting_control").height
  18. width: Math.floor(base.width - 2 * UM.Theme.getSize("default_margin").width)
  19. anchors.left: parent.left
  20. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  21. Label
  22. {
  23. width: Math.floor(parent.width * 0.4)
  24. anchors.verticalCenter: parent.verticalCenter
  25. text: label
  26. color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
  27. font: UM.Theme.getFont("default")
  28. elide: Text.ElideRight
  29. }
  30. Label
  31. {
  32. width: Math.floor(parent.width * 0.6)
  33. anchors.verticalCenter: parent.verticalCenter
  34. text: value
  35. color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
  36. font: UM.Theme.getFont("default")
  37. elide: Text.ElideRight
  38. }
  39. }
  40. }