aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2023-06-20 22:53:19 +0300
committerJarkko Koivikko <jarkko.koivikko@code-q.fi>2023-06-21 08:14:48 +0300
commitdefe853ab5236173faaf87eaffe939a814daa365 (patch)
tree5843ab03670e19609541d40e2f23ac36c261479e /src
parent5445b9176119e11de037c3a15442e25ebbcd6a0d (diff)
Use scoped values in QML for enum classes
This change was made based on feedback on Qt 6.6 api review. Update all the remaining instances of unscoped enum class usage in QML to use scoped values. Remove test for unscoped enums. Pick-to: 6.6 Change-Id: I8c1147001d41666cbf6fab967ada8981065c28fe Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/components/BackspaceKey.qml2
-rw-r--r--src/components/BaseKey.qml4
-rw-r--r--src/components/ChangeLanguageKey.qml6
-rw-r--r--src/components/CharacterPreviewBubble.qml4
-rw-r--r--src/components/EnterKey.qml2
-rw-r--r--src/components/FillerKey.qml2
-rw-r--r--src/components/FlickKey.qml2
-rw-r--r--src/components/FunctionPopupList.qml6
-rw-r--r--src/components/HandwritingModeKey.qml6
-rw-r--r--src/components/HideKeyboardKey.qml4
-rw-r--r--src/components/InputModeKey.qml2
-rw-r--r--src/components/Key.qml2
-rw-r--r--src/components/Keyboard.qml18
-rw-r--r--src/components/ModeKey.qml2
-rw-r--r--src/components/NumberKey.qml2
-rw-r--r--src/components/ShiftKey.qml2
-rw-r--r--src/components/SpaceKey.qml2
-rw-r--r--src/components/SymbolModeKey.qml2
-rw-r--r--src/styles/builtin/default/style.qml6
-rw-r--r--src/styles/builtin/retro/style.qml12
-rw-r--r--src/virtualkeyboard/doc/snippets/CustomInputMethod.qml2
21 files changed, 45 insertions, 45 deletions
diff --git a/src/components/BackspaceKey.qml b/src/components/BackspaceKey.qml
index 3b37a6ae..cb018be0 100644
--- a/src/components/BackspaceKey.qml
+++ b/src/components/BackspaceKey.qml
@@ -20,7 +20,7 @@ import QtQuick.VirtualKeyboard
BaseKey {
key: Qt.Key_Backspace
- keyType: QtVirtualKeyboard.BackspaceKey
+ keyType: QtVirtualKeyboard.KeyType.BackspaceKey
repeat: true
functionKey: true
highlighted: true
diff --git a/src/components/BaseKey.qml b/src/components/BaseKey.qml
index bf31ccbe..1fb2dff4 100644
--- a/src/components/BaseKey.qml
+++ b/src/components/BaseKey.qml
@@ -28,9 +28,9 @@ Item {
\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.SpaceKey.
+ For example, \l SpaceKey sets this value to \e QtVirtualKeyboard.KeyType.SpaceKey.
*/
- property int keyType: QtVirtualKeyboard.BaseKey
+ property int keyType: QtVirtualKeyboard.KeyType.BaseKey
/*! Sets the key weight value which determines the relative size of the key.
diff --git a/src/components/ChangeLanguageKey.qml b/src/components/ChangeLanguageKey.qml
index 4c10a686..66e9b2ae 100644
--- a/src/components/ChangeLanguageKey.qml
+++ b/src/components/ChangeLanguageKey.qml
@@ -41,13 +41,13 @@ BaseKey {
property bool customLayoutsOnly: false
id: changeLanguageKey
- keyType: QtVirtualKeyboard.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.ChangeLanguage, customLayoutsOnly)
- enabled: keyboard.isKeyboardFunctionAvailable(QtVirtualKeyboard.ChangeLanguage, customLayoutsOnly)
+ onClicked: keyboard.doKeyboardFunction(QtVirtualKeyboard.KeyboardFunction.ChangeLanguage, customLayoutsOnly)
+ enabled: keyboard.isKeyboardFunctionAvailable(QtVirtualKeyboard.KeyboardFunction.ChangeLanguage, customLayoutsOnly)
visible: VirtualKeyboardSettings.visibleFunctionKeys & QtVirtualKeyboard.KeyboardFunctionKeys.LanguageFunctionKey
}
diff --git a/src/components/CharacterPreviewBubble.qml b/src/components/CharacterPreviewBubble.qml
index 4819f371..8f09d465 100644
--- a/src/components/CharacterPreviewBubble.qml
+++ b/src/components/CharacterPreviewBubble.qml
@@ -27,10 +27,10 @@ Item {
characterPreview.item.text = Qt.binding(function() {
if (!activeKey)
return ""
- var displayText = (activeKey.keyType === QtVirtualKeyboard.FlickKey) ? activeKey.text : activeKey.displayText
+ var displayText = (activeKey.keyType === QtVirtualKeyboard.KeyType.FlickKey) ? activeKey.text : activeKey.displayText
return InputContext.uppercase ? displayText.toUpperCase() : displayText
})
- if (activeKey.keyType === QtVirtualKeyboard.FlickKey) {
+ if (activeKey.keyType === QtVirtualKeyboard.KeyType.FlickKey) {
if (characterPreview.item.hasOwnProperty("flickLeft")) {
characterPreview.item.flickLeft = activeKey.flickLeft
characterPreview.item.flickRight = activeKey.flickRight
diff --git a/src/components/EnterKey.qml b/src/components/EnterKey.qml
index 17e2a109..39ef8599 100644
--- a/src/components/EnterKey.qml
+++ b/src/components/EnterKey.qml
@@ -23,7 +23,7 @@ BaseKey {
*/
readonly property int actionId: InputContext.priv.hasEnterKeyAction(InputContext.priv.inputItem) ? InputContext.priv.inputItem.EnterKeyAction.actionId : EnterKeyAction.None
- keyType: QtVirtualKeyboard.EnterKey
+ keyType: QtVirtualKeyboard.KeyType.EnterKey
text: "\n"
displayText: InputContext.priv.hasEnterKeyAction(InputContext.priv.inputItem) ? InputContext.priv.inputItem.EnterKeyAction.label : ""
key: Qt.Key_Return
diff --git a/src/components/FillerKey.qml b/src/components/FillerKey.qml
index 5187c2ef..54c400a5 100644
--- a/src/components/FillerKey.qml
+++ b/src/components/FillerKey.qml
@@ -18,6 +18,6 @@ import QtQuick.VirtualKeyboard
*/
BaseKey {
- keyType: QtVirtualKeyboard.FillerKey
+ keyType: QtVirtualKeyboard.KeyType.FillerKey
showPreview: false
}
diff --git a/src/components/FlickKey.qml b/src/components/FlickKey.qml
index e6f2a2ae..e9afb492 100644
--- a/src/components/FlickKey.qml
+++ b/src/components/FlickKey.qml
@@ -39,7 +39,7 @@ Key {
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.FlickKey
+ keyType: QtVirtualKeyboard.KeyType.FlickKey
Component.onCompleted: {
__key = key
diff --git a/src/components/FunctionPopupList.qml b/src/components/FunctionPopupList.qml
index 64234590..ed617656 100644
--- a/src/components/FunctionPopupList.qml
+++ b/src/components/FunctionPopupList.qml
@@ -74,9 +74,9 @@ Item {
function open(key, originX, originY) {
listModel.clear()
for (const keyboardFunction of [
- QtVirtualKeyboard.HideInputPanel,
- QtVirtualKeyboard.ChangeLanguage,
- QtVirtualKeyboard.ToggleHandwritingMode,
+ QtVirtualKeyboard.KeyboardFunction.HideInputPanel,
+ QtVirtualKeyboard.KeyboardFunction.ChangeLanguage,
+ QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode,
]) {
const functionKey = InputContext.priv.keyboardFunctionKey(keyboardFunction)
if (keyboard.isKeyboardFunctionAvailable(keyboardFunction) &&
diff --git a/src/components/HandwritingModeKey.qml b/src/components/HandwritingModeKey.qml
index cdbca933..520f431d 100644
--- a/src/components/HandwritingModeKey.qml
+++ b/src/components/HandwritingModeKey.qml
@@ -22,12 +22,12 @@ import QtQuick.VirtualKeyboard
*/
Key {
- keyType: QtVirtualKeyboard.HandwritingModeKey
+ keyType: QtVirtualKeyboard.KeyType.HandwritingModeKey
key: Qt.Key_Context2
displayText: "HWR"
functionKey: true
highlighted: true
- visible: keyboard.isKeyboardFunctionAvailable(QtVirtualKeyboard.ToggleHandwritingMode)
- onClicked: keyboard.doKeyboardFunction(QtVirtualKeyboard.ToggleHandwritingMode)
+ visible: keyboard.isKeyboardFunctionAvailable(QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode)
+ onClicked: keyboard.doKeyboardFunction(QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode)
keyPanelDelegate: keyboard.style ? keyboard.style.handwritingKeyPanel : undefined
}
diff --git a/src/components/HideKeyboardKey.qml b/src/components/HideKeyboardKey.qml
index c7c53f46..b61887ac 100644
--- a/src/components/HideKeyboardKey.qml
+++ b/src/components/HideKeyboardKey.qml
@@ -19,10 +19,10 @@ import QtQuick.VirtualKeyboard.Settings
*/
BaseKey {
- keyType: QtVirtualKeyboard.HideKeyboardKey
+ keyType: QtVirtualKeyboard.KeyType.HideKeyboardKey
functionKey: true
highlighted: true
- onClicked: keyboard.doKeyboardFunction(QtVirtualKeyboard.HideInputPanel)
+ onClicked: keyboard.doKeyboardFunction(QtVirtualKeyboard.KeyboardFunction.HideInputPanel)
keyPanelDelegate: keyboard.style ? keyboard.style.hideKeyPanel : undefined
visible: VirtualKeyboardSettings.visibleFunctionKeys & QtVirtualKeyboard.KeyboardFunctionKeys.HideFunctionKey
}
diff --git a/src/components/InputModeKey.qml b/src/components/InputModeKey.qml
index 7ca32f86..d51c8429 100644
--- a/src/components/InputModeKey.qml
+++ b/src/components/InputModeKey.qml
@@ -19,7 +19,7 @@ import QtQuick.VirtualKeyboard
*/
Key {
- keyType: QtVirtualKeyboard.InputModeKey
+ keyType: QtVirtualKeyboard.KeyType.InputModeKey
key: Qt.Key_Mode_switch
noKeyEvent: true
functionKey: true
diff --git a/src/components/Key.qml b/src/components/Key.qml
index c90fe11f..7005a30e 100644
--- a/src/components/Key.qml
+++ b/src/components/Key.qml
@@ -19,7 +19,7 @@ import QtQuick.VirtualKeyboard
BaseKey {
id: keyItem
- keyType: QtVirtualKeyboard.Key
+ keyType: QtVirtualKeyboard.KeyType.Key
key: !functionKey && text.length > 0 ? text.toUpperCase().charCodeAt(0) : Qt.Key_unknown
keyPanelDelegate: keyboard.style ? keyboard.style.keyPanel : undefined
}
diff --git a/src/components/Keyboard.qml b/src/components/Keyboard.qml
index 18a79fbb..260bc0d0 100644
--- a/src/components/Keyboard.qml
+++ b/src/components/Keyboard.qml
@@ -951,7 +951,7 @@ Item {
if (keyboard.activeKey === activeKey)
return
if (keyboard.activeKey) {
- if (keyboard.activeKey.keyType === QtVirtualKeyboard.FlickKey)
+ if (keyboard.activeKey.keyType === QtVirtualKeyboard.KeyType.FlickKey)
keyboard.activeKey.onKeyChanged.disconnect(onFlickKeyKeyChanged)
keyboard.activeKey.active = false
}
@@ -1121,7 +1121,7 @@ Item {
if (!initialKey)
continue
activeTouchPoint = touchPoints[i]
- if (initialKey.keyType === QtVirtualKeyboard.FlickKey) {
+ if (initialKey.keyType === QtVirtualKeyboard.KeyType.FlickKey) {
initialKey.press(activeTouchPoint.x, activeTouchPoint.y)
initialKey.onKeyChanged.connect(onFlickKeyKeyChanged)
} else {
@@ -1140,7 +1140,7 @@ Item {
alternativeKeys.move(mapToItem(alternativeKeys, activeTouchPoint.x, 0).x)
} else if (functionPopupList.active) {
functionPopupList.move(mapToItem(functionPopupList, activeTouchPoint.x, activeTouchPoint.y))
- } else if (activeKey && activeKey.keyType === QtVirtualKeyboard.FlickKey) {
+ } else if (activeKey && activeKey.keyType === QtVirtualKeyboard.KeyType.FlickKey) {
activeKey.update(activeTouchPoint.x, activeTouchPoint.y)
} else {
var key = null
@@ -1779,10 +1779,10 @@ Item {
if (!isKeyboardFunctionAvailable(keyboardFunction))
return
switch (keyboardFunction) {
- case QtVirtualKeyboard.HideInputPanel:
+ case QtVirtualKeyboard.KeyboardFunction.HideInputPanel:
InputContext.priv.hideInputPanel()
break
- case QtVirtualKeyboard.ChangeLanguage:
+ case QtVirtualKeyboard.KeyboardFunction.ChangeLanguage:
if (style.languagePopupListEnabled) {
if (!languagePopupListActive) {
showLanguagePopup(activeKey, false)
@@ -1794,7 +1794,7 @@ Item {
changeInputLanguage(customLayoutsOnly)
}
break
- case QtVirtualKeyboard.ToggleHandwritingMode:
+ case QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode:
setHandwritingMode(!handwritingMode)
break
default:
@@ -1805,12 +1805,12 @@ Item {
function isKeyboardFunctionAvailable(keyboardFunction) {
switch (keyboardFunction) {
- case QtVirtualKeyboard.HideInputPanel:
+ case QtVirtualKeyboard.KeyboardFunction.HideInputPanel:
return true
- case QtVirtualKeyboard.ChangeLanguage:
+ case QtVirtualKeyboard.KeyboardFunction.ChangeLanguage:
const customLayoutsOnly = arguments.length == 2 && arguments[1]
return canChangeInputLanguage(customLayoutsOnly)
- case QtVirtualKeyboard.ToggleHandwritingMode:
+ case QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode:
return isHandwritingAvailable()
default:
return false
diff --git a/src/components/ModeKey.qml b/src/components/ModeKey.qml
index aaec44f5..63134c13 100644
--- a/src/components/ModeKey.qml
+++ b/src/components/ModeKey.qml
@@ -33,7 +33,7 @@ Key {
The default is false.
*/
property bool mode
- keyType: QtVirtualKeyboard.ModeKey
+ keyType: QtVirtualKeyboard.KeyType.ModeKey
noKeyEvent: true
functionKey: true
highlighted: true
diff --git a/src/components/NumberKey.qml b/src/components/NumberKey.qml
index 6e3b07db..2a55d824 100644
--- a/src/components/NumberKey.qml
+++ b/src/components/NumberKey.qml
@@ -21,5 +21,5 @@ import QtQuick.VirtualKeyboard
Key {
showPreview: false
- keyType: QtVirtualKeyboard.NumberKey
+ keyType: QtVirtualKeyboard.KeyType.NumberKey
}
diff --git a/src/components/ShiftKey.qml b/src/components/ShiftKey.qml
index 76fdc3fa..a2623395 100644
--- a/src/components/ShiftKey.qml
+++ b/src/components/ShiftKey.qml
@@ -19,7 +19,7 @@ import QtQuick.VirtualKeyboard
BaseKey {
id: shiftKey
- keyType: QtVirtualKeyboard.ShiftKey
+ keyType: QtVirtualKeyboard.KeyType.ShiftKey
key: Qt.Key_Shift
enabled: InputContext.priv.shiftHandler.toggleShiftEnabled
highlighted: true
diff --git a/src/components/SpaceKey.qml b/src/components/SpaceKey.qml
index 73d41c37..d8313a6c 100644
--- a/src/components/SpaceKey.qml
+++ b/src/components/SpaceKey.qml
@@ -18,7 +18,7 @@ import QtQuick.VirtualKeyboard
*/
Key {
- keyType: QtVirtualKeyboard.SpaceKey
+ keyType: QtVirtualKeyboard.KeyType.SpaceKey
text: " "
displayText: ""
repeat: true
diff --git a/src/components/SymbolModeKey.qml b/src/components/SymbolModeKey.qml
index 1aa24c4d..662ce8ac 100644
--- a/src/components/SymbolModeKey.qml
+++ b/src/components/SymbolModeKey.qml
@@ -18,7 +18,7 @@ import QtQuick.VirtualKeyboard
*/
Key {
- keyType: QtVirtualKeyboard.SymbolModeKey
+ keyType: QtVirtualKeyboard.KeyType.SymbolModeKey
key: Qt.Key_Context1
displayText: "&123"
functionKey: true
diff --git a/src/styles/builtin/default/style.qml b/src/styles/builtin/default/style.qml
index 308e78aa..0681ef43 100644
--- a/src/styles/builtin/default/style.qml
+++ b/src/styles/builtin/default/style.qml
@@ -1181,11 +1181,11 @@ KeyboardStyle {
smooth: false
source: {
switch (keyboardFunction) {
- case QtVirtualKeyboard.HideInputPanel:
+ case QtVirtualKeyboard.KeyboardFunction.HideInputPanel:
return resourcePrefix + "images/hidekeyboard-fff.svg"
- case QtVirtualKeyboard.ChangeLanguage:
+ case QtVirtualKeyboard.KeyboardFunction.ChangeLanguage:
return resourcePrefix + "images/globe-fff.svg"
- case QtVirtualKeyboard.ToggleHandwritingMode:
+ case QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode:
return resourcePrefix + (keyboard.handwritingMode ? "images/textmode-fff.svg" : "images/handwriting-fff.svg")
}
}
diff --git a/src/styles/builtin/retro/style.qml b/src/styles/builtin/retro/style.qml
index 2f9c62b5..dd295446 100644
--- a/src/styles/builtin/retro/style.qml
+++ b/src/styles/builtin/retro/style.qml
@@ -1168,11 +1168,11 @@ KeyboardStyle {
smooth: false
source: {
switch (keyboardFunction) {
- case QtVirtualKeyboard.HideInputPanel:
+ case QtVirtualKeyboard.KeyboardFunction.HideInputPanel:
return resourcePrefix + "images/hidekeyboard-c5a96f.svg"
- case QtVirtualKeyboard.ChangeLanguage:
+ case QtVirtualKeyboard.KeyboardFunction.ChangeLanguage:
return resourcePrefix + "images/globe-c5a96f.svg"
- case QtVirtualKeyboard.ToggleHandwritingMode:
+ case QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode:
return resourcePrefix + (keyboard.handwritingMode ? "images/textmode-c5a96f.svg" : "images/handwriting-c5a96f.svg")
}
}
@@ -1182,11 +1182,11 @@ KeyboardStyle {
target: functionIcon
source: {
switch (keyboardFunction) {
- case QtVirtualKeyboard.HideInputPanel:
+ case QtVirtualKeyboard.KeyboardFunction.HideInputPanel:
return resourcePrefix + "images/hidekeyboard-fff.svg"
- case QtVirtualKeyboard.ChangeLanguage:
+ case QtVirtualKeyboard.KeyboardFunction.ChangeLanguage:
return resourcePrefix + "images/globe-fff.svg"
- case QtVirtualKeyboard.ToggleHandwritingMode:
+ case QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode:
return resourcePrefix + (keyboard.handwritingMode ? "images/textmode-fff.svg" : "images/handwriting-fff.svg")
}
}
diff --git a/src/virtualkeyboard/doc/snippets/CustomInputMethod.qml b/src/virtualkeyboard/doc/snippets/CustomInputMethod.qml
index b4b54aa7..e1ba8985 100644
--- a/src/virtualkeyboard/doc/snippets/CustomInputMethod.qml
+++ b/src/virtualkeyboard/doc/snippets/CustomInputMethod.qml
@@ -8,7 +8,7 @@ import QtQuick.VirtualKeyboard
InputMethod {
function inputModes(locale) {
- return [InputEngine.Latin];
+ return [InputEngine.InputMode.Latin];
}
function setInputMode(locale, inputMode) {