KeyboardLayout QML Type
键盘布局。更多
Import Statement: | import QtQuick.VirtualKeyboard.Components |
Inherits: |
属性
- inputMethod : var
- inputMode : int
- keyWeight : real
- sharedLayouts : var
- smallTextVisible : bool
(since QtQuick.VirtualKeyboard 2.0)
方法
详细说明
该类型是键盘布局的根元素。使用此元素可构建新的键盘布局。
示例:属性文档
import QtQuick import QtQuick.Layouts import QtQuick.VirtualKeyboard // file: layouts/en_GB/main.qml KeyboardLayout { KeyboardRow { Key { key: Qt.Key_Q text: "q" } Key { key: Qt.Key_W text: "w" } Key { key: Qt.Key_E text: "e" } Key { key: Qt.Key_R text: "r" } Key { key: Qt.Key_T text: "t" } Key { key: Qt.Key_Y text: "y" } } }
属性文档
inputMethod : var |
设置此布局中使用的输入法。
此属性允许在此布局中使用自定义输入法。
inputMode : int |
设置此布局中使用的输入模式。
默认情况下,当切换到不同的键盘布局时,虚拟键盘会尝试保留当前的输入模式。
如果当前输入模式在当前上下文中无效,则默认输入模式由输入法指定。
keyWeight : real |
设置所有子键的键重。
默认值从布局层次结构中的父元素继承。
sharedLayouts : var |
共享createInputMethod() 函数创建的输入法的布局名称列表。
如果该列表为空(默认值),则该输入法不与任何其他布局共享,并将在布局更改时被销毁。
列表应只包含布局类型的名称,例如['symbols']。当前布局不必包含在列表中。
smallTextVisible : bool |
为所有子键设置smallTextVisible
。
默认值从布局层次结构中的父元素继承。
该属性在 QtQuick.VirtualKeyboard 2.0 中引入。
方法文档
createInputMethod() |
该函数可由键盘布局重载,以动态创建输入法对象。默认实现返回null
。
在某些情况下,此函数创建的输入法对象可能会比键盘布局转换的时间长。这尤其适用于sharedLayouts 属性中列出的布局之间的转换。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.