GcodeTextArea.qml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright (c) 2019 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Controls 2.3
  5. import QtQuick.Layouts 1.3
  6. import UM 1.3 as UM
  7. import Cura 1.1 as Cura
  8. //
  9. // TextArea widget for editing Gcode in the Machine Settings dialog.
  10. //
  11. UM.TooltipArea
  12. {
  13. id: gcodeTextArea
  14. UM.I18nCatalog { id: catalog; name: "cura"; }
  15. height: childrenRect.height
  16. width: childrenRect.width
  17. text: tooltip
  18. property alias containerStackId: propertyProvider.containerStackId
  19. property alias settingKey: propertyProvider.key
  20. property alias settingStoreIndex: propertyProvider.storeIndex
  21. property string tooltip: propertyProvider.properties.description
  22. UM.SettingPropertyProvider
  23. {
  24. id: propertyProvider
  25. watchedProperties: [ "value", "description" ]
  26. }
  27. // TODO: put label here
  28. TextArea
  29. {
  30. id: gcodeArea
  31. width: areaWidth
  32. height: areaHeight
  33. font: UM.Theme.getFont("fixed")
  34. text: (propertyProvider.properties.value) ? propertyProvider.properties.value : ""
  35. wrapMode: TextEdit.NoWrap
  36. onActiveFocusChanged:
  37. {
  38. if (!activeFocus)
  39. {
  40. propertyProvider.setPropertyValue("value", text)
  41. }
  42. }
  43. }
  44. }