First upload, 18 controller version

This commit is contained in:
2026-04-14 15:23:56 +02:00
commit 8c55001a1c
3810 changed files with 764061 additions and 0 deletions

View File

@@ -0,0 +1,107 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
Item {
property bool active: listView.currentIndex != -1
property int highlightIndex: -1
property alias listView: listView
property int keyCode
property point origin
signal clicked
LayoutMirroring.enabled: false
LayoutMirroring.childrenInherit: true
z: 1
visible: active
anchors.fill: parent
ListModel {
id: listModel
}
ListView {
id: listView
spacing: 0
model: listModel
delegate: keyboard.style.alternateKeysListDelegate
highlight: keyboard.style.alternateKeysListHighlight ? keyboard.style.alternateKeysListHighlight : defaultHighlight
highlightMoveDuration: 0
highlightResizeDuration: 0
keyNavigationWraps: true
orientation: ListView.Horizontal
height: keyboard.style ? keyboard.style.alternateKeysListItemHeight : 0
x: origin.x
y: keyboard.style ? origin.y - height - keyboard.style.alternateKeysListBottomMargin : 0
Component {
id: defaultHighlight
Item {}
}
}
Loader {
id: backgroundLoader
sourceComponent: keyboard.style.alternateKeysListBackground
anchors.fill: listView
z: -1
states: State {
name: "highlighted"
when: highlightIndex !== -1 && highlightIndex === listView.currentIndex &&
backgroundLoader.item !== null && backgroundLoader.item.hasOwnProperty("currentItemHighlight")
PropertyChanges {
target: backgroundLoader.item
currentItemHighlight: true
}
}
}
onClicked: {
if (active && listView.currentIndex >= 0 && listView.currentIndex < listView.model.count) {
var activeKey = listView.model.get(listView.currentIndex)
InputContext.inputEngine.virtualKeyClick(keyCode, activeKey.data,
InputContext.uppercase ? Qt.ShiftModifier : 0)
}
}
function open(key, originX, originY) {
keyCode = key.key
var alternativeKeys = key.effectiveAlternativeKeys
var displayAlternativeKeys = key.displayAlternativeKeys
if (alternativeKeys.length > 0 && displayAlternativeKeys.length === alternativeKeys.length) {
for (var i = 0; i < alternativeKeys.length; i++) {
listModel.append({
"text": InputContext.uppercase ? displayAlternativeKeys[i].toUpperCase() : displayAlternativeKeys[i],
"data": InputContext.uppercase ? alternativeKeys[i].toUpperCase() : alternativeKeys[i]
})
}
listView.width = keyboard.style.alternateKeysListItemWidth * listModel.count
listView.forceLayout()
highlightIndex = key.effectiveAlternativeKeysHighlightIndex
if (highlightIndex === -1) {
console.log("AlternativeKeys: active key \"" + key.text + "\" not found in alternativeKeys \"" + alternativeKeys + ".\"")
highlightIndex = 0
}
listView.currentIndex = highlightIndex
var currentItemOffset = (listView.currentIndex + 0.5) * keyboard.style.alternateKeysListItemWidth
origin = Qt.point(Math.min(Math.max(keyboard.style.alternateKeysListLeftMargin, originX - currentItemOffset), width - listView.width - keyboard.style.alternateKeysListRightMargin), originY)
if (backgroundLoader.item && backgroundLoader.item.hasOwnProperty("currentItemOffset")) {
backgroundLoader.item.currentItemOffset = currentItemOffset
}
}
return active
}
function move(mouseX) {
var newIndex = listView.indexAt(Math.max(1, Math.min(listView.width - 1, mapToItem(listView, mouseX, 0).x)), 1)
if (newIndex !== listView.currentIndex) {
listView.currentIndex = newIndex
}
}
function close() {
listView.currentIndex = -1
listModel.clear()
}
}

View File

@@ -0,0 +1,28 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
/*!
\qmltype BackspaceKey
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\ingroup qtvirtualkeyboard-key-types
\inherits BaseKey
\brief Backspace key for keyboard layouts.
Sends a backspace key for input method processing.
This key is repeatable.
*/
BaseKey {
key: Qt.Key_Backspace
keyType: QtVirtualKeyboard.KeyType.BackspaceKey
repeat: true
functionKey: true
highlighted: true
keyPanelDelegate: keyboard.style ? keyboard.style.backspaceKeyPanel : undefined
}

View File

@@ -0,0 +1,234 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.Layouts
import QtQuick.VirtualKeyboard
/*!
\qmltype BaseKey
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\inherits Item
\brief Common parent for all key types.
BaseKey is a common type for all keys in keyboard layout.
This type should not be used directly in the layouts. The specialized
key types, such as Key or EnterKey should be used instead.
*/
Item {
id: keyItem
/*! \since QtQuick.VirtualKeyboard 6.1
\l Key type for the specialized key. Possible values are defined by the
{QtVirtualKeyboard::KeyType}{key type enumeration}.
For example, \l SpaceKey sets this value to \e QtVirtualKeyboard.KeyType.SpaceKey.
*/
property int keyType: QtVirtualKeyboard.KeyType.BaseKey
/*! Sets the key weight value which determines the relative size of the key.
Use this property to change the key size in the layout.
The default value is inherited from the parent element
of the key in the layout hierarchy.
*/
property real weight: parent.keyWeight
/*! Sets the key text for input method processing.
In most cases, this is the Unicode representation of the key code.
The default value is an empty string.
*/
property string text: ""
/*! Sets the display text.
This string is rendered in the keyboard layout.
The default value is the key text.
*/
property string displayText: text
/*! \since QtQuick.VirtualKeyboard 2.0
Sets the small text rendered in the corner of the key.
The default value based on the default item in the effective alternative keys.
*/
property string smallText: effectiveAlternativeKeys && effectiveAlternativeKeysHighlightIndex !== -1 ? effectiveAlternativeKeys[effectiveAlternativeKeysHighlightIndex] : ""
/*! \since QtQuick.VirtualKeyboard 2.0
Sets the visibility of small text.
The default value is inherited from the parent.
*/
property bool smallTextVisible: parent.smallTextVisible
/*! Sets the list of alternative keys.
This property can be set to a string, or a list of strings. If the value is
a string, the alternative keys are presented as individual characters of
that string. If the value is a list of strings, the list is used instead.
The alternative keys are presented to the user by pressing and holding a key
with this property set.
\note If the alternative keys contains the key \c text, it will be filtered from
the \c effectiveAlternativeKeys and its position will be used as an indicator
for the highlighted item instead.
The default is empty list.
*/
property var alternativeKeys: []
/*! \since QtQuick.VirtualKeyboard 2.0
This property contains the effective alternative keys presented to user.
The list is contains the items in the \c alternativeKeys excluding the \c text
item.
*/
readonly property var effectiveAlternativeKeys: {
var textIndex = alternativeKeys.indexOf(text)
if (textIndex == -1)
return alternativeKeys
return alternativeKeys.slice(0, textIndex).concat(alternativeKeys.slice(textIndex + 1))
}
/*! \since QtQuick.VirtualKeyboard 2.0
This property contains the index of highlighted item in the \c effectiveAlternativeKeys.
The index is calculated from the index of the key \c text in the \c alternativeKeys.
For example, if the alternative keys contains "çcċčć" and the key \c text is "c",
this index will become 1 and the effective alternative keys presented to user will
be "ç[ċ]čć".
*/
readonly property int effectiveAlternativeKeysHighlightIndex: {
var index = alternativeKeys.indexOf(text)
return index > 0 && (index + 1) == alternativeKeys.length ? index - 1 : index
}
/*! \since QtQuick.VirtualKeyboard 6.2
This property allows overriding the list of key strings presented to the user in the
alternative keys view.
*/
property var displayAlternativeKeys: effectiveAlternativeKeys
/*! Sets the key code for input method processing.
The default is Qt.Key_unknown.
*/
property int key: Qt.Key_unknown
/*! \since QtQuick.VirtualKeyboard 1.3
This property controls whether the key emits key events for input
method processing. When true, the key events are disabled.
By default, the key event is emitted if the \e key is not unknown
or the \e text is not empty.
*/
property bool noKeyEvent: key === Qt.Key_unknown && text.length === 0
/*! This property holds the active status of the key.
This property is automatically set to true when the key is pressed.
*/
property bool active: false
/*! \since QtQuick.VirtualKeyboard 1.3
Disables key modifiers on the emitted key.
The default is false.
*/
property bool noModifier: false
/*! Sets the key repeat attribute.
If the repeat is enabled, the key will repeat the input events while held down.
The repeat should not be used if alternativeKeys is also set.
The default is false.
*/
property bool repeat: false
/*! Sets the highlighted status of the key.
The default is false.
*/
property bool highlighted: false
/*! Sets the function key attribute.
The default is false.
*/
property bool functionKey: false
/*! Sets the show preview attribute.
By default, the character preview popup is not shown for function keys.
*/
property bool showPreview: enabled && !functionKey && !keyboard.navigationModeActive
/*! This property holds the pressed status of the key.
The pressed status can only be true if the key is both enabled and active.
When the key state becomes pressed, it triggers a key down event for the
input engine. A key up event is triggered when the key is released.
*/
property bool pressed: enabled && active
/*! This property holds the uppercase status of the key.
By default, this property reflects the uppercase status of the keyboard.
*/
property bool uppercased: InputContext.uppercase && !noModifier
/*! Sets the key panel delegate for the key.
This property is essential for key decoration. Without a key panel delegate,
the key is invisible. This property should be assigned in the inherited key type.
*/
property alias keyPanelDelegate: keyPanel.sourceComponent
/*!
\since QtQuick.VirtualKeyboard 1.1
This property holds the sound effect to be played on key press.
This property is read-only since the sound effects are defined in the keyboard style.
*/
readonly property url soundEffect: keyPanel.item ? keyPanel.item.soundEffect : ""
onSoundEffectChanged: keyboard.soundEffect.register(soundEffect)
Layout.minimumWidth: keyPanel.implicitWidth
Layout.minimumHeight: keyPanel.implicitHeight
Layout.preferredWidth: weight
Layout.fillWidth: true
Layout.fillHeight: true
Loader {
id: keyPanel
anchors.fill: parent
onLoaded: keyPanel.item.control = keyItem
}
/*! This signal is triggered when the key is pressed, allowing custom processing
of key.
*/
signal clicked
}

View File

@@ -0,0 +1,53 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
import QtQuick.VirtualKeyboard.Settings
/*!
\qmltype ChangeLanguageKey
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\ingroup qtvirtualkeyboard-key-types
\inherits BaseKey
\brief Change language key for keyboard layouts.
This key changes the current input language in the list of supported
languages. The key has two function modes:
\list
\li Popup mode
\li Toggle mode
\endlist
The popup mode is enabled by the \l {KeyboardStyle::languagePopupListEnabled} property.
If enabled, a key press will open a popup list with available languages. Otherwise
it will cycle to the next available input language.
*/
BaseKey {
/*! If this property is true, the input language is only
changed between the languages providing custom layout.
For example, if only the English and Arabic languages
provide digits layout, then other locales using the
shared default layout are ignored.
The default is false.
*/
property bool customLayoutsOnly: false
id: changeLanguageKey
keyType: QtVirtualKeyboard.KeyType.ChangeLanguageKey
objectName: "changeLanguageKey"
functionKey: true
highlighted: true
displayText: keyboard.locale.split("_")[0]
keyPanelDelegate: keyboard.style ? keyboard.style.languageKeyPanel : undefined
onClicked: keyboard.doKeyboardFunction(QtVirtualKeyboard.KeyboardFunction.ChangeLanguage, customLayoutsOnly)
enabled: keyboard.isKeyboardFunctionAvailable(QtVirtualKeyboard.KeyboardFunction.ChangeLanguage, customLayoutsOnly)
visible: VirtualKeyboardSettings.visibleFunctionKeys & QtVirtualKeyboard.KeyboardFunctionKeys.Language
}

View File

@@ -0,0 +1,60 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
Item {
property bool active
property Item activeKey: keyboard.activeKey
visible: active && activeKey !== undefined && activeKey !== null && activeKey.showPreview
z: 1
Loader {
id: characterPreview
anchors.fill: parent
sourceComponent: keyboard.style.characterPreviewDelegate
}
Binding {
target: characterPreview.item
property: "text"
value: {
if (!activeKey)
return ""
const displayText = (activeKey.keyType === QtVirtualKeyboard.KeyType.FlickKey) ? activeKey.text : activeKey.displayText
return InputContext.uppercase ? displayText.toUpperCase() : displayText
}
when: activeKey && characterPreview.item
}
onActiveKeyChanged: {
if (characterPreview.item !== null) {
if (!activeKey)
return
if (activeKey.keyType === QtVirtualKeyboard.KeyType.FlickKey) {
if (characterPreview.item.hasOwnProperty("flickLeft")) {
characterPreview.item.flickLeft = activeKey.flickLeft
characterPreview.item.flickRight = activeKey.flickRight
characterPreview.item.flickTop = activeKey.flickTop
characterPreview.item.flickBottom = activeKey.flickBottom
}
} else {
if (characterPreview.item.hasOwnProperty("flickLeft")) {
characterPreview.item.flickLeft = ""
characterPreview.item.flickRight = ""
characterPreview.item.flickTop = ""
characterPreview.item.flickBottom = ""
}
}
width = activeKey.width
height = activeKey.height
var position = keyboard.mapFromItem(activeKey, 0, 0)
x = position.x
y = position.y - height - keyboard.style.characterPreviewMargin
}
}
}

View File

@@ -0,0 +1,34 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
/*!
\qmltype EnterKey
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\ingroup qtvirtualkeyboard-key-types
\inherits BaseKey
\brief Enter key for keyboard layouts.
Sends an enter key for input method processing.
*/
BaseKey {
/*! This property holds the action id for the enter key.
*/
readonly property int actionId: InputContext.priv.hasEnterKeyAction(InputContext.priv.inputItem) ? InputContext.priv.inputItem.EnterKeyAction.actionId : EnterKeyAction.None
keyType: QtVirtualKeyboard.KeyType.EnterKey
text: "\n"
displayText: InputContext.priv.hasEnterKeyAction(InputContext.priv.inputItem) ? InputContext.priv.inputItem.EnterKeyAction.label : ""
key: Qt.Key_Return
showPreview: false
highlighted: true
enabled: InputContext.priv.hasEnterKeyAction(InputContext.priv.inputItem) ? InputContext.priv.inputItem.EnterKeyAction.enabled : true
keyPanelDelegate: keyboard.style ? keyboard.style.enterKeyPanel : undefined
}

View File

@@ -0,0 +1,23 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
/*!
\qmltype FillerKey
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\ingroup qtvirtualkeyboard-key-types
\inherits BaseKey
\brief Filler key for keyboard layouts.
This key can be used as a filler in the keyboard layout.
*/
BaseKey {
keyType: QtVirtualKeyboard.KeyType.FillerKey
showPreview: false
}

View File

@@ -0,0 +1,96 @@
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
/*!
\qmltype FlickKey
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\ingroup qtvirtualkeyboard-key-types
\inherits Key
\since QtQuick.VirtualKeyboard 6.1
\brief Flick key for keyboard layouts.
Allows to enter an alternative character in a four-way gesture.
Characters are taken from the alternate keys starting with the
key at index \c 0 (excluding the main key text) and the positions
are filled in the following order: left, top, bottom, right.
*/
Key {
property int __key
property string __text
property point pt1
readonly property real __centerRadius: width * 0.4
readonly property var flickKeys: {
var keys = InputContext.uppercase ? alternativeKeys.toUpperCase() : alternativeKeys.toLowerCase()
var textIndex = __text ? keys.indexOf(InputContext.uppercase ? __text.toUpperCase() : __text.toLowerCase()) : -1
if (textIndex === -1)
return keys
return keys.slice(0, textIndex).concat(keys.slice(textIndex + 1))
}
property string flickLeft: flickKeys.length > 0 ? flickKeys[0] : ""
property string flickTop: flickKeys.length > 2 ? flickKeys[1] : ""
property string flickBottom: flickKeys.length > 3 ? flickKeys[3] : (flickKeys.length > 2 ? flickKeys[2] : "")
property string flickRight: flickKeys.length > 3 ? flickKeys[2] : (flickKeys.length === 2 ? flickKeys[1] : "")
keyType: QtVirtualKeyboard.KeyType.FlickKey
Component.onCompleted: {
__key = key
__text = text
}
onActiveChanged: {
key = __key
text = __text
}
function __angle(pt2) {
var dx = pt2.x - pt1.x
var dy = pt2.y - pt1.y
var theta = Math.atan2(-dy, dx) * 360 / (2 * Math.PI)
var theta_normalized = theta < 0 ? theta + 360 : theta
return theta_normalized >= 360 ? 0 : theta_normalized
}
function __distance(pt2) {
var dx = pt2.x - pt1.x
dx = dx * dx
var dy = pt2.y - pt1.y
dy = dy * dy
return Math.sqrt(dx + dy)
}
function press(x, y) {
pt1 = Qt.point(x, y)
}
function update(x, y) {
var pt = Qt.point(x, y)
var distance = __distance(pt)
if (distance < __centerRadius) {
return
}
var currentText
var angle = __angle(pt)
if (angle < 45 || angle > 315) {
currentText = flickRight
} else if (angle < 135) {
currentText = flickTop
} else if (angle < 225) {
currentText = flickLeft
} else {
currentText = flickBottom
}
if (currentText.length === 1 && text !== currentText) {
key = currentText.toUpperCase().charCodeAt(0)
text = currentText
}
}
}

View File

@@ -0,0 +1,110 @@
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
import QtQuick.VirtualKeyboard.Settings
Item {
property bool active
property alias listView: listView
property point origin
signal clicked
LayoutMirroring.enabled: false
LayoutMirroring.childrenInherit: true
z: 1
visible: active
anchors.fill: parent
ListModel {
id: listModel
}
ListView {
id: listView
spacing: 0
model: listModel
currentIndex: -1
delegate: keyboard.style.functionPopupListDelegate
highlight: keyboard.style.functionPopupListHighlight ? keyboard.style.functionPopupListHighlight : defaultHighlight
highlightMoveDuration: 0
highlightResizeDuration: 0
keyNavigationWraps: true
orientation: ListView.Horizontal
width: contentItem.childrenRect.width
height: contentItem.childrenRect.height
x: {
var result = origin.x
if (count > 0) {
const item = itemAtIndex(0)
if (item) {
result -= Math.round(item.width / 2)
}
}
return result
}
y: origin.y - height
Component {
id: defaultHighlight
Item {}
}
}
Loader {
id: backgroundLoader
sourceComponent: keyboard.style.functionPopupListBackground
anchors.fill: listView
z: -1
Binding {
target: backgroundLoader.item
property: "view"
value: listView
when: backgroundLoader.item && backgroundLoader.item.hasOwnProperty("view")
}
}
onClicked: {
if (active && listView.currentIndex >= 0 && listView.currentIndex < listView.model.count) {
const listElement = listView.model.get(listView.currentIndex)
keyboard.doKeyboardFunction(listElement.keyboardFunction)
}
}
function open(key, originX, originY) {
listModel.clear()
for (const keyboardFunction of [
QtVirtualKeyboard.KeyboardFunction.HideInputPanel,
QtVirtualKeyboard.KeyboardFunction.ChangeLanguage,
QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode,
]) {
const functionKey = InputContext.priv.keyboardFunctionKey(keyboardFunction)
if (keyboard.isKeyboardFunctionAvailable(keyboardFunction) &&
!(VirtualKeyboardSettings.visibleFunctionKeys & functionKey)) {
const listElement = {
keyboardFunction: keyboardFunction
}
listModel.append(listElement)
}
}
listView.currentIndex = (listModel.count > 0) ? 0 : -1
origin = Qt.binding(function() {
return Qt.point(Math.min(Math.max(0, originX), width - listView.width), originY)
})
active = listView.currentIndex !== -1
return active
}
function move(pt) {
var listPt = mapToItem(listView, pt.x, pt.y)
var newIndex = listView.indexAt(listPt.x, Math.max(1, Math.min(listView.height - 1, listPt.y)))
if (newIndex !== listView.currentIndex) {
listView.currentIndex = newIndex
}
}
function close() {
listView.currentIndex = -1
active = false
}
}

View File

@@ -0,0 +1,33 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
/*!
\qmltype HandwritingModeKey
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\ingroup qtvirtualkeyboard-key-types
\inherits Key
\since QtQuick.VirtualKeyboard 2.0
\brief Hand writing mode key for keyboard layouts.
This key toggles between the handwriting mode layout and the main layout.
The key is automatically hidden from the keyboard layout if handwriting support
is not enabled for the virtual keyboard.
*/
Key {
keyType: QtVirtualKeyboard.KeyType.HandwritingModeKey
key: Qt.Key_Context2
displayText: "HWR"
functionKey: true
highlighted: true
visible: keyboard.isKeyboardFunctionAvailable(QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode)
onClicked: keyboard.doKeyboardFunction(QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode)
keyPanelDelegate: keyboard.style ? keyboard.style.handwritingKeyPanel : undefined
}

View File

@@ -0,0 +1,28 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
import QtQuick.VirtualKeyboard.Settings
/*!
\qmltype HideKeyboardKey
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\ingroup qtvirtualkeyboard-key-types
\inherits BaseKey
\brief Hide keyboard key for keyboard layouts.
This key hides the keyboard from the user when pressed.
*/
BaseKey {
keyType: QtVirtualKeyboard.KeyType.HideKeyboardKey
functionKey: true
highlighted: true
onClicked: keyboard.doKeyboardFunction(QtVirtualKeyboard.KeyboardFunction.HideInputPanel)
keyPanelDelegate: keyboard.style ? keyboard.style.hideKeyPanel : undefined
visible: VirtualKeyboardSettings.visibleFunctionKeys & QtVirtualKeyboard.KeyboardFunctionKeys.Hide
}

View File

@@ -0,0 +1,104 @@
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
/*!
\qmltype InputModeKey
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\ingroup qtvirtualkeyboard-key-types
\inherits Key
\since QtQuick.VirtualKeyboard 2.3
\brief Input mode key for keyboard layouts.
This key toggles between available \l {QVirtualKeyboardInputEngine::inputModes} {InputEngine.inputModes}.
*/
Key {
keyType: QtVirtualKeyboard.KeyType.InputModeKey
key: Qt.Key_Mode_switch
noKeyEvent: true
functionKey: true
highlighted: true
text: InputContext.inputEngine.inputMode < inputModeNameList.length ?
inputModeNameList[InputContext.inputEngine.inputMode] : "ABC"
onClicked: InputContext.inputEngine.inputMode = __nextInputMode(InputContext.inputEngine.inputMode)
keyPanelDelegate: keyboard.style ? keyboard.style.symbolKeyPanel : undefined
enabled: inputModeCount > 1
/*!
List of input mode names.
The default list contains all known input modes for \l {QVirtualKeyboardInputEngine::inputMode} {InputEngine.inputMode}.
*/
property var inputModeNameList: [
"ABC", // InputEngine.InputMode.Latin
"123", // InputEngine.InputMode.Numeric
"123", // InputEngine.InputMode.Dialable
"拼音", // InputEngine.InputMode.Pinyin
"倉頡", // InputEngine.InputMode.Cangjie
"注音", // InputEngine.InputMode.Zhuyin
"한글", // InputEngine.InputMode.Hangul
"かな", // InputEngine.InputMode.Hiragana
"カナ", // InputEngine.InputMode.Katakana
"全角", // InputEngine.InputMode.FullwidthLatin
"ΑΒΓ", // InputEngine.InputMode.Greek
"АБВ", // InputEngine.InputMode.Cyrillic
"\u0623\u200C\u0628\u200C\u062C", // InputEngine.InputMode.Arabic
"\u05D0\u05D1\u05D2", // InputEngine.InputMode.Hebrew
"中文", // InputEngine.InputMode.ChineseHandwriting
"日本語", // InputEngine.InputMode.JapaneseHandwriting
"한국어", // InputEngine.InputMode.KoreanHandwriting
"กขค", // InputEngine.InputMode.Thai
"笔画", // InputEngine.InputMode.Stroke
"ABC", // InputEngine.InputMode.Romaji
"FLK", // InputEngine.InputMode.HiraganaFlick
]
/*!
List of input modes to toggle.
This property allows to define a custom list of input modes to
toggle.
The default list contains all the available input modes.
*/
property var inputModes: InputContext.inputEngine.inputModes
/*!
This read-only property reflects the actual number of input modes
the user can cycle through this key.
*/
readonly property int inputModeCount: __inputModes !== undefined ? __inputModes.length : 0
property var __inputModes: __filterInputModes([].concat(InputContext.inputEngine.inputModes), inputModes)
onInputModesChanged: {
// Check that the current input mode is included in our list
if (keyboard.active && InputContext.inputEngine.inputMode !== -1 &&
__inputModes !== undefined && __inputModes.length > 0 &&
__inputModes.indexOf(InputContext.inputEngine.inputMode) === -1)
InputContext.inputEngine.inputMode = __inputModes[0]
}
function __nextInputMode(inputMode) {
if (!enabled)
return inputMode
var inputModeIndex = __inputModes.indexOf(inputMode) + 1
if (inputModeIndex >= __inputModes.length)
inputModeIndex = 0
return __inputModes[inputModeIndex]
}
function __filterInputModes(inputModes, filter) {
for (var i = 0; i < inputModes.length; i++) {
if (filter.indexOf(inputModes[i]) === -1)
inputModes.splice(i, 1)
}
return inputModes
}
}

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
/*!
\qmltype Key
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\ingroup qtvirtualkeyboard-key-types
\inherits BaseKey
\brief Regular character key for keyboard layouts.
This key emits the key code and key text for input method processing.
*/
BaseKey {
id: keyItem
keyType: QtVirtualKeyboard.KeyType.Key
key: !functionKey && text.length > 0 ? text.toUpperCase().charCodeAt(0) : Qt.Key_unknown
keyPanelDelegate: keyboard.style ? keyboard.style.keyPanel : undefined
}

View File

@@ -0,0 +1,38 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.Layouts
/*!
\qmltype KeyboardColumn
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\inherits ColumnLayout
\brief Keyboard column for keyboard layouts.
This type can be used in special cases where multiple columns
are added to a single keyboard layout.
*/
ColumnLayout {
/*! Sets the key weight for all children keys.
The default value is inherited from the parent element
in the layout hierarchy.
*/
property real keyWeight: parent ? parent.keyWeight : undefined
/*! \since QtQuick.VirtualKeyboard 2.0
Sets the \c smallTextVisible for all children keys.
The default value is inherited from the parent element
in the layout hierarchy.
*/
property bool smallTextVisible: parent ? parent.smallTextVisible : false
spacing: 0
}

View File

@@ -0,0 +1,163 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.Layouts
import QtQuick.VirtualKeyboard
/*!
\qmltype KeyboardLayout
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\inherits ColumnLayout
\brief Keyboard layout.
This type is the root element of the keyboard layout.
Use this element to build a new keyboard layout.
Example:
\code
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"
}
}
}
\endcode
*/
ColumnLayout {
id: root
/*! Sets the input method to be used in this layout.
This property allows a custom input method to be
used in this layout.
*/
property var inputMethod
/*! This function may be overridden by the keyboard layout
to create the input method object dynamically. The default
implementation returns \c null.
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 property.
*/
function createInputMethod() {
return null
}
/*! List of layout names which share the input method created
by the createInputMethod() function.
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.
*/
property var sharedLayouts
/*! Sets the input mode to be used in this layout.
By default, the virtual keyboard attempts to preserve
the current input mode when switching to a different
keyboard layout.
If the current input mode is not valid in the current
context, the default input mode is specified by the
input method.
*/
property int inputMode: -1
/*! Sets the key weight for all children keys.
The default value is inherited from the parent element
in the layout hierarchy.
*/
property real keyWeight
/*! \since QtQuick.VirtualKeyboard 2.0
Sets the \c smallTextVisible for all children keys.
The default value is inherited from the parent element
in the layout hierarchy.
*/
property bool smallTextVisible
spacing: 0
function scanLayout() {
var layout = {
width: root.width,
height: root.height,
keys: []
}
__scanLayoutRecursive(this, layout)
return layout
}
function __scanLayoutRecursive(parent, layout) {
for (var i in parent.children) {
var child = parent.children[i]
if (child.keyType !== undefined) {
var pos = mapFromItem(child, 0, 0)
var key = {
left: pos.x,
top: pos.y,
width: child.width,
height: child.height,
keyType: child.keyType,
key: child.key,
text: child.text,
altKeys: child.effectiveAlternativeKeys,
isFunctionKey: child.functionKey,
noKeyEvent: child.noKeyEvent
}
if (key.left + key.width > layout.width)
layout.width = key.left + key.width
if (key.top + key.height > layout.height)
layout.height = key.top + key.height
layout.keys.push(key)
} else {
__scanLayoutRecursive(child, layout)
}
}
}
}

View File

@@ -0,0 +1,115 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
/*!
\qmltype KeyboardLayoutLoader
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\inherits Loader
\since QtQuick.VirtualKeyboard 1.1
\brief Allows dynamic loading of keyboard layout.
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.
Example:
\code
import QtQuick
import QtQuick.Layouts
import QtQuick.VirtualKeyboard
// 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
}
}
}
\endcode
*/
Loader {
/*! 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.
*/
property var inputMethod: item ? item.inputMethod : null
/*! 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 property.
*/
function createInputMethod() {
return item ? item.createInputMethod() : null
}
/*! List of layout names which share the input method created
by the createInputMethod() function.
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.
*/
property var sharedLayouts: item ? item.sharedLayouts : null
/*! 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.
*/
property int inputMode: item ? item.inputMode : -1
property int __updateCount
active: parent !== null
onItemChanged: {
if (parent && item && __updateCount++ > 0) {
if (!keyboard.inputMethodNeedsReset)
keyboard.updateInputMethod()
keyboard.notifyLayoutChanged()
}
}
function scanLayout() {
if (item === null)
return null
return item.scanLayout()
}
}

View File

@@ -0,0 +1,37 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.Layouts
/*!
\qmltype KeyboardRow
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\inherits RowLayout
\brief Keyboard row for keyboard layouts.
Specifies a row of keys in the keyboard layout.
*/
RowLayout {
/*! Sets the key weight for all children keys.
The default value is inherited from the parent element
in the layout hierarchy.
*/
property real keyWeight: parent ? parent.keyWeight : undefined
/*! \since QtQuick.VirtualKeyboard 2.0
Sets the \c smallTextVisible for all children keys.
The default value is inherited from the parent element
in the layout hierarchy.
*/
property bool smallTextVisible: parent ? parent.smallTextVisible : false
spacing: 0
}

View File

@@ -0,0 +1,42 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
/*!
\qmltype ModeKey
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\ingroup qtvirtualkeyboard-key-types
\inherits Key
\since QtQuick.VirtualKeyboard 2.0
\brief Generic mode key for keyboard layouts.
This key provides generic mode button functionality.
A key press toggles the current mode without emitting key event
for input method processing.
ModeKey can be used in situations where a particular mode is switched
"ON / OFF", and where the mode change does not require changing the
keyboard layout. When this component is used, the \l { BaseKey::displayText } { displayText } should
remain the same regardless of the mode, because the keyboard style
visualizes the status.
*/
Key {
/*! This property provides the current mode.
The default is false.
*/
property bool mode
keyType: QtVirtualKeyboard.KeyType.ModeKey
noKeyEvent: true
functionKey: true
highlighted: true
onClicked: mode = !mode
keyPanelDelegate: keyboard.style ? keyboard.style.modeKeyPanel : undefined
}

View File

@@ -0,0 +1,49 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtMultimedia
Item {
id: multiSoundEffect
property url source
property int maxInstances: 2
property var __cachedInstances
property int __currentIndex: 0
property real soundVolume: 1.0
signal playingChanged(url source, bool playing)
Component {
id: soundEffectComp
SoundEffect {
source: multiSoundEffect.source
onPlayingChanged: multiSoundEffect.playingChanged(source, playing)
}
}
onSourceChanged: {
__cachedInstances = []
__currentIndex = 0
if (source != Qt.resolvedUrl("")) {
var i
for (i = 0; i < maxInstances; i++) {
var soundEffect = soundEffectComp.createObject(multiSoundEffect)
if (soundEffect === null)
return
__cachedInstances.push(soundEffect)
}
}
}
function play() {
if (__cachedInstances === undefined || __cachedInstances.length === 0)
return
if (__cachedInstances[__currentIndex].playing) {
__cachedInstances[__currentIndex].stop()
__currentIndex = (__currentIndex + 1) % __cachedInstances.length
}
__cachedInstances[__currentIndex].volume = soundVolume
__cachedInstances[__currentIndex].play()
}
}

View File

@@ -0,0 +1,106 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard as VKB
VKB.InputMethod {
property string multitapSequence
property int multitapIndex: -1
onMultitapSequenceChanged: selectionListChanged(VKB.SelectionListModel.Type.WordCandidateList)
onMultitapIndexChanged: selectionListActiveItemChanged(VKB.SelectionListModel.Type.WordCandidateList, multitapIndex)
property variant multiTapTimer: Timer {
interval: 1200
onTriggered: {
update()
}
}
function inputModes(locale) {
return [VKB.InputEngine.InputMode.Latin, VKB.InputEngine.InputMode.Numeric, VKB.InputEngine.InputMode.Dialable];
}
function setInputMode(locale, inputMode) {
return true
}
function setTextCase(textCase) {
return true
}
function reset() {
multiTapTimer.stop()
multitapIndex = -1
multitapSequence = ""
}
function update() {
multiTapTimer.stop()
multitapIndex = -1
multitapSequence = ""
if (inputContext !== null && inputContext.preeditText.length > 0) {
inputContext.commit()
}
}
function keyEvent(key, text, modifiers) {
var accept = false
switch (key) {
case Qt.Key_Enter:
case Qt.Key_Return:
case Qt.Key_Tab:
update()
break
case Qt.Key_Backspace:
if (inputContext.preeditText.length > 0) {
inputContext.clear()
update()
accept = true
}
break
default:
if (key !== inputEngine.previousKey) {
update()
}
multitapSequence = text
if (multitapSequence.length > 1) {
multitapIndex = multiTapTimer.running ? (multitapIndex + 1) % multitapSequence.length : 0
inputContext.preeditText = multitapSequence.charAt(multitapIndex)
multiTapTimer.restart()
} else {
inputContext.commit(text)
}
accept = true
break
}
return accept;
}
function selectionLists() {
return [VKB.SelectionListModel.Type.WordCandidateList];
}
function selectionListItemCount(type) {
return multitapSequence.length > 1 ? multitapSequence.length : 0
}
function selectionListData(type, index, role) {
var result = null
switch (role) {
case VKB.SelectionListModel.Role.Display:
result = multitapSequence.charAt(index)
break
default:
break
}
return result
}
function selectionListItemSelected(type, index) {
multitapIndex = index
inputContext.preeditText = multitapSequence.charAt(multitapIndex)
update()
}
}

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
/*!
\qmltype NumberKey
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\ingroup qtvirtualkeyboard-key-types
\inherits Key
\brief Specialized number key for keyboard layouts.
This key emits the key code and key text for input method processing.
A NumberKey differs from a normal \l Key in that it does not show a
character preview.
*/
Key {
showPreview: false
keyType: QtVirtualKeyboard.KeyType.NumberKey
}

View File

@@ -0,0 +1,33 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
ListView {
property int maxVisibleItems: 5
readonly property int preferredVisibleItems: count < maxVisibleItems ? count : maxVisibleItems
readonly property real contentWidth: contentItem.childrenRect.width
property alias defaultHighlight: defaultHighlight
clip: true
visible: enabled && count > 0
width: contentWidth
height: currentItem ? currentItem.height * preferredVisibleItems + (spacing * preferredVisibleItems - 1) : 0
orientation: ListView.Vertical
snapMode: ListView.SnapToItem
delegate: keyboard.style.popupListDelegate
highlight: keyboard.style.popupListHighlight ? keyboard.style.popupListHighlight : defaultHighlight
highlightMoveDuration: 0
highlightResizeDuration: 0
add: !keyboard.noAnimations ? keyboard.style.popupListAdd : null
remove: !keyboard.noAnimations ? keyboard.style.popupListRemove : null
keyNavigationWraps: true
onCurrentItemChanged: if (currentItem) keyboard.soundEffect.register(currentItem.soundEffect)
Component {
id: defaultHighlight
Item {}
}
}

View File

@@ -0,0 +1,84 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
Item {
id: root
property bool handleIsMoving: false
property var inputContext: InputContext
visible: enabled && (inputContext.selectionControlVisible || handleIsMoving) && !InputContext.animating
Loader {
id: anchorHandle
sourceComponent: keyboard.style.selectionHandle
Behavior on opacity {
NumberAnimation { duration: 200 }
}
opacity: inputContext !== null && inputContext.anchorRectIntersectsClipRect ? 1.0 : 0.0
MouseArea {
width: parent.width * 2
height: width * 1.12
anchors.centerIn: parent
onPositionChanged: function(mouse) {
// we don't move the handles, the handles will move as the selection changes.
// The middle of a handle is mapped to the middle of the line above it
root.handleIsMoving = true
var xx = x + anchorHandle.x + mouse.x
var yy = y + anchorHandle.y + mouse.y - (anchorHandle.height + inputContext.anchorRectangle.height)/2
var x2 = cursorHandle.x + cursorHandle.width/2
var y2 = cursorHandle.y - inputContext.cursorRectangle.height/2
inputContext.setSelectionOnFocusObject(Qt.point(xx,yy), Qt.point(x2,y2))
}
onReleased: {
root.handleIsMoving = false
}
}
}
// selection cursor handle
Loader {
id: cursorHandle
sourceComponent: keyboard.style.selectionHandle
Behavior on opacity {
NumberAnimation { duration: 200 }
}
opacity: inputContext !== null && inputContext.cursorRectIntersectsClipRect ? 1.0 : 0.0
MouseArea {
width: parent.width * 2
height: width * 1.12
anchors.centerIn: parent
onPositionChanged: function(mouse) {
// we don't move the handles, the handles will move as the selection changes.
root.handleIsMoving = true
var xx = anchorHandle.x + anchorHandle.width/2
var yy = anchorHandle.y - inputContext.anchorRectangle.height/2
var x2 = x + cursorHandle.x + mouse.x
var y2 = y + cursorHandle.y + mouse.y - (cursorHandle.height + inputContext.cursorRectangle.height)/2
inputContext.setSelectionOnFocusObject(Qt.point(xx, yy), Qt.point(x2, y2))
}
onReleased: {
root.handleIsMoving = false
}
}
}
Connections {
target: inputContext
function onCursorRectangleChanged() {
var cursorItemPos = root.mapFromItem(null, inputContext.cursorRectangle.x, inputContext.cursorRectangle.y)
cursorHandle.x = cursorItemPos.x - cursorHandle.width/2
cursorHandle.y = cursorItemPos.y + inputContext.cursorRectangle.height
}
function onAnchorRectangleChanged() {
var anchorItemPos = root.mapFromItem(null, inputContext.anchorRectangle.x, inputContext.anchorRectangle.y)
anchorHandle.x = anchorItemPos.x - anchorHandle.width/2
anchorHandle.y = anchorItemPos.y + inputContext.anchorRectangle.height
}
}
}

View File

@@ -0,0 +1,129 @@
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
// Deliberately imported after QtQuick to avoid missing restoreMode property in Binding. Fix in Qt 6.
import QtQml
import QtQuick.VirtualKeyboard
import QtQuick.VirtualKeyboard.Settings
Item {
id: control
property alias textEdit: shadowInput
enabled: keyboard.active && VirtualKeyboardSettings.fullScreenMode
MouseArea {
anchors.fill: parent
}
onXChanged: InputContext.priv.shadow.updateSelectionProperties()
onYChanged: InputContext.priv.shadow.updateSelectionProperties()
Loader {
sourceComponent: keyboard.style.fullScreenInputContainerBackground
anchors.fill: parent
Loader {
id: fullScreenInputBackground
sourceComponent: keyboard.style.fullScreenInputBackground
anchors.fill: parent
anchors.margins: keyboard.style.fullScreenInputMargins
z: 1
Flickable {
id: flickable
clip: true
z: 2
width: parent.width
height: parent.height
flickableDirection: Flickable.HorizontalFlick
interactive: contentWidth > width
contentWidth: shadowInput.width
onContentXChanged: InputContext.priv.shadow.updateSelectionProperties()
function ensureVisible(rectangle) {
if (contentX >= rectangle.x)
contentX = rectangle.x
else if (contentX + width <= rectangle.x + rectangle.width)
contentX = rectangle.x + rectangle.width - width;
}
TextInput {
id: shadowInput
objectName: "shadowInput"
property bool blinkStatus: true
width: Math.max(flickable.width, implicitWidth)
height: implicitHeight
anchors.verticalCenter: parent.verticalCenter
leftPadding: keyboard.style.fullScreenInputPadding
rightPadding: keyboard.style.fullScreenInputPadding
activeFocusOnPress: false
font: keyboard.style.fullScreenInputFont
inputMethodHints: InputContext.inputMethodHints
cursorDelegate: keyboard.style.fullScreenInputCursor
passwordCharacter: keyboard.style.fullScreenInputPasswordCharacter
color: keyboard.style.fullScreenInputColor
selectionColor: keyboard.style.fullScreenInputSelectionColor
selectedTextColor: keyboard.style.fullScreenInputSelectedTextColor
echoMode: (InputContext.inputMethodHints & Qt.ImhHiddenText) ? TextInput.Password : TextInput.Normal
selectByMouse: !!InputContext.inputItem && !!InputContext.inputItem.selectByMouse
onCursorPositionChanged: {
cursorSyncTimer.restart()
blinkStatus = true
if (cursorTimer.running)
cursorTimer.restart()
}
onSelectionStartChanged: cursorSyncTimer.restart()
onSelectionEndChanged: cursorSyncTimer.restart()
onCursorRectangleChanged: flickable.ensureVisible(cursorRectangle)
function getAnchorPosition() {
if (selectionStart == selectionEnd)
return cursorPosition
else if (selectionStart == cursorPosition)
return selectionEnd
else
return selectionStart
}
Timer {
id: cursorSyncTimer
interval: 0
onTriggered: {
var anchorPosition = shadowInput.getAnchorPosition()
if (anchorPosition !== InputContext.anchorPosition || shadowInput.cursorPosition !== InputContext.cursorPosition)
InputContext.priv.forceCursorPosition(anchorPosition, shadowInput.cursorPosition)
}
}
Timer {
id: cursorTimer
interval: Qt.styleHints.cursorFlashTime / 2
repeat: true
running: control.visible
onTriggered: shadowInput.blinkStatus = !shadowInput.blinkStatus
}
}
}
}
}
Component.onCompleted: {
if (VirtualKeyboardSettings.fullScreenMode) {
InputContext.priv.shadow.inputItem = shadowInput
}
}
Connections {
target: VirtualKeyboardSettings
function onFullScreenModeChanged() {
InputContext.priv.shadow.inputItem = VirtualKeyboardSettings.fullScreenMode ? shadowInput : null
}
}
Connections {
target: InputContext.priv.shadow
function onInputItemChanged() {
cursorSyncTimer.stop()
if (!InputContext.priv.shadow.inputItem)
shadowInput.clear()
}
}
}

View File

@@ -0,0 +1,29 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
/*!
\qmltype ShiftKey
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\ingroup qtvirtualkeyboard-key-types
\inherits BaseKey
\brief Shift key for keyboard layouts.
This key changes the shift state of the keyboard.
*/
BaseKey {
id: shiftKey
keyType: QtVirtualKeyboard.KeyType.ShiftKey
key: Qt.Key_Shift
enabled: InputContext.priv.shiftHandler.toggleShiftEnabled
highlighted: true
functionKey: true
keyPanelDelegate: keyboard.style ? keyboard.style.shiftKeyPanel : undefined
onClicked: InputContext.priv.shiftHandler.toggleShift()
}

View File

@@ -0,0 +1,29 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
/*!
\qmltype SpaceKey
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\ingroup qtvirtualkeyboard-key-types
\inherits Key
\brief Space key for keyboard layouts.
This key emits a space for input method processing.
*/
Key {
keyType: QtVirtualKeyboard.KeyType.SpaceKey
text: " "
displayText: ""
repeat: true
showPreview: false
highlighted: true
key: Qt.Key_Space
keyPanelDelegate: keyboard.style ? keyboard.style.spaceKeyPanel : undefined
}

View File

@@ -0,0 +1,28 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.VirtualKeyboard
/*!
\qmltype SymbolModeKey
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\ingroup qtvirtualkeyboard-key-types
\inherits Key
\brief Symbol mode key for keyboard layouts.
This key toggles between the symbol mode layout and the main layout.
*/
Key {
keyType: QtVirtualKeyboard.KeyType.SymbolModeKey
key: Qt.Key_Context1
displayText: "&123"
functionKey: true
highlighted: true
onClicked: keyboard.symbolMode = !keyboard.symbolMode
keyPanelDelegate: keyboard.style ? keyboard.style.symbolKeyPanel : undefined
}

View File

@@ -0,0 +1,198 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.Window
import QtQuick.VirtualKeyboard
/*!
\qmltype TraceInputArea
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\inherits MultiPointTouchArea
\since QtQuick.VirtualKeyboard 2.0
\brief A specialized MultiPointTouchArea for collecting touch input data.
This type handles the trace interaction between the touch screen and the input engine.
The traces are rendered using the delegate from the
\l {KeyboardStyle::}{traceCanvasDelegate} property of the current
\l KeyboardStyle.
*/
MultiPointTouchArea {
id: traceInputArea
/*! Pattern recognition mode of this input area.
The default value is \l {InputEngine::patternRecognitionModes} {InputEngine.PatternRecognitionMode.None}.
*/
property int patternRecognitionMode: InputEngine.PatternRecognitionMode.None
/*! List of horizontal rulers in the input area.
The rulers are defined as a number of pixels from the top edge of the boundingBox.
Here is an example that demonstrates how to define rulers:
\code
horizontalRulers: [boundingBox.height / 3, boundingBox.height / 3 * 2]
verticalRulers: [boundingBox.width / 3, boundingBox.width / 3 * 2]
\endcode
*/
property var horizontalRulers
/*! List of vertical rulers in the input area.
The rulers are defined as a number of pixels from the left edge of the boundingBox.
*/
property var verticalRulers
/*! Bounding box for the trace input.
This property is readonly and is automatically updated based on the item size
and margins.
*/
readonly property rect boundingBox: (width > 0 && height > 0) ?
Qt.rect(traceInputArea.x + traceInputArea.anchors.leftMargin,
traceInputArea.y + traceInputArea.anchors.topMargin,
traceInputArea.width,
traceInputArea.height) :
Qt.rect(0, 0, 0, 0)
/*! Canvas type of this trace input area.
This property can be used to distinguish between different types of canvases.
For example, in full screen handwriting mode this property is set to \c "fullscreen", and
in keyboard handwriting mode this property is set to \c "keyboard".
*/
property string canvasType
property var __activeTraceCanvases: ({})
property var __traceCanvasList: ([])
property var __recycledTraceCanvasList: ([])
Component.onCompleted: {
for (var i = 0; i < 6; i++) {
__recycledTraceCanvasList.push(__createTraceCanvas())
}
}
function __getTraceCanvas() {
while (__recycledTraceCanvasList.length == 0 &&
__traceCanvasList.length >= 15 &&
!__traceCanvasList.shift().recycle()) {}
return __recycledTraceCanvasList.length > 0 ?
__recycledTraceCanvasList.pop() :
__createTraceCanvas()
}
function __createTraceCanvas() {
var traceCanvas = keyboard.style.traceCanvasDelegate.createObject(traceInputArea)
traceCanvas.onRecycle.connect(__onTraceCanvasRecycled)
traceCanvas.anchors.fill = traceCanvas.parent
return traceCanvas
}
function __onTraceCanvasRecycled(traceCanvas) {
var index = __traceCanvasList.findIndex(function(otherCanvas) {
return traceCanvas === otherCanvas
})
if (index !== -1) {
__traceCanvasList.splice(index, index + 1)
}
__recycledTraceCanvasList.push(traceCanvas)
}
property var __traceCaptureDeviceInfo:
({
channels: ['t'],
sampleRate: 60,
uniform: false,
latency: 0.0,
dpi: Screen.pixelDensity * 25.4
})
property var __traceScreenInfo:
({
boundingBox: traceInputArea.boundingBox,
horizontalRulers: traceInputArea.horizontalRulers,
verticalRulers: traceInputArea.verticalRulers,
canvasType: traceInputArea.canvasType
})
enabled: patternRecognitionMode !== InputEngine.PatternRecognitionMode.None && InputContext.inputEngine.patternRecognitionModes.indexOf(patternRecognitionMode) !== -1
onPressed: (touchPoints) => {
if (!keyboard.style.traceCanvasDelegate)
return
for (var i = 0; i < touchPoints.length; i++) {
var traceId = touchPoints[i].pointId
var trace = InputContext.inputEngine.traceBegin(traceId, patternRecognitionMode, __traceCaptureDeviceInfo, __traceScreenInfo)
if (trace) {
var traceCanvas = __getTraceCanvas()
if (traceCanvas) {
traceCanvas.trace = trace
var index = trace.addPoint(Qt.point(touchPoints[i].x, touchPoints[i].y))
if (trace.channels.indexOf('t') !== -1) {
var dt = new Date()
trace.setChannelData('t', index, dt.getTime())
}
__activeTraceCanvases[traceId] = traceCanvas
} else {
__activeTraceCanvases[traceId] = null
}
} else {
__activeTraceCanvases[traceId] = null
}
}
}
onUpdated: (touchPoints) => {
for (var i = 0; i < touchPoints.length; i++) {
var traceId = touchPoints[i].pointId
var traceCanvas = __activeTraceCanvases[traceId]
if (traceCanvas) {
var trace = traceCanvas.trace
var index = trace.addPoint(Qt.point(touchPoints[i].x, touchPoints[i].y))
if (trace.channels.indexOf('t') !== -1) {
var dt = new Date()
trace.setChannelData('t', index, dt.getTime())
}
}
}
}
onReleased: (touchPoints) => {
for (var i = 0; i < touchPoints.length; i++) {
var traceId = touchPoints[i].pointId
var traceCanvas = __activeTraceCanvases[traceId]
if (traceCanvas) {
if (traceCanvas.trace) {
traceCanvas.trace.final = true
InputContext.inputEngine.traceEnd(traceCanvas.trace)
}
__traceCanvasList.push(traceCanvas)
__activeTraceCanvases[traceId] = null
}
}
}
onCanceled: (touchPoints) => {
for (var i = 0; i < touchPoints.length; i++) {
var traceId = touchPoints[i].pointId
var traceCanvas = __activeTraceCanvases[traceId]
if (traceCanvas) {
if (traceCanvas.trace) {
traceCanvas.trace.final = true
traceCanvas.trace.canceled = true
InputContext.inputEngine.traceEnd(traceCanvas.trace)
}
__traceCanvasList.push(traceCanvas)
__activeTraceCanvases[traceId] = null
}
}
}
}

View File

@@ -0,0 +1,92 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.Layouts
/*!
\qmltype TraceInputKey
\inqmlmodule QtQuick.VirtualKeyboard.Components
\ingroup qmlclass
\ingroup qtvirtualkeyboard-components-qml
\ingroup qtvirtualkeyboard-key-types
\inherits Item
\since QtQuick.VirtualKeyboard 2.0
\brief A specialized key for collecting touch input data.
This type can be placed in the keyboard layout. It collects
and renders touch input data (trace) from the key area.
*/
Item {
id: traceInputKey
/*! Sets the key weight value which determines the relative size of the key.
Use this property to change the key size in the layout.
The default value is inherited from the parent element
of the key in the layout hierarchy.
*/
property real weight: parent.keyWeight
/*! Pattern recognition mode of this input area.
The default value is \l {InputEngine::patternRecognitionModes} {InputEngine.PatternRecognitionMode.None}.
*/
property alias patternRecognitionMode: traceInputArea.patternRecognitionMode
/*! List of horizontal rulers in the input area.
The rulers are defined as a number of pixels from the top edge of the bounding box.
Here is an example that demonstrates how to define rulers:
\code
horizontalRulers: [boundingBox.height / 3, boundingBox.height / 3 * 2]
verticalRulers: [boundingBox.width / 3, boundingBox.width / 3 * 2]
\endcode
*/
property alias horizontalRulers: traceInputArea.horizontalRulers
/*! List of vertical rulers in the input area.
The rulers are defined as a number of pixels from the left edge of the bounding box.
*/
property alias verticalRulers: traceInputArea.verticalRulers
/*! Bounding box for the trace input.
This property is readonly and is automatically updated based on the item size
and margins.
*/
readonly property alias boundingBox: traceInputArea.boundingBox
/*! Canvas type of this trace input area.
This property can be used to distinguish between different types of canvases.
The default value is \c "keyboard".
*/
property alias canvasType: traceInputArea.canvasType
Layout.minimumWidth: traceInputKeyPanel.implicitWidth
Layout.minimumHeight: traceInputKeyPanel.implicitHeight
Layout.preferredWidth: weight
Layout.fillWidth: true
Layout.fillHeight: true
canvasType: "keyboard"
Loader {
id: traceInputKeyPanel
sourceComponent: keyboard.style.traceInputKeyPanelDelegate
anchors.fill: parent
onLoaded: traceInputKeyPanel.item.control = traceInputKey
}
TraceInputArea {
id: traceInputArea
anchors.fill: traceInputKeyPanel
anchors.margins: traceInputKeyPanel.item ? traceInputKeyPanel.item.traceMargins : 0
}
}

View File

@@ -0,0 +1,59 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
// Deliberately imported after QtQuick to avoid missing restoreMode property in Binding. Fix in Qt 6.
import QtQml
import QtQuick.VirtualKeyboard
PopupList {
id: wordCandidatePopupList
readonly property int preferredVisibleItems: {
if (!currentItem)
return 0
var maxHeight = flipVertical ? Qt.inputMethod.cursorRectangle.y : parent.height - Qt.inputMethod.cursorRectangle.height - Qt.inputMethod.cursorRectangle.y
var result = Math.min(count, maxVisibleItems)
while (result > 2 && result * currentItem.height > maxHeight)
--result
return result
}
readonly property bool flipVertical: currentItem &&
Qt.inputMethod.cursorRectangle.y + (Qt.inputMethod.cursorRectangle.height / 2) > (parent.height / 2) &&
Qt.inputMethod.cursorRectangle.y + Qt.inputMethod.cursorRectangle.height + (currentItem.height * 2) > parent.height
height: currentItem ? currentItem.height * preferredVisibleItems + (spacing * preferredVisibleItems - 1) : 0
Binding {
target: wordCandidatePopupList
property: "x"
value: Math.round(Qt.inputMethod.cursorRectangle.x -
(wordCandidatePopupList.currentItem ?
(wordCandidatePopupList.currentItem.hasOwnProperty("cursorAnchor") ?
wordCandidatePopupList.currentItem.cursorAnchor : wordCandidatePopupList.currentItem.width) : 0))
when: wordCandidatePopupList.visible
restoreMode: Binding.RestoreBinding
}
Binding {
target: wordCandidatePopupList
property: "y"
value: Math.round(wordCandidatePopupList.flipVertical ? Qt.inputMethod.cursorRectangle.y - wordCandidatePopupList.height : Qt.inputMethod.cursorRectangle.y + Qt.inputMethod.cursorRectangle.height)
when: wordCandidatePopupList.visible
restoreMode: Binding.RestoreBinding
}
model: enabled ? InputContext.inputEngine.wordCandidateListModel : null
onContentWidthChanged: viewResizeTimer.restart()
Timer {
id: viewResizeTimer
interval: 0
repeat: false
onTriggered: wordCandidatePopupList.width = wordCandidatePopupList.contentWidth
}
Connections {
target: wordCandidatePopupList.model ? wordCandidatePopupList.model : null
function onActiveItemChanged(index) { wordCandidatePopupList.currentIndex = index }
function onItemSelected() { if (wordCandidatePopupList.currentItem) keyboard.soundEffect.play(wordCandidatePopupList.currentItem.soundEffect) }
}
}

View File

@@ -0,0 +1,104 @@
module QtQuick.VirtualKeyboard.Components
linktarget Qt6::qtvkbcomponentsplugin
optional plugin qtvkbcomponentsplugin
classname QtQuick_VirtualKeyboard_ComponentsPlugin
typeinfo qtvkbcomponentsplugin.qmltypes
depends QtQuick auto
depends QtQuick.Layouts auto
depends QtQuick.VirtualKeyboard.Settings auto
prefer :/qt-project.org/imports/QtQuick/VirtualKeyboard/Components/
AlternativeKeys 6.0 AlternativeKeys.qml
AlternativeKeys 2.0 AlternativeKeys.qml
AlternativeKeys 1.0 AlternativeKeys.qml
BackspaceKey 6.0 BackspaceKey.qml
BackspaceKey 2.0 BackspaceKey.qml
BackspaceKey 1.0 BackspaceKey.qml
BaseKey 6.0 BaseKey.qml
BaseKey 2.0 BaseKey.qml
BaseKey 1.0 BaseKey.qml
ChangeLanguageKey 6.0 ChangeLanguageKey.qml
ChangeLanguageKey 2.0 ChangeLanguageKey.qml
ChangeLanguageKey 1.0 ChangeLanguageKey.qml
CharacterPreviewBubble 6.0 CharacterPreviewBubble.qml
CharacterPreviewBubble 2.0 CharacterPreviewBubble.qml
CharacterPreviewBubble 1.0 CharacterPreviewBubble.qml
EnterKey 6.0 EnterKey.qml
EnterKey 2.0 EnterKey.qml
EnterKey 1.0 EnterKey.qml
FillerKey 6.0 FillerKey.qml
FillerKey 2.0 FillerKey.qml
FillerKey 1.0 FillerKey.qml
FlickKey 6.0 FlickKey.qml
FlickKey 2.0 FlickKey.qml
FlickKey 1.0 FlickKey.qml
FunctionPopupList 6.0 FunctionPopupList.qml
FunctionPopupList 2.0 FunctionPopupList.qml
FunctionPopupList 1.0 FunctionPopupList.qml
HandwritingModeKey 6.0 HandwritingModeKey.qml
HandwritingModeKey 2.0 HandwritingModeKey.qml
HandwritingModeKey 1.0 HandwritingModeKey.qml
HideKeyboardKey 6.0 HideKeyboardKey.qml
HideKeyboardKey 2.0 HideKeyboardKey.qml
HideKeyboardKey 1.0 HideKeyboardKey.qml
InputModeKey 6.0 InputModeKey.qml
InputModeKey 2.0 InputModeKey.qml
InputModeKey 1.0 InputModeKey.qml
Key 6.0 Key.qml
Key 2.0 Key.qml
Key 1.0 Key.qml
Keyboard 6.0 Keyboard.qml
Keyboard 2.0 Keyboard.qml
Keyboard 1.0 Keyboard.qml
KeyboardColumn 6.0 KeyboardColumn.qml
KeyboardColumn 2.0 KeyboardColumn.qml
KeyboardColumn 1.0 KeyboardColumn.qml
KeyboardLayout 6.0 KeyboardLayout.qml
KeyboardLayout 2.0 KeyboardLayout.qml
KeyboardLayout 1.0 KeyboardLayout.qml
KeyboardLayoutLoader 6.0 KeyboardLayoutLoader.qml
KeyboardLayoutLoader 2.0 KeyboardLayoutLoader.qml
KeyboardLayoutLoader 1.0 KeyboardLayoutLoader.qml
KeyboardRow 6.0 KeyboardRow.qml
KeyboardRow 2.0 KeyboardRow.qml
KeyboardRow 1.0 KeyboardRow.qml
ModeKey 6.0 ModeKey.qml
ModeKey 2.0 ModeKey.qml
ModeKey 1.0 ModeKey.qml
MultiSoundEffect 6.0 MultiSoundEffect.qml
MultiSoundEffect 2.0 MultiSoundEffect.qml
MultiSoundEffect 1.0 MultiSoundEffect.qml
MultitapInputMethod 6.0 MultitapInputMethod.qml
MultitapInputMethod 2.0 MultitapInputMethod.qml
MultitapInputMethod 1.0 MultitapInputMethod.qml
NumberKey 6.0 NumberKey.qml
NumberKey 2.0 NumberKey.qml
NumberKey 1.0 NumberKey.qml
PopupList 6.0 PopupList.qml
PopupList 2.0 PopupList.qml
PopupList 1.0 PopupList.qml
SelectionControl 6.0 SelectionControl.qml
SelectionControl 2.0 SelectionControl.qml
SelectionControl 1.0 SelectionControl.qml
ShadowInputControl 6.0 ShadowInputControl.qml
ShadowInputControl 2.0 ShadowInputControl.qml
ShadowInputControl 1.0 ShadowInputControl.qml
ShiftKey 6.0 ShiftKey.qml
ShiftKey 2.0 ShiftKey.qml
ShiftKey 1.0 ShiftKey.qml
SpaceKey 6.0 SpaceKey.qml
SpaceKey 2.0 SpaceKey.qml
SpaceKey 1.0 SpaceKey.qml
SymbolModeKey 6.0 SymbolModeKey.qml
SymbolModeKey 2.0 SymbolModeKey.qml
SymbolModeKey 1.0 SymbolModeKey.qml
TraceInputArea 6.0 TraceInputArea.qml
TraceInputArea 2.0 TraceInputArea.qml
TraceInputArea 1.0 TraceInputArea.qml
TraceInputKey 6.0 TraceInputKey.qml
TraceInputKey 2.0 TraceInputKey.qml
TraceInputKey 1.0 TraceInputKey.qml
WordCandidatePopupList 6.0 WordCandidatePopupList.qml
WordCandidatePopupList 2.0 WordCandidatePopupList.qml
WordCandidatePopupList 1.0 WordCandidatePopupList.qml
depends QtQuick

View File

@@ -0,0 +1,8 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {}

View File

@@ -0,0 +1,8 @@
module QtQuick.VirtualKeyboard.Core
linktarget Qt6::VirtualKeyboardplugin
optional plugin virtualkeyboardplugin
classname QtQuick_VirtualKeyboard_CorePlugin
typeinfo plugins.qmltypes
prefer :/qt-project.org/imports/QtQuick/VirtualKeyboard/Core/
depends QtQuick

View File

@@ -0,0 +1,8 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick.VirtualKeyboard.Components as C
// Qt7: Remove, see QTBUG-102227
C.EnterKey {}

View File

@@ -0,0 +1,121 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
// Deliberately imported after QtQuick to avoid missing restoreMode property in Binding. Fix in Qt 6.
import QtQml
import QtQuick.Window
import QtQuick.VirtualKeyboard
import QtQuick.VirtualKeyboard.Components
/*!
\qmltype HandwritingInputPanel
\inqmlmodule QtQuick.VirtualKeyboard
\since QtQuick.VirtualKeyboard 2.0
\brief Provides a handwriting panel add-on for the virtual keyboard UI.
\ingroup qmlclass
\ingroup qtvirtualkeyboard-qml
The HandwritingInputPanel is an add-on component for the InputPanel, which
enables full-screen handwriting input for the application.
HandwritingInputPanel is designed to be anchored full screen alongside
the InputPanel. The operating principle is that when the handwriting panel
is "available", the InputPanel is invisible. This functionality is built-in,
and requires no more than a reference to the InputPanel instance.
The panel is set into operation by setting the \l {HandwritingInputPanel::}{available}
property to \c true. When the panel is in operation, the keyboard remains hidden
when the input focus is set. When \c available is \c true, handwriting input is
activated by setting the \l {HandwritingInputPanel::}{active} property to \c true.
The user interface, which provides controls for handwriting mode and the
visibility of the keyboard, is application-specific. One suggested implementation
is to use a floating button on the handwriting panel, where single click toggles
the handwriting mode (changes the \l {HandwritingInputPanel::}{active} property), and double-click toggles
the visibility of the keyboard (changes the \l {HandwritingInputPanel::}{available} property).
HandwritingInputPanel also provides a word candidate popup which allows the user
to select an alternative word candidate from the list of suggestions generated
by the handwriting input method.
*/
Item {
id: handwritingInputPanel
/*! A reference to the input panel instance.
This property must be set to the existing input panel instance.
*/
property var inputPanel
/*! This property controls the availability status of the handwriting input method.
Setting the property to \c true prepares the handwriting input method and inhibits
the display of keyboard.
*/
property bool available
/*! This property controls the active status of the handwriting input method.
Setting the property to \c true activates the handwriting input method. When the
handwriting input method is active, all touch input is captured by the
handwriting input panel and redirected to input engine for processing.
*/
property bool active
state: enabled && available ? (active ? "active" : "available") : "unavailable"
enabled: inputPanel.keyboard.isHandwritingAvailable()
visible: enabled && available && active && Qt.inputMethod.visible
LayoutMirroring.enabled: false
LayoutMirroring.childrenInherit: true
Item {
id: keyboard
property var style: inputPanel && inputPanel.hasOwnProperty ? inputPanel.keyboard.style : null
property var soundEffect: inputPanel && inputPanel.hasOwnProperty ? inputPanel.keyboard.soundEffect : null
}
onEnabledChanged: inputPanel.keyboard.fullScreenHandwritingMode = enabled && available
onAvailableChanged: inputPanel.keyboard.fullScreenHandwritingMode = enabled && available
TraceInputArea {
id: hwrInputArea
enabled: handwritingInputPanel.enabled && handwritingInputPanel.available && handwritingInputPanel.active
objectName: "hwrInputArea"
anchors.fill: parent
patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
canvasType: "fullscreen"
}
Binding {
target: InputContext.priv
property: "keyboardRectangle"
value: Qt.rect(hwrInputArea.x, hwrInputArea.y, hwrInputArea.width, hwrInputArea.height)
when: handwritingInputPanel.enabled && handwritingInputPanel.available && handwritingInputPanel.active
}
Binding {
target: inputPanel ? inputPanel.keyboard : null
property: "active"
value: false
when: handwritingInputPanel.enabled && handwritingInputPanel.available
restoreMode: Binding.RestoreBinding
}
WordCandidatePopupList {
id: wordCandidatePopupList
z: 1
objectName: "wordCandidatePopupList"
enabled: handwritingInputPanel.enabled && handwritingInputPanel.available && handwritingInputPanel.active
}
Loader {
sourceComponent: keyboard.style.popupListBackground
anchors.fill: wordCandidatePopupList
z: -1
visible: wordCandidatePopupList.visible
}
}

View File

@@ -0,0 +1,143 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
// Deliberately imported after QtQuick to avoid missing restoreMode property in Binding. Fix in Qt 6.
import QtQml
import QtQuick.VirtualKeyboard
import QtQuick.VirtualKeyboard.Components
/*!
\qmltype InputPanel
\inqmlmodule QtQuick.VirtualKeyboard
\brief Provides the virtual keyboard UI.
\ingroup qmlclass
\ingroup qtvirtualkeyboard-qml
The keyboard size is automatically calculated from the available
width; that is, the keyboard maintains the aspect ratio specified by the current
style. Therefore the application should only set the \l {Item::}{width} and \l {Item::}{y}
coordinates of the InputPanel, and not the \l {Item::}{height}.
As with \l {Qt Virtual Keyboard QML Types}{all other QML types} provided by
the module, the \c QT_IM_MODULE environment variable must be set to
\c qtvirtualkeyboard before using InputPanel. For more information, see
\l {Loading the Plugin}.
\note You can have only one InputPanel instance in your application. The panel
will not be blocked by modal dialogs, but it can be obscured by items with a higher
\l {Item::}{z} value.
*/
Item {
id: inputPanel
/*!
\qmlproperty bool InputPanel::active
\since QtQuick.VirtualKeyboard 2.0
This property reflects the active status of the input panel.
The keyboard should be made visible to the user when this property is
\c true.
*/
property alias active: keyboard.active
/*!
\qmlproperty bool InputPanel::externalLanguageSwitchEnabled
\since QtQuick.VirtualKeyboard 2.4
This property enables the external language switch mechanism.
When this property is \c true, the virtual keyboard will not show
the built-in language popup, but will emit the \l externalLanguageSwitch
signal instead. The application can handle this signal and show a
custom language selection dialog instead.
*/
property bool externalLanguageSwitchEnabled
/*!
\qmlsignal InputPanel::externalLanguageSwitch(var localeList, int currentIndex)
\since QtQuick.VirtualKeyboard 2.4
This signal is emitted when \l externalLanguageSwitchEnabled is \c true
and the \l {user-guide-language}{language switch key} is pressed by the user.
It serves as a hook to display a custom language dialog instead of
the built-in language popup in the virtual keyboard.
The \a localeList parameter contains a list of locale names to choose
from. To get more information about a particular language, use the
\l[QtQml]{Qt::locale()}{Qt.locale()} function. The \a currentIndex
is the index of current locale in the \a localeList. This item should
be highlighted as the current item in the UI.
To select a new language, use the \l {VirtualKeyboardSettings::locale}
{VirtualKeyboardSettings.locale} property.
Below is an example that demonstrates a custom language dialog implementation:
\snippet qtvirtualkeyboard-custom-language-popup.qml popup
The dialog would then be declared:
\snippet qtvirtualkeyboard-custom-language-popup.qml declaring
In the application's InputPanel, add the following code:
\snippet qtvirtualkeyboard-custom-language-popup.qml using
The custom dialog will now be shown when the language switch key is pressed.
*/
signal externalLanguageSwitch(var localeList, int currentIndex)
/*! \internal */
property alias keyboard: keyboard
/*! \internal */
property bool desktopPanel: false
SelectionControl {
objectName: "selectionControl"
x: -parent.x
y: -parent.y
enabled: active && !keyboard.fullScreenMode && !desktopPanel
}
implicitHeight: keyboard.height - keyboard.wordCandidateView.y
Keyboard {
id: keyboard
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
}
MouseArea {
z: -1
anchors.fill: keyboard
enabled: active
hoverEnabled: active
}
Binding {
target: InputContext.priv
property: "keyboardRectangle"
value: keyboardRectangle()
when: !InputContext.animating && inputPanel.active
}
/*! \internal */
function keyboardRectangle() {
const forBindingX = x
const forBindingY = y
const rect = desktopPanel ?
Qt.rect(keyboard.x,
keyboard.y + keyboard.wordCandidateView.y,
keyboard.width,
keyboard.height - keyboard.wordCandidateView.y) :
Qt.rect(0, 0, width, height)
if (keyboard.shadowInputControl.visible) {
rect.y -= keyboard.shadowInputControl.height
rect.height += keyboard.shadowInputControl.height
}
return mapToItem(null, rect)
}
}

View File

@@ -0,0 +1,7 @@
module QtQuick.VirtualKeyboard.Layouts
linktarget Qt6::qtvkblayoutsplugin
plugin qtvkblayoutsplugin
classname QtQuick_VirtualKeyboard_LayoutsPlugin
typeinfo qtvkblayoutsplugin.qmltypes
prefer :/qt-project.org/imports/QtQuick/VirtualKeyboard/Layouts/

View File

@@ -0,0 +1,8 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {}

View File

@@ -0,0 +1,22 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {
Component {
file: "hangulinputmethod_p.h"
lineNumber: 25
name: "QtVirtualKeyboard::HangulInputMethod"
accessSemantics: "reference"
prototype: "QVirtualKeyboardAbstractInputMethod"
exports: [
"QtQuick.VirtualKeyboard.Plugins.Hangul/HangulInputMethod 2.0",
"QtQuick.VirtualKeyboard.Plugins.Hangul/HangulInputMethod 6.0",
"QtQuick.VirtualKeyboard.Plugins.Hangul/HangulInputMethod 6.1"
]
exportMetaObjectRevisions: [512, 1536, 1537]
}
}

View File

@@ -0,0 +1,8 @@
module QtQuick.VirtualKeyboard.Plugins.Hangul
linktarget Qt6::qtvkbhangulplugin
plugin qtvkbhangulplugin
classname QtQuick_VirtualKeyboard_Plugins_HangulPlugin
typeinfo plugins.qmltypes
depends QtQuick.VirtualKeyboard.Core auto
prefer :/qt-project.org/imports/QtQuick/VirtualKeyboard/Plugins/Hangul/

View File

@@ -0,0 +1,22 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {
Component {
file: "openwnninputmethod_p.h"
lineNumber: 25
name: "QtVirtualKeyboard::OpenWnnInputMethod"
accessSemantics: "reference"
prototype: "QVirtualKeyboardAbstractInputMethod"
exports: [
"QtQuick.VirtualKeyboard.Plugins.OpenWNN/JapaneseInputMethod 2.0",
"QtQuick.VirtualKeyboard.Plugins.OpenWNN/JapaneseInputMethod 6.0",
"QtQuick.VirtualKeyboard.Plugins.OpenWNN/JapaneseInputMethod 6.1"
]
exportMetaObjectRevisions: [512, 1536, 1537]
}
}

View File

@@ -0,0 +1,8 @@
module QtQuick.VirtualKeyboard.Plugins.OpenWNN
linktarget Qt6::qtvkbopenwnnplugin
plugin qtvkbopenwnnplugin
classname QtQuick_VirtualKeyboard_Plugins_OpenWNNPlugin
typeinfo plugins.qmltypes
depends QtQuick.VirtualKeyboard.Core auto
prefer :/qt-project.org/imports/QtQuick/VirtualKeyboard/Plugins/OpenWNN/

View File

@@ -0,0 +1,22 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {
Component {
file: "pinyininputmethod_p.h"
lineNumber: 25
name: "QtVirtualKeyboard::PinyinInputMethod"
accessSemantics: "reference"
prototype: "QVirtualKeyboardAbstractInputMethod"
exports: [
"QtQuick.VirtualKeyboard.Plugins.Pinyin/PinyinInputMethod 2.0",
"QtQuick.VirtualKeyboard.Plugins.Pinyin/PinyinInputMethod 6.0",
"QtQuick.VirtualKeyboard.Plugins.Pinyin/PinyinInputMethod 6.1"
]
exportMetaObjectRevisions: [512, 1536, 1537]
}
}

View File

@@ -0,0 +1,8 @@
module QtQuick.VirtualKeyboard.Plugins.Pinyin
linktarget Qt6::qtvkbpinyinplugin
plugin qtvkbpinyinplugin
classname QtQuick_VirtualKeyboard_Plugins_PinyinPlugin
typeinfo plugins.qmltypes
depends QtQuick.VirtualKeyboard.Core auto
prefer :/qt-project.org/imports/QtQuick/VirtualKeyboard/Plugins/Pinyin/

View File

@@ -0,0 +1,32 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {
Component {
file: "tcinputmethod_p.h"
lineNumber: 26
name: "QtVirtualKeyboard::TCInputMethod"
accessSemantics: "reference"
prototype: "QVirtualKeyboardAbstractInputMethod"
exports: [
"QtQuick.VirtualKeyboard.Plugins.TCIme/TCInputMethod 2.0",
"QtQuick.VirtualKeyboard.Plugins.TCIme/TCInputMethod 6.0",
"QtQuick.VirtualKeyboard.Plugins.TCIme/TCInputMethod 6.1"
]
exportMetaObjectRevisions: [512, 1536, 1537]
Property {
name: "simplified"
type: "bool"
read: "simplified"
write: "setSimplified"
notify: "simplifiedChanged"
index: 0
lineNumber: 30
}
Signal { name: "simplifiedChanged"; lineNumber: 57 }
}
}

View File

@@ -0,0 +1,8 @@
module QtQuick.VirtualKeyboard.Plugins.TCIme
linktarget Qt6::qtvkbtcimeplugin
plugin qtvkbtcimeplugin
classname QtQuick_VirtualKeyboard_Plugins_TCImePlugin
typeinfo plugins.qmltypes
depends QtQuick.VirtualKeyboard.Core auto
prefer :/qt-project.org/imports/QtQuick/VirtualKeyboard/Plugins/TCIme/

View File

@@ -0,0 +1,22 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {
Component {
file: "thaiinputmethod_p.h"
lineNumber: 20
name: "QtVirtualKeyboard::ThaiInputMethod"
accessSemantics: "reference"
prototype: "QVirtualKeyboardAbstractInputMethod"
exports: [
"QtQuick.VirtualKeyboard.Plugins.Thai/ThaiInputMethod 2.0",
"QtQuick.VirtualKeyboard.Plugins.Thai/ThaiInputMethod 6.0",
"QtQuick.VirtualKeyboard.Plugins.Thai/ThaiInputMethod 6.1"
]
exportMetaObjectRevisions: [512, 1536, 1537]
}
}

View File

@@ -0,0 +1,8 @@
module QtQuick.VirtualKeyboard.Plugins.Thai
linktarget Qt6::qtvkbthaiplugin
plugin qtvkbthaiplugin
classname QtQuick_VirtualKeyboard_Plugins_ThaiPlugin
typeinfo plugins.qmltypes
depends QtQuick.VirtualKeyboard.Core auto
prefer :/qt-project.org/imports/QtQuick/VirtualKeyboard/Plugins/Thai/

View File

@@ -0,0 +1,12 @@
module QtQuick.VirtualKeyboard.Plugins
linktarget Qt6::qtvkbpluginsplugin
optional plugin qtvkbpluginsplugin
classname QtQuick_VirtualKeyboard_PluginsPlugin
typeinfo qtvkbpluginsplugin.qmltypes
import QtQuick.VirtualKeyboard.Plugins.Hangul auto
import QtQuick.VirtualKeyboard.Plugins.OpenWNN auto
import QtQuick.VirtualKeyboard.Plugins.Pinyin auto
import QtQuick.VirtualKeyboard.Plugins.TCIme auto
import QtQuick.VirtualKeyboard.Plugins.Thai auto
prefer :/qt-project.org/imports/QtQuick/VirtualKeyboard/Plugins/

View File

@@ -0,0 +1,8 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {}

View File

@@ -0,0 +1,263 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {
Component {
file: "private/qquickvirtualkeyboardsettings_p.h"
lineNumber: 28
name: "QtVirtualKeyboard::QQuickVirtualKeyboardSettings"
accessSemantics: "reference"
prototype: "QObject"
exports: [
"QtQuick.VirtualKeyboard.Settings/VirtualKeyboardSettings 1.0",
"QtQuick.VirtualKeyboard.Settings/VirtualKeyboardSettings 6.0",
"QtQuick.VirtualKeyboard.Settings/VirtualKeyboardSettings 6.1",
"QtQuick.VirtualKeyboard.Settings/VirtualKeyboardSettings 6.6",
"QtQuick.VirtualKeyboard.Settings/VirtualKeyboardSettings 6.8",
"QtQuick.VirtualKeyboard.Settings/VirtualKeyboardSettings 6.9"
]
isCreatable: false
isSingleton: true
exportMetaObjectRevisions: [256, 1536, 1537, 1542, 1544, 1545]
Property {
name: "style"
type: "QUrl"
read: "style"
notify: "styleChanged"
index: 0
lineNumber: 32
isReadonly: true
}
Property {
name: "layoutPath"
type: "QUrl"
read: "layoutPath"
write: "setLayoutPath"
notify: "layoutPathChanged"
index: 1
lineNumber: 33
}
Property {
name: "styleName"
type: "QString"
read: "styleName"
write: "setStyleName"
notify: "styleNameChanged"
index: 2
lineNumber: 34
}
Property {
name: "locale"
type: "QString"
read: "locale"
write: "setLocale"
notify: "localeChanged"
index: 3
lineNumber: 35
}
Property {
name: "availableLocales"
type: "QStringList"
read: "availableLocales"
notify: "availableLocalesChanged"
index: 4
lineNumber: 36
isReadonly: true
}
Property {
name: "activeLocales"
type: "QStringList"
read: "activeLocales"
write: "setActiveLocales"
notify: "activeLocalesChanged"
index: 5
lineNumber: 37
}
Property {
name: "wordCandidateList"
type: "QtVirtualKeyboard::QQuickWordCandidateListSettings"
isPointer: true
read: "wordCandidateList"
index: 6
lineNumber: 38
isReadonly: true
isPropertyConstant: true
}
Property {
name: "fullScreenMode"
type: "bool"
read: "fullScreenMode"
write: "setFullScreenMode"
notify: "fullScreenModeChanged"
index: 7
lineNumber: 39
}
Property {
name: "userDataPath"
revision: 1537
type: "QString"
read: "userDataPath"
write: "setUserDataPath"
notify: "userDataPathChanged"
index: 8
lineNumber: 40
}
Property {
name: "hwrTimeoutForAlphabetic"
revision: 1537
type: "int"
read: "hwrTimeoutForAlphabetic"
write: "setHwrTimeoutForAlphabetic"
notify: "hwrTimeoutForAlphabeticChanged"
index: 9
lineNumber: 41
}
Property {
name: "hwrTimeoutForCjk"
revision: 1537
type: "int"
read: "hwrTimeoutForCjk"
write: "setHwrTimeoutForCjk"
notify: "hwrTimeoutForCjkChanged"
index: 10
lineNumber: 42
}
Property {
name: "inputMethodHints"
revision: 1537
type: "Qt::InputMethodHints"
read: "inputMethodHints"
write: "setInputMethodHints"
notify: "inputMethodHintsChanged"
index: 11
lineNumber: 43
}
Property {
name: "handwritingModeDisabled"
revision: 1537
type: "bool"
read: "isHandwritingModeDisabled"
write: "setHandwritingModeDisabled"
notify: "handwritingModeDisabledChanged"
index: 12
lineNumber: 44
}
Property {
name: "defaultInputMethodDisabled"
revision: 1537
type: "bool"
read: "isDefaultInputMethodDisabled"
write: "setDefaultInputMethodDisabled"
notify: "defaultInputMethodDisabledChanged"
index: 13
lineNumber: 45
}
Property {
name: "defaultDictionaryDisabled"
revision: 1537
type: "bool"
read: "isDefaultDictionaryDisabled"
write: "setDefaultDictionaryDisabled"
notify: "defaultDictionaryDisabledChanged"
index: 14
lineNumber: 46
}
Property {
name: "visibleFunctionKeys"
revision: 1542
type: "QtVirtualKeyboard::KeyboardFunctionKeys"
read: "visibleFunctionKeys"
write: "setVisibleFunctionKeys"
notify: "visibleFunctionKeysChanged"
index: 15
lineNumber: 47
}
Property {
name: "closeOnReturn"
revision: 1544
type: "bool"
read: "closeOnReturn"
write: "setCloseOnReturn"
notify: "closeOnReturnChanged"
index: 16
lineNumber: 48
}
Property {
name: "keySoundVolume"
revision: 1545
type: "double"
read: "keySoundVolume"
write: "setKeySoundVolume"
notify: "keySoundVolumeChanged"
index: 17
lineNumber: 49
}
Signal { name: "styleChanged"; lineNumber: 114 }
Signal { name: "styleNameChanged"; lineNumber: 115 }
Signal { name: "localeChanged"; lineNumber: 116 }
Signal { name: "availableLocalesChanged"; lineNumber: 117 }
Signal { name: "activeLocalesChanged"; lineNumber: 118 }
Signal { name: "layoutPathChanged"; lineNumber: 119 }
Signal { name: "fullScreenModeChanged"; lineNumber: 120 }
Signal { name: "userDataPathChanged"; revision: 1537; lineNumber: 121 }
Signal { name: "userDataReset"; revision: 1537; lineNumber: 122 }
Signal { name: "hwrTimeoutForAlphabeticChanged"; revision: 1537; lineNumber: 123 }
Signal { name: "hwrTimeoutForCjkChanged"; revision: 1537; lineNumber: 124 }
Signal { name: "inputMethodHintsChanged"; revision: 1537; lineNumber: 125 }
Signal { name: "handwritingModeDisabledChanged"; revision: 1537; lineNumber: 126 }
Signal { name: "defaultInputMethodDisabledChanged"; revision: 1537; lineNumber: 127 }
Signal { name: "defaultDictionaryDisabledChanged"; revision: 1537; lineNumber: 128 }
Signal { name: "visibleFunctionKeysChanged"; revision: 1542; lineNumber: 129 }
Signal { name: "closeOnReturnChanged"; revision: 1544; lineNumber: 130 }
Signal { name: "keySoundVolumeChanged"; revision: 1545; lineNumber: 131 }
Method {
name: "convertVolume"
revision: 1545
type: "double"
isMethodConstant: true
lineNumber: 111
Parameter { name: "volume"; type: "double" }
}
}
Component {
file: "private/qquickvirtualkeyboardsettings_p.h"
lineNumber: 138
name: "QtVirtualKeyboard::QQuickWordCandidateListSettings"
accessSemantics: "reference"
prototype: "QObject"
Property {
name: "autoHideDelay"
type: "int"
read: "autoHideDelay"
write: "setAutoHideDelay"
notify: "autoHideDelayChanged"
index: 0
lineNumber: 141
}
Property {
name: "alwaysVisible"
type: "bool"
read: "alwaysVisible"
write: "setAlwaysVisible"
notify: "alwaysVisibleChanged"
index: 1
lineNumber: 142
}
Property {
name: "autoCommitWord"
type: "bool"
read: "autoCommitWord"
write: "setAutoCommitWord"
notify: "autoCommitWordChanged"
index: 2
lineNumber: 143
}
Signal { name: "autoHideDelayChanged"; lineNumber: 160 }
Signal { name: "alwaysVisibleChanged"; lineNumber: 161 }
Signal { name: "autoCommitWordChanged"; lineNumber: 162 }
}
}

View File

@@ -0,0 +1,8 @@
module QtQuick.VirtualKeyboard.Settings
linktarget Qt6::qtvkbsettingsplugin
plugin qtvkbsettingsplugin
classname QtQuick_VirtualKeyboard_SettingsPlugin
typeinfo plugins.qmltypes
prefer :/qt-project.org/imports/QtQuick/VirtualKeyboard/Settings/
depends QtQuick

View File

@@ -0,0 +1,8 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {}

View File

@@ -0,0 +1,7 @@
module QtQuick.VirtualKeyboard.Styles.Builtin
linktarget Qt6::qtvkbbuiltinstylesplugin
plugin qtvkbbuiltinstylesplugin
classname QtQuickVirtualKeyboardStylesBuiltinPlugin
typeinfo plugins.qmltypes
prefer :/qt-project.org/imports/QtQuick/VirtualKeyboard/Styles/Builtin/

View File

@@ -0,0 +1,45 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
/*!
\qmltype KeyIcon
\inqmlmodule QtQuick.VirtualKeyboard.Styles
\brief Key icon with adjustable color.
\ingroup qmlclass
\ingroup qtvirtualkeyboard-styles-qml
The KeyIcon item displays an icon with adjustable color.
*/
Item {
/*! The icon color. */
property alias color: overlay.color
/*! The source image. */
property alias source: icon.source
Image {
id: icon
sourceSize.height: parent.height
sourceSize.width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
visible: false
}
ShaderEffect {
id: overlay
property color color
property variant texture: icon
anchors.fill: icon
fragmentShader: "
uniform lowp vec4 color;
uniform lowp float qt_Opacity;
uniform lowp sampler2D texture;
varying highp vec2 qt_TexCoord0;
void main() {
highp vec4 sample = texture2D(texture, qt_TexCoord0) * qt_Opacity;
gl_FragColor = vec4(color.rgb, 1.0) * sample.a;
}
"
}
}

View File

@@ -0,0 +1,69 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
/*!
\qmltype KeyPanel
\inqmlmodule QtQuick.VirtualKeyboard.Styles
\brief A base type of the styled keys.
\ingroup qmlclass
\ingroup qtvirtualkeyboard-styles-qml
All the key delegates provided by the style should be based on this type.
*/
Item {
/*! Provides access to properties in BaseKey.
A list of available properties in control:
\list
\li \c control.key Unicode code of the key.
\li \c control.text Unicode text of the key.
\li \c control.displayText Display text of the key.
\li \c control.smallText Small text of the key, usually rendered in the corner of the key.
\li \c control.smallTextVisible Visibility of the small text.
\li \c control.alternativeKeys List of alternative key sequences.
\li \c control.enabled Set to true when the key is enabled.
\li \c control.pressed Set to true when the key is currently pressed.
\li \c control.uppercased Set to true when the key is uppercased.
\endlist
*/
property Item control
/*!
\since QtQuick.VirtualKeyboard.Styles 1.1
Sets the sound effect to be played on key press.
*/
property url soundEffect
// Uncomment the following to reveal the key sizes
/*
Rectangle {
id: root
z: 1
color: "transparent"
border.color: "white"
anchors.fill: parent
Rectangle {
color: "black"
opacity: 0.6
anchors.top: parent.top
anchors.topMargin: 1
anchors.left: parent.left
anchors.leftMargin: 1
implicitWidth: keyPanelInfoText.width + 4
implicitHeight: keyPanelInfoText.height + 4
Text {
id: keyPanelInfoText
property point pos: keyboard.keyboardLayoutLoader.item.mapFromItem(root.parent, 0, 0)
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)
font.pixelSize: 12
color: "white"
anchors.centerIn: parent
}
}
}
*/
}

View File

@@ -0,0 +1,532 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
/*!
\qmltype KeyboardStyle
\inqmlmodule QtQuick.VirtualKeyboard.Styles
\brief Provides a styling interface for the Virtual Keyboard.
\ingroup qmlclass
\ingroup qtvirtualkeyboard-styles-qml
The style type provides the style definitions that are used by
the InputPanel to decorate the virtual keyboard.
The design size specifies the aspect ratio of the virtual keyboard.
Styles are scalable according to \l scaleHint, which is
calculated from the keyboard's actual height and design height.
*/
QtObject {
/*! The current height of the keyboard. */
property real keyboardHeight
/*! The design width of the keyboard. */
property real keyboardDesignWidth
/*! The design height of the keyboard. */
property real keyboardDesignHeight
/*! The keyboard style scale hint. This value is determined by dividing
\l keyboardHeight by \l keyboardDesignHeight. All pixel
dimensions must be proportional to this value.
*/
readonly property real scaleHint: keyboardHeight / keyboardDesignHeight
/*!
The distance between the left-most keys and the left edge of the
keyboard, expressed as a percentage (\c 0.0 - \c 1.0) of the keyboard's
width.
*/
property real keyboardRelativeLeftMargin: 0
/*!
The distance between the right-most keys and the right edge of the
keyboard, expressed as a percentage (\c 0.0 - \c 1.0) of the keyboard's
width.
This value is proportional to the keyboard's width.
*/
property real keyboardRelativeRightMargin: 0
/*!
The distance between the top-most keys and the top edge of the
keyboard, expressed as a percentage (\c 0.0 - \c 1.0) of the keyboard's
height.
*/
property real keyboardRelativeTopMargin: 0
/*!
The distance between the bottom-most keys and the bottom edge of the
keyboard container, expressed as a percentage (\c 0.0 - \c 1.0) of the
keyboard's height.
*/
property real keyboardRelativeBottomMargin: 0
/*! Template for the keyboard background.
Example:
\code
keyboardBackground: Rectangle {
color: "black"
}
\endcode
*/
property Component keyboardBackground: null
/*! Template for the regular keys.
\note The delegate must be based on the KeyPanel type.
Example:
\code
keyPanel: KeyPanel {
Rectangle {
anchors.fill: parent
...
Text {
anchors.fill: parent
text: control.displayText
...
}
}
}
\endcode
*/
property Component keyPanel: null
/*! Template for the backspace key.
\note The delegate must be based on the KeyPanel type.
*/
property Component backspaceKeyPanel: null
/*! Template for the language key.
\note The delegate must be based on the KeyPanel type.
*/
property Component languageKeyPanel: null
/*! Template for the enter key.
\note The delegate must be based on the KeyPanel type.
*/
property Component enterKeyPanel: null
/*! Template for the hide key.
\note The delegate must be based on the KeyPanel type.
*/
property Component hideKeyPanel: null
/*! Template for the shift key.
\note The delegate must be based on the KeyPanel type.
*/
property Component shiftKeyPanel: null
/*! Template for the space key.
\note The delegate must be based on the KeyPanel type.
*/
property Component spaceKeyPanel: null
/*! Template for the symbol mode key.
\note The delegate must be based on the KeyPanel type.
*/
property Component symbolKeyPanel: null
/*! Template for the generic mode key.
This template provides a visualization of the key in which the state
can be on or off. This template is used in situations where the key label
will remain the same regardless of status.
The current state is available in the \c control.mode property.
\note The delegate must be based on the KeyPanel type.
*/
property Component modeKeyPanel: null
/*! Template for the handwriting mode key.
\note The delegate must be based on the KeyPanel type.
*/
property Component handwritingKeyPanel: null
/*!
Number of pixels between the top of each key and the bottom of the
characterPreviewDelegate.
*/
property real characterPreviewMargin: 0
/*! Template for the character preview popup.
If the delegate contains the \c text property, the property is updated
with the display text when the component becomes active.
\code
property string text
\endcode
Example:
\code
characterPreviewDelegate: Item {
property string text
id: characterPreview
Rectangle {
id: characterPreviewBackground
anchors.fill: parent
...
Text {
text: characterPreview.text
anchors.fill: parent
...
}
}
}
\endcode
*/
property Component characterPreviewDelegate: null
/*! Width of the alternate keys list item. */
property real alternateKeysListItemWidth: 0
/*! Height of the alternate keys list item. */
property real alternateKeysListItemHeight: 0
/*! Top margin for the alternate keys list panel. */
property real alternateKeysListTopMargin: 0
/*! Bottom margin for the alternate keys list panel. */
property real alternateKeysListBottomMargin: 0
/*! Left margin for the alternate keys list panel. */
property real alternateKeysListLeftMargin: 0
/*! Right margin for the alternate keys list panel. */
property real alternateKeysListRightMargin: 0
/*! Template for the alternative keys list item.
\note The delegate is used in a \l ListView.
*/
property Component alternateKeysListDelegate: null
/*! Template for the alternative keys list highlight.
\note The delegate is used as \c ListView.highlight.
*/
property Component alternateKeysListHighlight: null
/*! Template for the alternative keys list background. */
property Component alternateKeysListBackground: null
/*! Selection list height. */
property real selectionListHeight: 0
/*! Template for the selection list item.
\note The delegate is used in a \l ListView.
\note The delegate must be based on the \l SelectionListItem type.
The following properties are available to the item:
\list
\li \c display Display text for the current item.
\li \c wordCompletionLength Word completion length measured from the end of the display text.
\li \c dictionary Dictionary type of the word, see QVirtualKeyboardSelectionListModel::DictionaryType.
\li \c canRemoveSuggestion A boolean indicating if the word can be removed from dictionary.
\endlist
*/
property Component selectionListDelegate: null
/*! Template for the selection list highlight.
\note The delegate is used as \c ListView.highlight.
*/
property Component selectionListHighlight: null
/*! Template for the selection list background. */
property Component selectionListBackground: null
/*! \since QtQuick.VirtualKeyboard.Styles 1.3
This property holds the transition to apply to items that
are added to the selection list view.
*/
property Transition selectionListAdd
/*! \since QtQuick.VirtualKeyboard.Styles 1.3
This property holds the transition to apply to items that
are removed from the selection list view.
*/
property Transition selectionListRemove
/*!
\since QtQuick.VirtualKeyboard.Styles 1.1
Template for the navigation highlight item.
This item is used in \l {Configuration Options}{arrow-key-navigation}
mode to highlight the navigation focus on the keyboard.
The item is typically a transparent rectangle with a
high contrast border.
*/
property Component navigationHighlight: null
/*!
\since QtQuick.VirtualKeyboard.Styles 2.1
Template for the trace input key.
\note The delegate must be based on the TraceInputKeyPanel type.
*/
property Component traceInputKeyPanelDelegate: null
/*!
\since QtQuick.VirtualKeyboard.Styles 2.1
Template for rendering a Trace object.
\note The delegate must be based on the TraceCanvas type.
*/
property Component traceCanvasDelegate: null
/*! \since QtQuick.VirtualKeyboard.Styles 2.1
Template for the popup list item.
\note The delegate is used in a \l ListView.
\note The delegate must be based on the \l SelectionListItem type.
The following properties are available to the item:
\list
\li \c display Display text for the current item.
\li \c wordCompletionLength Word completion length measured from the end of the display text.
\li \c dictionary Dictionary type of the word, see QVirtualKeyboardSelectionListModel::DictionaryType.
\li \c canRemoveSuggestion A boolean indicating if the word can be removed from dictionary.
\endlist
*/
property Component popupListDelegate: null
/*! \since QtQuick.VirtualKeyboard.Styles 2.1
Template for the popup list highlight.
\note The delegate is used as \c ListView.highlight.
*/
property Component popupListHighlight: null
/*! \since QtQuick.VirtualKeyboard.Styles 2.1
Template for the popup list background.
*/
property Component popupListBackground: null
/*! \since QtQuick.VirtualKeyboard.Styles 2.1
This property holds the transition to apply to items that
are added to the popup list view.
*/
property Transition popupListAdd
/*! \since QtQuick.VirtualKeyboard.Styles 2.1
This property holds the transition to apply to items that
are removed from the popup list view.
*/
property Transition popupListRemove
/*! \since QtQuick.VirtualKeyboard.Styles 2.1
This property determines whether a popup list will be shown when the
language key is clicked. If this property is \c false, clicking the
language key cycles through the available languages one at a time.
The default value is \c false.
*/
property bool languagePopupListEnabled: false
/*! \since QtQuick.VirtualKeyboard.Styles 2.1
Template for the language list item.
\note The delegate is used in a \l ListView.
\note The delegate must be based on the \l SelectionListItem type.
The following properties are available to the item:
\list
\li \c displayName Display name of the language.
\endlist
*/
property Component languageListDelegate: null
/*! \since QtQuick.VirtualKeyboard.Styles 2.1
Template for the language list highlight.
\note The delegate is used as \c ListView.highlight.
*/
property Component languageListHighlight: null
/*! \since QtQuick.VirtualKeyboard.Styles 2.1
Template for the language list background.
*/
property Component languageListBackground: null
/*! \since QtQuick.VirtualKeyboard.Styles 2.1
This property holds the transition to apply to items that
are added to the language list view.
*/
property Transition languageListAdd
/*! \since QtQuick.VirtualKeyboard.Styles 2.1
This property holds the transition to apply to items that
are removed from the language list view.
*/
property Transition languageListRemove
/*!
\since QtQuick.VirtualKeyboard.Styles 2.1
This item is used to indicate where the bounds of the text selection is
and to be able to interactively move the start or end of the selection.
The same item is used for both start and end selection.
Selection handles are currently only supported for the
\l {Integration Method}{application-based integration method}.
*/
property Component selectionHandle: null
/*!
\since QtQuick.VirtualKeyboard.Styles 2.2
This property holds the delegate for the background of the full screen
input container.
*/
property Component fullScreenInputContainerBackground: null
/*!
\since QtQuick.VirtualKeyboard.Styles 2.2
This property holds the delegate for the background of the full screen
input.
*/
property Component fullScreenInputBackground: null
/*!
\since QtQuick.VirtualKeyboard.Styles 2.2
This property holds the margins around the full screen input field.
The default value is \c 0.
*/
property real fullScreenInputMargins: 0
/*!
\since QtQuick.VirtualKeyboard.Styles 2.2
This property holds the padding around the full screen input content.
The default value is \c 0.
*/
property real fullScreenInputPadding: 0
/*!
\since QtQuick.VirtualKeyboard.Styles 2.2
This property holds the delegate for the cursor in the full screen input
field.
The delegate should toggle the visibility of the cursor according to
the \c {parent.blinkStatus} property defined for the full screen input
field. For example:
\code
fullScreenInputCursor: Rectangle {
width: 1
color: "#000"
visible: parent.blinkStatus
}
\endcode
*/
property Component fullScreenInputCursor: null
/*!
\since QtQuick.VirtualKeyboard.Styles 2.2
This property holds the \c font for the full screen input field.
*/
property font fullScreenInputFont
/*!
\since QtQuick.VirtualKeyboard.Styles 2.2
This property holds the password mask character for the full screen
input field.
*/
property string fullScreenInputPasswordCharacter: "\u2022"
/*!
\since QtQuick.VirtualKeyboard.Styles 2.2
This property holds the text color for the full screen input field.
The default color is black.
*/
property color fullScreenInputColor: "#000"
/*!
\since QtQuick.VirtualKeyboard.Styles 2.2
This property holds the selection color for the full screen input
field.
The default color is semi-transparent black.
*/
property color fullScreenInputSelectionColor: Qt.rgba(0, 0, 0, 0.15)
/*!
\since QtQuick.VirtualKeyboard.Styles 2.2
This property holds the selected text color for the full screen input
field.
The default color is set to \c fullScreenInputColor.
*/
property color fullScreenInputSelectedTextColor: fullScreenInputColor
/*! \since QtQuick.VirtualKeyboard.Styles 6.2
Template for the function list item.
\note The delegate is used in a \l ListView.
The following properties are available to the item:
\list
\li \c keyboardFunction - Keyboard function of the current item.
\endlist
*/
property Component functionPopupListDelegate: null
/*! \since QtQuick.VirtualKeyboard.Styles 6.2
Template for the function popup list highlight.
\note The delegate is used as \c ListView.highlight.
*/
property Component functionPopupListHighlight: null
/*! \since QtQuick.VirtualKeyboard.Styles 6.2
Template for the function popup list background.
*/
property Component functionPopupListBackground: null
}

View File

@@ -0,0 +1,45 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
/*!
\qmltype SelectionListItem
\inqmlmodule QtQuick.VirtualKeyboard.Styles
\brief A base type for selection list item delegates.
\ingroup qmlclass
\ingroup qtvirtualkeyboard-styles-qml
The SelectionListItem enables mouse handling for the selection list item
delegates.
*/
Item {
id: selectionListItem
height: ListView.view.height
/*!
\since QtQuick.VirtualKeyboard.Styles 1.1
Sets the sound effect to be played on touch event.
*/
property url soundEffect
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
if (index === -1)
return
selectionListItem.ListView.view.currentIndex = index
selectionListItem.ListView.view.model.selectItem(index)
}
onPressAndHold: {
if (index === -1)
return
if (typeof selectionListItem.ListView.view.longPressItem != "function")
return
selectionListItem.ListView.view.longPressItem(index)
}
}
}

View File

@@ -0,0 +1,192 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import "TraceUtils.js" as TraceUtils
import QtQuick.VirtualKeyboard
/*!
\qmltype TraceCanvas
\inqmlmodule QtQuick.VirtualKeyboard.Styles
\brief A specialized Canvas type for rendering Trace objects.
\ingroup qmlclass
\ingroup qtvirtualkeyboard-styles-qml
\inherits Canvas
\since QtQuick.VirtualKeyboard 2.0
This type provides capabilities for rendering Trace objects on the screen.
To make the Trace rendering available in the keyboard, this type must be
declared as the \l {KeyboardStyle::traceCanvasDelegate}
{KeyboardStyle.traceCanvasDelegate} component.
\code
traceCanvasDelegate: TraceCanvas {
}
\endcode
Custom drawing attributes can be initialized in the Canvas.available
signal. For example:
\code
onAvailableChanged: {
if (!available)
return;
var ctx = getContext("2d")
ctx.lineWidth = 8 * scaleHint
ctx.lineCap = "round"
ctx.strokeStyle = Qt.rgba(0xFF, 0xFF, 0xFF)
ctx.fillStyle = ctx.strokeStyle
}
\endcode
The type offers built-in options for Trace rendering. Currently
the following rendering options are available:
\list
\li \c renderSmoothedLine Renders smoothed line with round corners (the default)
\endlist
The rendering function can be changed with the renderFunction property.
\code
renderFunction: renderSmoothedLine
\endcode
Custom rendering function is also supported. Consider the following example:
\code
renderFunction: renderCustomLine
function renderCustomLine() {
getContext("2d")
var points = trace.points()
...
}
\endcode
*/
Canvas {
id: canvas
/*! Provides access to \l Trace object.
*/
property Trace trace
/*! Enables auto destruction mode.
If enabled, this item will be destroyed when the \c trace object is
destroyed.
The default value is false. In this case the canvas can be reused after
onRecycle signal is triggered.
*/
property bool autoDestroy
/*! Specifies the approximate delay in milliseconds, counted from the beginning of the
auto destruction, before the object is to be destroyed or recycled.
This delay makes it possible, for example, to animate the item before destruction.
The default value is 0.
*/
property int autoDestroyDelay
/*! This property defines the rendering function.
The default value is \c renderSmoothedLine
*/
property var renderFunction: renderSmoothedLine
property int __renderPos
property bool __renderingEnabled
/*! Renders smoothed line with round corners.
This function is incremental and renders only the new part added to the Trace.
This function does not alter any of the canvas attributes (i.e. they can be set elsewhere.)
*/
function renderSmoothedLine() {
__renderPos = TraceUtils.renderSmoothedLine(getContext("2d"), trace, __renderPos)
}
/*! Clears screen and resets the rendering.
\since QtQuick.VirtualKeyboard.Styles 6.1
*/
function renderClear() {
var ctx = getContext("2d")
ctx.clearRect(0, 0, width, height)
__renderPos = 0
}
/*! Recycles trace canvas by clearing all drawings and resetting the variables.
The function triggers onRecycle signal after completed (before the return).
The function returns true when recycling is successful.
\since QtQuick.VirtualKeyboard.Styles 6.1
*/
function recycle() {
if (!available) {
destroy()
return false
}
trace = null
recycleTimer.stop()
opacity = Qt.binding(function() {
return trace ? trace.opacity : 1.0
})
requestAnimationFrame(renderClear)
onRecycle(canvas)
return true
}
/*! Emitted when the \a traceCanvas is recycled.
\since QtQuick.VirtualKeyboard.Styles 6.1
*/
signal onRecycle(var traceCanvas)
Timer {
id: recycleTimer
interval: canvas.autoDestroyDelay
onTriggered: canvas.recycle()
}
onTraceChanged: {
if (trace === null) {
if (autoDestroy || !available)
destroy(autoDestroyDelay)
else
recycleTimer.restart()
}
}
onAvailableChanged: {
__renderingEnabled = available
if (__renderingEnabled)
requestAnimationFrame(renderFunction)
}
Connections {
target: canvas.__renderingEnabled && trace ? trace : null
function onLengthChanged() { if (renderFunction) canvas.requestAnimationFrame(renderFunction) }
function onFinalChanged() { if (renderFunction) canvas.requestAnimationFrame(renderFunction) }
}
opacity: trace ? trace.opacity : 1.0
Behavior on opacity {
NumberAnimation {
duration: 1500
easing.type: Easing.InOutQuad
}
}
}

View File

@@ -0,0 +1,36 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
/*!
\qmltype TraceInputKeyPanel
\inqmlmodule QtQuick.VirtualKeyboard.Styles
\brief A base type of the trace input key.
\ingroup qmlclass
\ingroup qtvirtualkeyboard-styles-qml
\since QtQuick.VirtualKeyboard 2.0
This type provides panel for decorating TraceInputKey
items in the keyboard layout.
*/
Item {
/*! Provides access to properties in TraceInputKey.
A list of available properties in control:
\list
\li \c patternRecognitionMode Pattern recognition mode of this input area
\li \c horizontalRulers A list of horizontal rulers
\li \c verticalRulers A list of vertical rulers
\li \c boundingBox Bounding box for the trace input
\endlist
*/
property Item control
/*! Sets margins of the trace input area.
The margins affect to the bounding box of the trace input area.
*/
property real traceMargins
}

View File

@@ -0,0 +1,63 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
.pragma library
function renderSmoothedLine(ctx, trace, renderPos) {
if (!trace)
return renderPos
if (renderPos >= trace.length)
return renderPos
// Fetch points and draw the initial "dot"
var points, tp
if (renderPos === 0) {
points = trace.points()
tp = points[renderPos++]
ctx.beginPath()
ctx.moveTo(tp.x, tp.y)
ctx.lineTo(tp.x, tp.y + 0.000001)
ctx.stroke()
} else {
points = trace.points(renderPos - 1)
}
// Draw smoothed line using quadratic curve
var i = 1
if (i + 1 < points.length) {
var pt1, pt2
if (renderPos === 1) {
tp = points[i - 1]
} else {
pt1 = points[i - 1]
pt2 = points[i]
tp = Qt.point((pt1.x + pt2.x) / 2, (pt1.y + pt2.y) / 2)
}
ctx.beginPath()
ctx.moveTo(tp.x, tp.y)
while (i + 1 < points.length) {
pt1 = points[i++]
pt2 = points[i]
tp = Qt.point((pt1.x + pt2.x) / 2, (pt1.y + pt2.y) / 2)
ctx.quadraticCurveTo(pt1.x, pt1.y, tp.x, tp.y)
ctx.moveTo(tp.x, tp.y)
}
ctx.stroke()
}
// Draw the remainder of the line
if (trace.final) {
if (i < points.length) {
tp = points[i - 1]
ctx.beginPath()
ctx.moveTo(tp.x, tp.y)
tp = points[i++]
ctx.lineTo(tp.x, tp.y)
ctx.stroke()
}
}
return renderPos + i - 1
}

View File

@@ -0,0 +1,8 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {}

View File

@@ -0,0 +1,31 @@
module QtQuick.VirtualKeyboard.Styles
linktarget Qt6::qtvkbstylesplugin
plugin qtvkbstylesplugin
classname QtQuickVirtualKeyboardStylesPlugin
typeinfo plugins.qmltypes
import QtQuick.VirtualKeyboard.Styles.Builtin auto
depends QtQuick auto
prefer :/qt-project.org/imports/QtQuick/VirtualKeyboard/Styles/
KeyboardStyle 6.0 KeyboardStyle.qml
KeyboardStyle 2.0 KeyboardStyle.qml
KeyboardStyle 1.0 KeyboardStyle.qml
KeyIcon 6.0 KeyIcon.qml
KeyIcon 2.0 KeyIcon.qml
KeyIcon 1.0 KeyIcon.qml
KeyPanel 6.0 KeyPanel.qml
KeyPanel 2.0 KeyPanel.qml
KeyPanel 1.0 KeyPanel.qml
SelectionListItem 6.0 SelectionListItem.qml
SelectionListItem 2.0 SelectionListItem.qml
SelectionListItem 1.0 SelectionListItem.qml
TraceInputKeyPanel 6.0 TraceInputKeyPanel.qml
TraceInputKeyPanel 2.0 TraceInputKeyPanel.qml
TraceInputKeyPanel 1.0 TraceInputKeyPanel.qml
TraceCanvas 6.0 TraceCanvas.qml
TraceCanvas 2.0 TraceCanvas.qml
TraceCanvas 1.0 TraceCanvas.qml
TraceUtils 6.0 TraceUtils.js
TraceUtils 2.0 TraceUtils.js
TraceUtils 1.0 TraceUtils.js
depends QtQuick

View File

@@ -0,0 +1,8 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {}

View File

@@ -0,0 +1,26 @@
module QtQuick.VirtualKeyboard
linktarget Qt6::qtvkbplugin
optional plugin qtvkbplugin
classname QtQuick_VirtualKeyboardPlugin
typeinfo VirtualKeyboardQml.qmltypes
import QtQuick.VirtualKeyboard.Core auto
import QtQuick.VirtualKeyboard.Layouts auto
import QtQuick.VirtualKeyboard.Components auto
depends QtQuick auto
depends QtQuick.Window auto
depends QtQuick.Layouts auto
depends Qt.labs.folderlistmodel auto
depends QtQuick.VirtualKeyboard.Styles auto
depends QtQuick.VirtualKeyboard.Plugins auto
prefer :/qt-project.org/imports/QtQuick/VirtualKeyboard/
HandwritingInputPanel 6.0 HandwritingInputPanel.qml
HandwritingInputPanel 2.0 HandwritingInputPanel.qml
HandwritingInputPanel 1.0 HandwritingInputPanel.qml
InputPanel 6.0 InputPanel.qml
InputPanel 2.0 InputPanel.qml
InputPanel 1.0 InputPanel.qml
EnterKey 6.0 EnterKey.qml
EnterKey 2.0 EnterKey.qml
EnterKey 1.0 EnterKey.qml
depends QtQuick