ScrollableTextArea.qml 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright (c) 2022 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 UM 1.5 as UM
  6. import Cura 1.1 as Cura
  7. //
  8. // Cura-style TextArea with scrolls
  9. //
  10. Flickable
  11. {
  12. id: scrollableTextAreaBase
  13. property bool do_borders: true
  14. property var back_color: UM.Theme.getColor("main_background")
  15. property alias textArea: flickableTextArea
  16. ScrollBar.vertical: UM.ScrollBar {}
  17. TextArea.flickable: TextArea
  18. {
  19. id: flickableTextArea
  20. background: Rectangle //Providing the background color and border.
  21. {
  22. anchors.fill: parent
  23. anchors.margins: -border.width
  24. color: scrollableTextAreaBase.back_color
  25. border.color: UM.Theme.getColor("thick_lining")
  26. border.width: scrollableTextAreaBase.do_borders ? UM.Theme.getSize("default_lining").width : 0
  27. }
  28. font: UM.Theme.getFont("default")
  29. color: UM.Theme.getColor("text")
  30. textFormat: TextEdit.PlainText
  31. renderType: Text.NativeRendering
  32. wrapMode: Text.Wrap
  33. selectByMouse: true
  34. }
  35. }