TextArea.qml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright (C) 2017 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
  3. // Qt-Security score:significant reason:default
  4. import QtQuick
  5. import QtQuick.Templates as T
  6. import QtQuick.Controls.impl
  7. import QtQuick.Controls.Fusion.impl
  8. T.TextArea {
  9. id: control
  10. implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
  11. implicitBackgroundWidth + leftInset + rightInset,
  12. placeholder.implicitWidth + leftPadding + rightPadding)
  13. implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
  14. implicitBackgroundHeight + topInset + bottomInset,
  15. placeholder.implicitHeight + topPadding + bottomPadding)
  16. padding: 6
  17. leftPadding: padding + 4
  18. color: control.palette.text
  19. selectionColor: control.palette.highlight
  20. selectedTextColor: control.palette.highlightedText
  21. placeholderTextColor: control.palette.placeholderText
  22. ContextMenu.menu: TextEditingContextMenu {
  23. editor: control
  24. }
  25. PlaceholderText {
  26. id: placeholder
  27. x: control.leftPadding
  28. y: control.topPadding
  29. width: control.width - (control.leftPadding + control.rightPadding)
  30. height: control.height - (control.topPadding + control.bottomPadding)
  31. text: control.placeholderText
  32. font: control.font
  33. color: control.placeholderTextColor
  34. verticalAlignment: control.verticalAlignment
  35. visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
  36. elide: Text.ElideRight
  37. renderType: control.renderType
  38. }
  39. background: TextFieldBackground {
  40. control: control
  41. }
  42. }