DefaultTextArea.qml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright (C) 2020 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.Controls
  6. import QtQuick.Controls.impl
  7. import QtQuick.Templates as T
  8. import QtQuick.NativeStyle as NativeStyle
  9. T.TextArea {
  10. id: control
  11. implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
  12. implicitBackgroundWidth + leftInset + rightInset,
  13. placeholder.implicitWidth + leftPadding + rightPadding)
  14. implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
  15. implicitBackgroundHeight + topInset + bottomInset,
  16. placeholder.implicitHeight + topPadding + bottomPadding)
  17. leftPadding: 7
  18. rightPadding: 7
  19. topPadding: 3
  20. bottomPadding: 3
  21. color: control.palette.text
  22. selectionColor: control.palette.highlight
  23. selectedTextColor: control.palette.highlightedText
  24. placeholderTextColor: control.palette.placeholderText
  25. verticalAlignment: TextInput.AlignTop
  26. readonly property bool __notCustomizable: true
  27. PlaceholderText {
  28. id: placeholder
  29. x: control.leftPadding
  30. y: control.topPadding
  31. width: control.width - (control.leftPadding + control.rightPadding)
  32. height: control.height - (control.topPadding + control.bottomPadding)
  33. text: control.placeholderText
  34. font: control.font
  35. color: control.placeholderTextColor
  36. verticalAlignment: control.verticalAlignment
  37. visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
  38. elide: Text.ElideRight
  39. renderType: control.renderType
  40. }
  41. background: Rectangle {
  42. color: control.palette.light
  43. readonly property bool __ignoreNotCustomizable: true
  44. }
  45. }