KeyPanel.qml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 KeyPanel
  6. \inqmlmodule QtQuick.VirtualKeyboard.Styles
  7. \brief A base type of the styled keys.
  8. \ingroup qmlclass
  9. \ingroup qtvirtualkeyboard-styles-qml
  10. All the key delegates provided by the style should be based on this type.
  11. */
  12. Item {
  13. /*! Provides access to properties in BaseKey.
  14. A list of available properties in control:
  15. \list
  16. \li \c control.key Unicode code of the key.
  17. \li \c control.text Unicode text of the key.
  18. \li \c control.displayText Display text of the key.
  19. \li \c control.smallText Small text of the key, usually rendered in the corner of the key.
  20. \li \c control.smallTextVisible Visibility of the small text.
  21. \li \c control.alternativeKeys List of alternative key sequences.
  22. \li \c control.enabled Set to true when the key is enabled.
  23. \li \c control.pressed Set to true when the key is currently pressed.
  24. \li \c control.uppercased Set to true when the key is uppercased.
  25. \endlist
  26. */
  27. property Item control
  28. /*!
  29. \since QtQuick.VirtualKeyboard.Styles 1.1
  30. Sets the sound effect to be played on key press.
  31. */
  32. property url soundEffect
  33. // Uncomment the following to reveal the key sizes
  34. /*
  35. Rectangle {
  36. id: root
  37. z: 1
  38. color: "transparent"
  39. border.color: "white"
  40. anchors.fill: parent
  41. Rectangle {
  42. color: "black"
  43. opacity: 0.6
  44. anchors.top: parent.top
  45. anchors.topMargin: 1
  46. anchors.left: parent.left
  47. anchors.leftMargin: 1
  48. implicitWidth: keyPanelInfoText.width + 4
  49. implicitHeight: keyPanelInfoText.height + 4
  50. Text {
  51. id: keyPanelInfoText
  52. property point pos: keyboard.keyboardLayoutLoader.item.mapFromItem(root.parent, 0, 0)
  53. text: "(%1,%2)\n%3x%4\nweight: %5".arg(pos.x).arg(pos.y).arg(root.parent.width).arg(root.parent.height).arg(root.parent.control.weight)
  54. font.pixelSize: 12
  55. color: "white"
  56. anchors.centerIn: parent
  57. }
  58. }
  59. }
  60. */
  61. }