KeyboardStyle.qml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. // Copyright (C) 2016 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
  3. import QtQuick
  4. /*!
  5. \qmltype KeyboardStyle
  6. \inqmlmodule QtQuick.VirtualKeyboard.Styles
  7. \brief Provides a styling interface for the Virtual Keyboard.
  8. \ingroup qmlclass
  9. \ingroup qtvirtualkeyboard-styles-qml
  10. The style type provides the style definitions that are used by
  11. the InputPanel to decorate the virtual keyboard.
  12. The design size specifies the aspect ratio of the virtual keyboard.
  13. Styles are scalable according to \l scaleHint, which is
  14. calculated from the keyboard's actual height and design height.
  15. */
  16. QtObject {
  17. /*! The current height of the keyboard. */
  18. property real keyboardHeight
  19. /*! The design width of the keyboard. */
  20. property real keyboardDesignWidth
  21. /*! The design height of the keyboard. */
  22. property real keyboardDesignHeight
  23. /*! The keyboard style scale hint. This value is determined by dividing
  24. \l keyboardHeight by \l keyboardDesignHeight. All pixel
  25. dimensions must be proportional to this value.
  26. */
  27. readonly property real scaleHint: keyboardHeight / keyboardDesignHeight
  28. /*!
  29. The distance between the left-most keys and the left edge of the
  30. keyboard, expressed as a percentage (\c 0.0 - \c 1.0) of the keyboard's
  31. width.
  32. */
  33. property real keyboardRelativeLeftMargin: 0
  34. /*!
  35. The distance between the right-most keys and the right edge of the
  36. keyboard, expressed as a percentage (\c 0.0 - \c 1.0) of the keyboard's
  37. width.
  38. This value is proportional to the keyboard's width.
  39. */
  40. property real keyboardRelativeRightMargin: 0
  41. /*!
  42. The distance between the top-most keys and the top edge of the
  43. keyboard, expressed as a percentage (\c 0.0 - \c 1.0) of the keyboard's
  44. height.
  45. */
  46. property real keyboardRelativeTopMargin: 0
  47. /*!
  48. The distance between the bottom-most keys and the bottom edge of the
  49. keyboard container, expressed as a percentage (\c 0.0 - \c 1.0) of the
  50. keyboard's height.
  51. */
  52. property real keyboardRelativeBottomMargin: 0
  53. /*! Template for the keyboard background.
  54. Example:
  55. \code
  56. keyboardBackground: Rectangle {
  57. color: "black"
  58. }
  59. \endcode
  60. */
  61. property Component keyboardBackground: null
  62. /*! Template for the regular keys.
  63. \note The delegate must be based on the KeyPanel type.
  64. Example:
  65. \code
  66. keyPanel: KeyPanel {
  67. Rectangle {
  68. anchors.fill: parent
  69. ...
  70. Text {
  71. anchors.fill: parent
  72. text: control.displayText
  73. ...
  74. }
  75. }
  76. }
  77. \endcode
  78. */
  79. property Component keyPanel: null
  80. /*! Template for the backspace key.
  81. \note The delegate must be based on the KeyPanel type.
  82. */
  83. property Component backspaceKeyPanel: null
  84. /*! Template for the language key.
  85. \note The delegate must be based on the KeyPanel type.
  86. */
  87. property Component languageKeyPanel: null
  88. /*! Template for the enter key.
  89. \note The delegate must be based on the KeyPanel type.
  90. */
  91. property Component enterKeyPanel: null
  92. /*! Template for the hide key.
  93. \note The delegate must be based on the KeyPanel type.
  94. */
  95. property Component hideKeyPanel: null
  96. /*! Template for the shift key.
  97. \note The delegate must be based on the KeyPanel type.
  98. */
  99. property Component shiftKeyPanel: null
  100. /*! Template for the space key.
  101. \note The delegate must be based on the KeyPanel type.
  102. */
  103. property Component spaceKeyPanel: null
  104. /*! Template for the symbol mode key.
  105. \note The delegate must be based on the KeyPanel type.
  106. */
  107. property Component symbolKeyPanel: null
  108. /*! Template for the generic mode key.
  109. This template provides a visualization of the key in which the state
  110. can be on or off. This template is used in situations where the key label
  111. will remain the same regardless of status.
  112. The current state is available in the \c control.mode property.
  113. \note The delegate must be based on the KeyPanel type.
  114. */
  115. property Component modeKeyPanel: null
  116. /*! Template for the handwriting mode key.
  117. \note The delegate must be based on the KeyPanel type.
  118. */
  119. property Component handwritingKeyPanel: null
  120. /*!
  121. Number of pixels between the top of each key and the bottom of the
  122. characterPreviewDelegate.
  123. */
  124. property real characterPreviewMargin: 0
  125. /*! Template for the character preview popup.
  126. If the delegate contains the \c text property, the property is updated
  127. with the display text when the component becomes active.
  128. \code
  129. property string text
  130. \endcode
  131. Example:
  132. \code
  133. characterPreviewDelegate: Item {
  134. property string text
  135. id: characterPreview
  136. Rectangle {
  137. id: characterPreviewBackground
  138. anchors.fill: parent
  139. ...
  140. Text {
  141. text: characterPreview.text
  142. anchors.fill: parent
  143. ...
  144. }
  145. }
  146. }
  147. \endcode
  148. */
  149. property Component characterPreviewDelegate: null
  150. /*! Width of the alternate keys list item. */
  151. property real alternateKeysListItemWidth: 0
  152. /*! Height of the alternate keys list item. */
  153. property real alternateKeysListItemHeight: 0
  154. /*! Top margin for the alternate keys list panel. */
  155. property real alternateKeysListTopMargin: 0
  156. /*! Bottom margin for the alternate keys list panel. */
  157. property real alternateKeysListBottomMargin: 0
  158. /*! Left margin for the alternate keys list panel. */
  159. property real alternateKeysListLeftMargin: 0
  160. /*! Right margin for the alternate keys list panel. */
  161. property real alternateKeysListRightMargin: 0
  162. /*! Template for the alternative keys list item.
  163. \note The delegate is used in a \l ListView.
  164. */
  165. property Component alternateKeysListDelegate: null
  166. /*! Template for the alternative keys list highlight.
  167. \note The delegate is used as \c ListView.highlight.
  168. */
  169. property Component alternateKeysListHighlight: null
  170. /*! Template for the alternative keys list background. */
  171. property Component alternateKeysListBackground: null
  172. /*! Selection list height. */
  173. property real selectionListHeight: 0
  174. /*! Template for the selection list item.
  175. \note The delegate is used in a \l ListView.
  176. \note The delegate must be based on the \l SelectionListItem type.
  177. The following properties are available to the item:
  178. \list
  179. \li \c display Display text for the current item.
  180. \li \c wordCompletionLength Word completion length measured from the end of the display text.
  181. \li \c dictionary Dictionary type of the word, see QVirtualKeyboardSelectionListModel::DictionaryType.
  182. \li \c canRemoveSuggestion A boolean indicating if the word can be removed from dictionary.
  183. \endlist
  184. */
  185. property Component selectionListDelegate: null
  186. /*! Template for the selection list highlight.
  187. \note The delegate is used as \c ListView.highlight.
  188. */
  189. property Component selectionListHighlight: null
  190. /*! Template for the selection list background. */
  191. property Component selectionListBackground: null
  192. /*! \since QtQuick.VirtualKeyboard.Styles 1.3
  193. This property holds the transition to apply to items that
  194. are added to the selection list view.
  195. */
  196. property Transition selectionListAdd
  197. /*! \since QtQuick.VirtualKeyboard.Styles 1.3
  198. This property holds the transition to apply to items that
  199. are removed from the selection list view.
  200. */
  201. property Transition selectionListRemove
  202. /*!
  203. \since QtQuick.VirtualKeyboard.Styles 1.1
  204. Template for the navigation highlight item.
  205. This item is used in \l {Configuration Options}{arrow-key-navigation}
  206. mode to highlight the navigation focus on the keyboard.
  207. The item is typically a transparent rectangle with a
  208. high contrast border.
  209. */
  210. property Component navigationHighlight: null
  211. /*!
  212. \since QtQuick.VirtualKeyboard.Styles 2.1
  213. Template for the trace input key.
  214. \note The delegate must be based on the TraceInputKeyPanel type.
  215. */
  216. property Component traceInputKeyPanelDelegate: null
  217. /*!
  218. \since QtQuick.VirtualKeyboard.Styles 2.1
  219. Template for rendering a Trace object.
  220. \note The delegate must be based on the TraceCanvas type.
  221. */
  222. property Component traceCanvasDelegate: null
  223. /*! \since QtQuick.VirtualKeyboard.Styles 2.1
  224. Template for the popup list item.
  225. \note The delegate is used in a \l ListView.
  226. \note The delegate must be based on the \l SelectionListItem type.
  227. The following properties are available to the item:
  228. \list
  229. \li \c display Display text for the current item.
  230. \li \c wordCompletionLength Word completion length measured from the end of the display text.
  231. \li \c dictionary Dictionary type of the word, see QVirtualKeyboardSelectionListModel::DictionaryType.
  232. \li \c canRemoveSuggestion A boolean indicating if the word can be removed from dictionary.
  233. \endlist
  234. */
  235. property Component popupListDelegate: null
  236. /*! \since QtQuick.VirtualKeyboard.Styles 2.1
  237. Template for the popup list highlight.
  238. \note The delegate is used as \c ListView.highlight.
  239. */
  240. property Component popupListHighlight: null
  241. /*! \since QtQuick.VirtualKeyboard.Styles 2.1
  242. Template for the popup list background.
  243. */
  244. property Component popupListBackground: null
  245. /*! \since QtQuick.VirtualKeyboard.Styles 2.1
  246. This property holds the transition to apply to items that
  247. are added to the popup list view.
  248. */
  249. property Transition popupListAdd
  250. /*! \since QtQuick.VirtualKeyboard.Styles 2.1
  251. This property holds the transition to apply to items that
  252. are removed from the popup list view.
  253. */
  254. property Transition popupListRemove
  255. /*! \since QtQuick.VirtualKeyboard.Styles 2.1
  256. This property determines whether a popup list will be shown when the
  257. language key is clicked. If this property is \c false, clicking the
  258. language key cycles through the available languages one at a time.
  259. The default value is \c false.
  260. */
  261. property bool languagePopupListEnabled: false
  262. /*! \since QtQuick.VirtualKeyboard.Styles 2.1
  263. Template for the language list item.
  264. \note The delegate is used in a \l ListView.
  265. \note The delegate must be based on the \l SelectionListItem type.
  266. The following properties are available to the item:
  267. \list
  268. \li \c displayName Display name of the language.
  269. \endlist
  270. */
  271. property Component languageListDelegate: null
  272. /*! \since QtQuick.VirtualKeyboard.Styles 2.1
  273. Template for the language list highlight.
  274. \note The delegate is used as \c ListView.highlight.
  275. */
  276. property Component languageListHighlight: null
  277. /*! \since QtQuick.VirtualKeyboard.Styles 2.1
  278. Template for the language list background.
  279. */
  280. property Component languageListBackground: null
  281. /*! \since QtQuick.VirtualKeyboard.Styles 2.1
  282. This property holds the transition to apply to items that
  283. are added to the language list view.
  284. */
  285. property Transition languageListAdd
  286. /*! \since QtQuick.VirtualKeyboard.Styles 2.1
  287. This property holds the transition to apply to items that
  288. are removed from the language list view.
  289. */
  290. property Transition languageListRemove
  291. /*!
  292. \since QtQuick.VirtualKeyboard.Styles 2.1
  293. This item is used to indicate where the bounds of the text selection is
  294. and to be able to interactively move the start or end of the selection.
  295. The same item is used for both start and end selection.
  296. Selection handles are currently only supported for the
  297. \l {Integration Method}{application-based integration method}.
  298. */
  299. property Component selectionHandle: null
  300. /*!
  301. \since QtQuick.VirtualKeyboard.Styles 2.2
  302. This property holds the delegate for the background of the full screen
  303. input container.
  304. */
  305. property Component fullScreenInputContainerBackground: null
  306. /*!
  307. \since QtQuick.VirtualKeyboard.Styles 2.2
  308. This property holds the delegate for the background of the full screen
  309. input.
  310. */
  311. property Component fullScreenInputBackground: null
  312. /*!
  313. \since QtQuick.VirtualKeyboard.Styles 2.2
  314. This property holds the margins around the full screen input field.
  315. The default value is \c 0.
  316. */
  317. property real fullScreenInputMargins: 0
  318. /*!
  319. \since QtQuick.VirtualKeyboard.Styles 2.2
  320. This property holds the padding around the full screen input content.
  321. The default value is \c 0.
  322. */
  323. property real fullScreenInputPadding: 0
  324. /*!
  325. \since QtQuick.VirtualKeyboard.Styles 2.2
  326. This property holds the delegate for the cursor in the full screen input
  327. field.
  328. The delegate should toggle the visibility of the cursor according to
  329. the \c {parent.blinkStatus} property defined for the full screen input
  330. field. For example:
  331. \code
  332. fullScreenInputCursor: Rectangle {
  333. width: 1
  334. color: "#000"
  335. visible: parent.blinkStatus
  336. }
  337. \endcode
  338. */
  339. property Component fullScreenInputCursor: null
  340. /*!
  341. \since QtQuick.VirtualKeyboard.Styles 2.2
  342. This property holds the \c font for the full screen input field.
  343. */
  344. property font fullScreenInputFont
  345. /*!
  346. \since QtQuick.VirtualKeyboard.Styles 2.2
  347. This property holds the password mask character for the full screen
  348. input field.
  349. */
  350. property string fullScreenInputPasswordCharacter: "\u2022"
  351. /*!
  352. \since QtQuick.VirtualKeyboard.Styles 2.2
  353. This property holds the text color for the full screen input field.
  354. The default color is black.
  355. */
  356. property color fullScreenInputColor: "#000"
  357. /*!
  358. \since QtQuick.VirtualKeyboard.Styles 2.2
  359. This property holds the selection color for the full screen input
  360. field.
  361. The default color is semi-transparent black.
  362. */
  363. property color fullScreenInputSelectionColor: Qt.rgba(0, 0, 0, 0.15)
  364. /*!
  365. \since QtQuick.VirtualKeyboard.Styles 2.2
  366. This property holds the selected text color for the full screen input
  367. field.
  368. The default color is set to \c fullScreenInputColor.
  369. */
  370. property color fullScreenInputSelectedTextColor: fullScreenInputColor
  371. /*! \since QtQuick.VirtualKeyboard.Styles 6.2
  372. Template for the function list item.
  373. \note The delegate is used in a \l ListView.
  374. The following properties are available to the item:
  375. \list
  376. \li \c keyboardFunction - Keyboard function of the current item.
  377. \endlist
  378. */
  379. property Component functionPopupListDelegate: null
  380. /*! \since QtQuick.VirtualKeyboard.Styles 6.2
  381. Template for the function popup list highlight.
  382. \note The delegate is used as \c ListView.highlight.
  383. */
  384. property Component functionPopupListHighlight: null
  385. /*! \since QtQuick.VirtualKeyboard.Styles 6.2
  386. Template for the function popup list background.
  387. */
  388. property Component functionPopupListBackground: null
  389. }