TextAreaStyle.qml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2016 The Qt Company Ltd.
  4. ** Contact: https://www.qt.io/licensing/
  5. **
  6. ** This file is part of the Qt Quick Controls module of the Qt Toolkit.
  7. **
  8. ** $QT_BEGIN_LICENSE:LGPL$
  9. ** Commercial License Usage
  10. ** Licensees holding valid commercial Qt licenses may use this file in
  11. ** accordance with the commercial license agreement provided with the
  12. ** Software or, alternatively, in accordance with the terms contained in
  13. ** a written agreement between you and The Qt Company. For licensing terms
  14. ** and conditions see https://www.qt.io/terms-conditions. For further
  15. ** information use the contact form at https://www.qt.io/contact-us.
  16. **
  17. ** GNU Lesser General Public License Usage
  18. ** Alternatively, this file may be used under the terms of the GNU Lesser
  19. ** General Public License version 3 as published by the Free Software
  20. ** Foundation and appearing in the file LICENSE.LGPL3 included in the
  21. ** packaging of this file. Please review the following information to
  22. ** ensure the GNU Lesser General Public License version 3 requirements
  23. ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
  24. **
  25. ** GNU General Public License Usage
  26. ** Alternatively, this file may be used under the terms of the GNU
  27. ** General Public License version 2.0 or (at your option) the GNU General
  28. ** Public license version 3 or any later version approved by the KDE Free
  29. ** Qt Foundation. The licenses are as published by the Free Software
  30. ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
  31. ** included in the packaging of this file. Please review the following
  32. ** information to ensure the GNU General Public License requirements will
  33. ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
  34. ** https://www.gnu.org/licenses/gpl-3.0.html.
  35. **
  36. ** $QT_END_LICENSE$
  37. **
  38. ****************************************************************************/
  39. import QtQuick 2.2
  40. import QtQuick.Controls 1.2
  41. import QtQuick.Controls.Private 1.0
  42. /*!
  43. \qmltype TextAreaStyle
  44. \inqmlmodule QtQuick.Controls.Styles
  45. \since 5.2
  46. \ingroup controlsstyling
  47. \brief Provides custom styling for TextArea.
  48. Example:
  49. \qml
  50. TextArea {
  51. style: TextAreaStyle {
  52. textColor: "#333"
  53. selectionColor: "steelblue"
  54. selectedTextColor: "#eee"
  55. backgroundColor: "#eee"
  56. }
  57. }
  58. \endqml
  59. */
  60. ScrollViewStyle {
  61. id: style
  62. /*! The \l TextArea this style is attached to. */
  63. readonly property TextArea control: __control
  64. /*! The current font. */
  65. property font font
  66. /*! The text color. */
  67. property color textColor: SystemPaletteSingleton.text(control.enabled)
  68. /*! The text highlight color, used behind selections. */
  69. property color selectionColor: SystemPaletteSingleton.highlight(control.enabled)
  70. /*! The highlighted text color, used in selections. */
  71. property color selectedTextColor: SystemPaletteSingleton.highlightedText(control.enabled)
  72. /*! The background color. */
  73. property color backgroundColor: control.backgroundVisible ? SystemPaletteSingleton.base(control.enabled) : "transparent"
  74. /*!
  75. \qmlproperty enumeration renderType
  76. Override the default rendering type for the control.
  77. Supported render types are:
  78. \list
  79. \li Text.QtRendering
  80. \li Text.NativeRendering
  81. \endlist
  82. The default value is platform dependent.
  83. \sa Text::renderType
  84. */
  85. property int renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering
  86. /*! The default margin, in pixels, around the text in the TextArea.
  87. \since QtQuick.Controls.Styles 1.3
  88. \sa TextArea::textMargin */
  89. property real textMargin: 4
  90. /*! \internal
  91. The cursor handle.
  92. \since QtQuick.Controls.Styles 1.3
  93. The parent of the handle is positioned to the top left corner of
  94. the cursor position. The interactive area is determined by the
  95. geometry of the handle delegate.
  96. The following signals and read-only properties are available within the scope
  97. of the handle delegate:
  98. \table
  99. \row \li \b {styleData.activated()} [signal] \li Emitted when the handle is activated ie. the editor is clicked.
  100. \row \li \b {styleData.pressed} : bool \li Whether the handle is pressed.
  101. \row \li \b {styleData.position} : int \li The character position of the handle.
  102. \row \li \b {styleData.lineHeight} : real \li The height of the line the handle is on.
  103. \row \li \b {styleData.hasSelection} : bool \li Whether the editor has selected text.
  104. \endtable
  105. */
  106. property Component __cursorHandle
  107. /*! \internal
  108. The selection handle.
  109. \since QtQuick.Controls.Styles 1.3
  110. The parent of the handle is positioned to the top left corner of
  111. the first selected character. The interactive area is determined
  112. by the geometry of the handle delegate.
  113. The following signals and read-only properties are available within the scope
  114. of the handle delegate:
  115. \table
  116. \row \li \b {styleData.activated()} [signal] \li Emitted when the handle is activated ie. the editor is clicked.
  117. \row \li \b {styleData.pressed} : bool \li Whether the handle is pressed.
  118. \row \li \b {styleData.position} : int \li The character position of the handle.
  119. \row \li \b {styleData.lineHeight} : real \li The height of the line the handle is on.
  120. \row \li \b {styleData.hasSelection} : bool \li Whether the editor has selected text.
  121. \endtable
  122. */
  123. property Component __selectionHandle
  124. /*! \internal
  125. The cursor delegate.
  126. \since QtQuick.Controls.Styles 1.3
  127. */
  128. property Component __cursorDelegate
  129. /*! \internal
  130. The delegate for the cut/copy/paste menu.
  131. \since QtQuick.Controls.Styles 1.4
  132. */
  133. property Component __editMenu
  134. }