KeyboardLayoutLoader QML Type

Allows dynamic loading of keyboard layout. 更多...

import 语句: import QtQuick.VirtualKeyboard 2.15
Since: QtQuick.VirtualKeyboard 1.1
继承:

Loader

特性

方法

详细描述

This type is useful for keyboard layouts consisting of multiple pages of keys.

A single keyboard layout (a page) is defined by using the Component as a container. The active keyboard layout can then be changed by setting the sourceComponent property to a different value.

范例:

import QtQuick 2.0
import QtQuick.Layouts 1.0
import QtQuick.VirtualKeyboard 2.1
// file: layouts/en_GB/symbols.qml
KeyboardLayoutLoader {
    property bool secondPage
    onVisibleChanged: if (!visible) secondPage = false
    sourceComponent: secondPage ? page2 : page1
    Component {
        id: page1
        KeyboardLayout {
            // Keyboard layout definition for page 1
        }
    }
    Component {
        id: page2
        KeyboardLayout {
            // Keyboard layout definition for page 2
        }
    }
}
					

特性文档编制

inputMethod : var

Sets the input method for all the keyboard layouts loaded in this context.

The input method can either be set separately for each keyboard layout, or commonly at this context. If set separately, then this property should not be modified.

inputMode : int

Sets the input mode for all the keyboard layouts loaded in this context.

The input mode can either be set separately for each keyboard layout, or commonly at this context. If set separately, then this property should not be modified.

sharedLayouts : var

List of layout names which share the input method created by the createInputMethod() 函数。

If the list is empty (the default) the input method is not shared with any other layout and will be destroyed when the layout changes.

The list should contain only the name of the layout type, e.g., ['symbols']. The current layout does not have to be included in the list.

方法文档编制

createInputMethod ()

This function may be overridden by the keyboard layout to create the input method object dynamically. The default implementation forwards the call to the child keyboard layout.

The input method object created by this function can outlive keyboard layout transitions in certain cases. In particular, this applies to the transitions between the layouts listed in the sharedLayouts 特性。