Initial commit
This commit is contained in:
+8
@@ -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 {}
|
||||
@@ -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/
|
||||
|
||||
BIN
Binary file not shown.
@@ -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;
|
||||
}
|
||||
"
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -0,0 +1,538 @@
|
||||
// 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 maximum design height of the keyboard.
|
||||
\since 6.11
|
||||
*/
|
||||
property real keyboardDesignMaximumHeight
|
||||
|
||||
/*! 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 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 6.2
|
||||
|
||||
Template for the function popup list highlight.
|
||||
|
||||
\note The delegate is used as \c ListView.highlight.
|
||||
*/
|
||||
property Component functionPopupListHighlight: null
|
||||
|
||||
/*! \since 6.2
|
||||
|
||||
Template for the function popup list background.
|
||||
*/
|
||||
property Component functionPopupListBackground: null
|
||||
}
|
||||
+45
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 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 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 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
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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 {}
|
||||
@@ -0,0 +1,30 @@
|
||||
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
|
||||
|
||||
BIN
Binary file not shown.
Reference in New Issue
Block a user