TraceInputKey.qml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // Copyright (C) 2016 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
  3. import QtQuick
  4. import QtQuick.Layouts
  5. /*!
  6. \qmltype TraceInputKey
  7. \inqmlmodule QtQuick.VirtualKeyboard.Components
  8. \ingroup qmlclass
  9. \ingroup qtvirtualkeyboard-components-qml
  10. \ingroup qtvirtualkeyboard-key-types
  11. \inherits Item
  12. \since QtQuick.VirtualKeyboard 2.0
  13. \brief A specialized key for collecting touch input data.
  14. This type can be placed in the keyboard layout. It collects
  15. and renders touch input data (trace) from the key area.
  16. */
  17. Item {
  18. id: traceInputKey
  19. /*! Sets the key weight value which determines the relative size of the key.
  20. Use this property to change the key size in the layout.
  21. The default value is inherited from the parent element
  22. of the key in the layout hierarchy.
  23. */
  24. property real weight: parent.keyWeight
  25. /*! Pattern recognition mode of this input area.
  26. The default value is \l {InputEngine::patternRecognitionModes} {InputEngine.PatternRecognitionMode.None}.
  27. */
  28. property alias patternRecognitionMode: traceInputArea.patternRecognitionMode
  29. /*! List of horizontal rulers in the input area.
  30. The rulers are defined as a number of pixels from the top edge of the bounding box.
  31. Here is an example that demonstrates how to define rulers:
  32. \code
  33. horizontalRulers: [boundingBox.height / 3, boundingBox.height / 3 * 2]
  34. verticalRulers: [boundingBox.width / 3, boundingBox.width / 3 * 2]
  35. \endcode
  36. */
  37. property alias horizontalRulers: traceInputArea.horizontalRulers
  38. /*! List of vertical rulers in the input area.
  39. The rulers are defined as a number of pixels from the left edge of the bounding box.
  40. */
  41. property alias verticalRulers: traceInputArea.verticalRulers
  42. /*! Bounding box for the trace input.
  43. This property is readonly and is automatically updated based on the item size
  44. and margins.
  45. */
  46. readonly property alias boundingBox: traceInputArea.boundingBox
  47. /*! Canvas type of this trace input area.
  48. This property can be used to distinguish between different types of canvases.
  49. The default value is \c "keyboard".
  50. */
  51. property alias canvasType: traceInputArea.canvasType
  52. Layout.minimumWidth: traceInputKeyPanel.implicitWidth
  53. Layout.minimumHeight: traceInputKeyPanel.implicitHeight
  54. Layout.preferredWidth: weight
  55. Layout.fillWidth: true
  56. Layout.fillHeight: true
  57. canvasType: "keyboard"
  58. Loader {
  59. id: traceInputKeyPanel
  60. sourceComponent: keyboard.style.traceInputKeyPanelDelegate
  61. anchors.fill: parent
  62. onLoaded: traceInputKeyPanel.item.control = traceInputKey
  63. }
  64. TraceInputArea {
  65. id: traceInputArea
  66. anchors.fill: traceInputKeyPanel
  67. anchors.margins: traceInputKeyPanel.item ? traceInputKeyPanel.item.traceMargins : 0
  68. }
  69. }