From 5d8c0c9b049f0856dd10ecaf9275aa3a38a6e395 Mon Sep 17 00:00:00 2001 From: zhaokexin Date: Fri, 26 Jan 2024 16:27:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8C=89=E9=94=AE?= =?UTF-8?q?=E9=95=BF=E6=8C=89=E7=AE=A1=E7=90=86=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qml.qrc | 1 + qml/LongPressedKeyManager.qml | 23 +++++++++++++++++++++++ qml/VirtualKeyboard.qml | 11 ++++++++--- qml/key/CharKey.qml | 2 +- qml/key/SwitchKey.qml | 2 +- 5 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 qml/LongPressedKeyManager.qml diff --git a/qml.qrc b/qml.qrc index dd2d1f2..da1792e 100644 --- a/qml.qrc +++ b/qml.qrc @@ -42,5 +42,6 @@ img/up.svg img/down.svg qml/js/keycode.js + qml/LongPressedKeyManager.qml diff --git a/qml/LongPressedKeyManager.qml b/qml/LongPressedKeyManager.qml new file mode 100644 index 0000000..0c4637f --- /dev/null +++ b/qml/LongPressedKeyManager.qml @@ -0,0 +1,23 @@ +/* +* Copyright 2022 KylinSoft Co., Ltd. +* +* This program is free software: you can redistribute it and/or modify it under +* the terms of the GNU General Public License as published by the Free Software +* Foundation, either version 3 of the License, or (at your option) any later +* version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +* details. +* +* You should have received a copy of the GNU General Public License along with +* this program. If not, see . +*/ + +import QtQuick 2.0 + +Item { + property bool isShiftKeyLongPressed: shiftState === "LONG_PRESSED" || + shiftState === "OPEN_LONG_PRESSED" +} diff --git a/qml/VirtualKeyboard.qml b/qml/VirtualKeyboard.qml index 92665fa..d98b8f2 100644 --- a/qml/VirtualKeyboard.qml +++ b/qml/VirtualKeyboard.qml @@ -133,8 +133,9 @@ Rectangle { property bool isAllLayoutListVisible: false property string layout: "classic" property bool isCurrentIMListVisible: false - property bool isShiftKeyLongPressed: shiftState === "LONG_PRESSED" || - shiftState === "OPEN_LONG_PRESSED" + + //长按键盘按键相关 + property var longPressedKeyManager: longPressedKeyManager_ //内部使用 signal showToolbar() @@ -241,7 +242,7 @@ Rectangle { } function updateShiftKeyNormalState() { - if (!isShiftKeyLongPressed) { + if (!longPressedKeyManager.isShiftKeyLongPressed) { shiftState = "NORMAL" } } @@ -254,6 +255,10 @@ Rectangle { } } + LongPressedKeyManager { + id: longPressedKeyManager_ + } + Rectangle { id: virtualKeyboardContent color: virtualKeyboard.virtualKeyboardColor diff --git a/qml/key/CharKey.qml b/qml/key/CharKey.qml index 72fb6fb..711af14 100755 --- a/qml/key/CharKey.qml +++ b/qml/key/CharKey.qml @@ -42,7 +42,7 @@ BaseKey { MouseArea { id: keyMouseArea anchors.fill: parent - hoverEnabled: !virtualKeyboard.isShiftKeyLongPressed + hoverEnabled: !longPressedKeyManager.isShiftKeyLongPressed onEntered: { keyBackground.state = "HOVER" diff --git a/qml/key/SwitchKey.qml b/qml/key/SwitchKey.qml index 7230475..1e34d69 100755 --- a/qml/key/SwitchKey.qml +++ b/qml/key/SwitchKey.qml @@ -117,7 +117,7 @@ BaseKey { MouseArea { id: keyMouseArea_ anchors.fill: parent - hoverEnabled: !virtualKeyboard.isShiftKeyLongPressed + hoverEnabled: !longPressedKeyManager.isShiftKeyLongPressed onEntered: { if (switchKeyState == "NORMAL") { keyBackground.state = "HOVER_NORMAL" -- Gitee From 2cfb1eb780c5ba4cd29bb316efe026834574da6d Mon Sep 17 00:00:00 2001 From: zhao-kexin111 Date: Fri, 26 Jan 2024 15:36:01 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=99=AE=E9=80=9A=E6=8C=89=E9=94=AE?= =?UTF-8?q?=E5=90=8C=E4=B8=80=E6=97=B6=E5=88=BB=E5=8F=AA=E6=9C=89=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=8C=89=E9=94=AE=E5=A4=84=E4=BA=8E=E9=95=BF=E6=8C=89?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qml/ClassicKeyboardLayout.qml | 114 +++++++++++++++++----------------- qml/LongPressedKeyManager.qml | 27 ++++++++ qml/key/CharKey.qml | 20 +++--- 3 files changed, 92 insertions(+), 69 deletions(-) diff --git a/qml/ClassicKeyboardLayout.qml b/qml/ClassicKeyboardLayout.qml index d265424..8be203c 100644 --- a/qml/ClassicKeyboardLayout.qml +++ b/qml/ClassicKeyboardLayout.qml @@ -27,76 +27,76 @@ Column { Row { anchors.horizontalCenter: parent.horizontalCenter spacing: virtualKeyboard.keySpacing - ActionKey{ label: "Esc"; height: virtualKeyboard.keyHeight * 3/4; keycode: Keycode.KEY_ESC} - SymbolKey{ label: "`"; shiftedText: "~"; height: virtualKeyboard.firstRowKeyHeight; keycode: Keycode.KEY_GRAVE } - FnSymbolKey{ label: "1"; shiftedText: "!"; fnValue:"F1"; fnKeycode: Keycode.KEY_F1; numberKeycode: Keycode.KEY_1 } - FnSymbolKey{ label: "2"; shiftedText: "@"; fnValue:"F2"; fnKeycode: Keycode.KEY_F2; numberKeycode: Keycode.KEY_2 } - FnSymbolKey{ label: "3"; shiftedText: "#"; fnValue:"F3"; fnKeycode: Keycode.KEY_F3; numberKeycode: Keycode.KEY_3 } - FnSymbolKey{ label: "4"; shiftedText: "$"; fnValue:"F4"; fnKeycode: Keycode.KEY_F4; numberKeycode: Keycode.KEY_4 } - FnSymbolKey{ label: "5"; shiftedText: "%"; fnValue:"F5"; fnKeycode: Keycode.KEY_F5; numberKeycode: Keycode.KEY_5 } - FnSymbolKey{ label: "6"; shiftedText: "^"; fnValue:"F6"; fnKeycode: Keycode.KEY_F6; numberKeycode: Keycode.KEY_6 } - FnSymbolKey{ label: "7"; shiftedText: "&"; fnValue:"F7"; fnKeycode: Keycode.KEY_F7; numberKeycode: Keycode.KEY_7 } - FnSymbolKey{ label: "8"; shiftedText: "*"; fnValue:"F8"; fnKeycode: Keycode.KEY_F8; numberKeycode: Keycode.KEY_8 } - FnSymbolKey{ label: "9"; shiftedText: "("; fnValue:"F9"; fnKeycode: Keycode.KEY_F9; numberKeycode: Keycode.KEY_9 } - FnSymbolKey{ label: "0"; shiftedText: ")"; fnValue:"F10"; fnKeycode: Keycode.KEY_F10; numberKeycode: Keycode.KEY_0 } - FnSymbolKey{ label: "-"; shiftedText: "_"; fnValue:"F11"; fnKeycode: Keycode.KEY_F11; numberKeycode: Keycode.KEY_MINUS } - FnSymbolKey{ label: "="; shiftedText: "+"; fnValue:"F12"; fnKeycode: Keycode.KEY_F12; numberKeycode: Keycode.KEY_EQUAL } - BackspaceKey{ keycode: Keycode.KEY_BACKSPACE } + ActionKey{ charKeyId_: "key_esc"; label: "Esc"; height: virtualKeyboard.keyHeight * 3/4; keycode: Keycode.KEY_ESC } + SymbolKey{ charKeyId_: "key_grave"; label: "`"; shiftedText: "~"; height: virtualKeyboard.firstRowKeyHeight; keycode: Keycode.KEY_GRAVE } + FnSymbolKey{ charKeyId_: "key_1"; label: "1"; shiftedText: "!"; fnValue:"F1"; fnKeycode: Keycode.KEY_F1; numberKeycode: Keycode.KEY_1 } + FnSymbolKey{ charKeyId_: "key_2"; label: "2"; shiftedText: "@"; fnValue:"F2"; fnKeycode: Keycode.KEY_F2; numberKeycode: Keycode.KEY_2 } + FnSymbolKey{ charKeyId_: "key_3"; label: "3"; shiftedText: "#"; fnValue:"F3"; fnKeycode: Keycode.KEY_F3; numberKeycode: Keycode.KEY_3 } + FnSymbolKey{ charKeyId_: "key_4"; label: "4"; shiftedText: "$"; fnValue:"F4"; fnKeycode: Keycode.KEY_F4; numberKeycode: Keycode.KEY_4 } + FnSymbolKey{ charKeyId_: "key_5"; label: "5"; shiftedText: "%"; fnValue:"F5"; fnKeycode: Keycode.KEY_F5; numberKeycode: Keycode.KEY_5 } + FnSymbolKey{ charKeyId_: "key_6"; label: "6"; shiftedText: "^"; fnValue:"F6"; fnKeycode: Keycode.KEY_F6; numberKeycode: Keycode.KEY_6 } + FnSymbolKey{ charKeyId_: "key_7"; label: "7"; shiftedText: "&"; fnValue:"F7"; fnKeycode: Keycode.KEY_F7; numberKeycode: Keycode.KEY_7 } + FnSymbolKey{ charKeyId_: "key_8"; label: "8"; shiftedText: "*"; fnValue:"F8"; fnKeycode: Keycode.KEY_F8; numberKeycode: Keycode.KEY_8 } + FnSymbolKey{ charKeyId_: "key_9"; label: "9"; shiftedText: "("; fnValue:"F9"; fnKeycode: Keycode.KEY_F9; numberKeycode: Keycode.KEY_9 } + FnSymbolKey{ charKeyId_: "key_0"; label: "0"; shiftedText: ")"; fnValue:"F10"; fnKeycode: Keycode.KEY_F10; numberKeycode: Keycode.KEY_0 } + FnSymbolKey{ charKeyId_: "key_minus"; label: "-"; shiftedText: "_"; fnValue:"F11"; fnKeycode: Keycode.KEY_F11; numberKeycode: Keycode.KEY_MINUS } + FnSymbolKey{ charKeyId_: "key_equal"; label: "="; shiftedText: "+"; fnValue:"F12"; fnKeycode: Keycode.KEY_F12; numberKeycode: Keycode.KEY_EQUAL } + BackspaceKey{ charKeyId_: "key_backspace"; keycode: Keycode.KEY_BACKSPACE } } Row { anchors.horizontalCenter: parent.horizontalCenter spacing: virtualKeyboard.keySpacing - ActionKey{ label: "Tab"; width: virtualKeyboard.keyWidth*1.5 + virtualKeyboard.keySpacing; alignment: Text.AlignLeft; keycode: Keycode.KEY_TAB } - LetterKey{ label: "q"; shiftedText: "Q"; keycode: Keycode.KEY_Q } - LetterKey{ label: "w"; shiftedText: "W"; keycode: Keycode.KEY_W } - LetterKey{ label: "e"; shiftedText: "E"; keycode: Keycode.KEY_E } - LetterKey{ label: "r"; shiftedText: "R"; keycode: Keycode.KEY_R } - LetterKey{ label: "t"; shiftedText: "T"; keycode: Keycode.KEY_T } - LetterKey{ label: "y"; shiftedText: "Y"; keycode: Keycode.KEY_Y } - LetterKey{ label: "u"; shiftedText: "U"; keycode: Keycode.KEY_U } - LetterKey{ label: "i"; shiftedText: "I"; keycode: Keycode.KEY_I } - LetterKey{ label: "o"; shiftedText: "O"; keycode: Keycode.KEY_O } - LetterKey{ label: "p"; shiftedText: "P"; keycode: Keycode.KEY_P } - SymbolKey{ label: "["; shiftedText: "{"; keycode: Keycode.KEY_LEFTBRACE } - SymbolKey{ label: "]"; shiftedText: "}"; keycode: Keycode.KEY_RIGHTBRACE } - SymbolKey{ label: "\\"; shiftedText: "|"; keycode: Keycode.KEY_BACKSLASH } - ActionKey{ label: "Del"; keycode: Keycode.KEY_DELETE } + ActionKey{ charKeyId_: "key_tab"; label: "Tab"; width: virtualKeyboard.keyWidth*1.5 + virtualKeyboard.keySpacing; alignment: Text.AlignLeft; keycode: Keycode.KEY_TAB } + LetterKey{ charKeyId_: "key_q"; label: "q"; shiftedText: "Q"; keycode: Keycode.KEY_Q } + LetterKey{ charKeyId_: "key_w"; label: "w"; shiftedText: "W"; keycode: Keycode.KEY_W } + LetterKey{ charKeyId_: "key_e"; label: "e"; shiftedText: "E"; keycode: Keycode.KEY_E } + LetterKey{ charKeyId_: "key_r"; label: "r"; shiftedText: "R"; keycode: Keycode.KEY_R } + LetterKey{ charKeyId_: "key_t"; label: "t"; shiftedText: "T"; keycode: Keycode.KEY_T } + LetterKey{ charKeyId_: "key_y"; label: "y"; shiftedText: "Y"; keycode: Keycode.KEY_Y } + LetterKey{ charKeyId_: "key_u"; label: "u"; shiftedText: "U"; keycode: Keycode.KEY_U } + LetterKey{ charKeyId_: "key_i"; label: "i"; shiftedText: "I"; keycode: Keycode.KEY_I } + LetterKey{ charKeyId_: "key_o"; label: "o"; shiftedText: "O"; keycode: Keycode.KEY_O } + LetterKey{ charKeyId_: "key_p"; label: "p"; shiftedText: "P"; keycode: Keycode.KEY_P } + SymbolKey{ charKeyId_: "key_leftBrace"; label: "["; shiftedText: "{"; keycode: Keycode.KEY_LEFTBRACE } + SymbolKey{ charKeyId_: "key_rightBrace"; label: "]"; shiftedText: "}"; keycode: Keycode.KEY_RIGHTBRACE } + SymbolKey{ charKeyId_: "key_backSlash"; label: "\\"; shiftedText: "|"; keycode: Keycode.KEY_BACKSLASH } + ActionKey{ charKeyId_: "key_delete"; label: "Del"; keycode: Keycode.KEY_DELETE } } Row { anchors.horizontalCenter: parent.horizontalCenter spacing: virtualKeyboard.keySpacing CapslockKey{width: virtualKeyboard.keyWidth*2 + virtualKeyboard.keySpacing; alignment: Text.AlignLeft; keycode: Keycode.KEY_CAPSLOCK } - LetterKey{ label: "a"; shiftedText: "A"; keycode: Keycode.KEY_A } - LetterKey{ label: "s"; shiftedText: "S"; keycode: Keycode.KEY_S } - LetterKey{ label: "d"; shiftedText: "D"; keycode: Keycode.KEY_D } - LetterKey{ label: "f"; shiftedText: "F"; keycode: Keycode.KEY_F } - LetterKey{ label: "g"; shiftedText: "G"; keycode: Keycode.KEY_G } - LetterKey{ label: "h"; shiftedText: "H"; keycode: Keycode.KEY_H } - LetterKey{ label: "j"; shiftedText: "J"; keycode: Keycode.KEY_J } - LetterKey{ label: "k"; shiftedText: "K"; keycode: Keycode.KEY_K } - LetterKey{ label: "l"; shiftedText: "L"; keycode: Keycode.KEY_L } - SymbolKey{ label: ";"; shiftedText: ":"; keycode: Keycode.KEY_SEMICOLON } - SymbolKey{ label: "'"; shiftedText: "\""; keycode: Keycode.KEY_APOSTROPHE } - EnterKey{ keycode: Keycode.KEY_ENTER } + LetterKey{ charKeyId_: "key_a"; label: "a"; shiftedText: "A"; keycode: Keycode.KEY_A } + LetterKey{ charKeyId_: "key_s"; label: "s"; shiftedText: "S"; keycode: Keycode.KEY_S } + LetterKey{ charKeyId_: "key_d"; label: "d"; shiftedText: "D"; keycode: Keycode.KEY_D } + LetterKey{ charKeyId_: "key_f"; label: "f"; shiftedText: "F"; keycode: Keycode.KEY_F } + LetterKey{ charKeyId_: "key_g"; label: "g"; shiftedText: "G"; keycode: Keycode.KEY_G } + LetterKey{ charKeyId_: "key_h"; label: "h"; shiftedText: "H"; keycode: Keycode.KEY_H } + LetterKey{ charKeyId_: "key_j"; label: "j"; shiftedText: "J"; keycode: Keycode.KEY_J } + LetterKey{ charKeyId_: "key_k"; label: "k"; shiftedText: "K"; keycode: Keycode.KEY_K } + LetterKey{ charKeyId_: "key_l"; label: "l"; shiftedText: "L"; keycode: Keycode.KEY_L } + SymbolKey{ charKeyId_: "key_semicolon"; label: ";"; shiftedText: ":"; keycode: Keycode.KEY_SEMICOLON } + SymbolKey{ charKeyId_: "key_apostrophe"; label: "'"; shiftedText: "\""; keycode: Keycode.KEY_APOSTROPHE } + EnterKey{ charKeyId_: "key_enter"; keycode: Keycode.KEY_ENTER } } Row { anchors.horizontalCenter: parent.horizontalCenter spacing: virtualKeyboard.keySpacing ShiftKey{width: virtualKeyboard.keyWidth*2.5 + virtualKeyboard.keySpacing*2; alignment: Text.AlignLeft; keycode: Keycode.KEY_LEFTSHIFT } - LetterKey{ label: "z" ; shiftedText: "Z"; keycode: Keycode.KEY_Z } - LetterKey{ label: "x" ; shiftedText: "X"; keycode: Keycode.KEY_X } - LetterKey{ label: "c" ; shiftedText: "C"; keycode: Keycode.KEY_C } - LetterKey{ label: "v" ; shiftedText: "V"; keycode: Keycode.KEY_V } - LetterKey{ label: "b" ; shiftedText: "B"; keycode: Keycode.KEY_B } - LetterKey{ label: "n" ; shiftedText: "N"; keycode: Keycode.KEY_N } - LetterKey{ label: "m" ; shiftedText: "M"; keycode: Keycode.KEY_M } - SymbolKey{ label: ", "; shiftedText: "<"; keycode: Keycode.KEY_COMMA } - SymbolKey{ label: "."; shiftedText: ">"; keycode: Keycode.KEY_DOT } - SymbolKey{ label: "/"; shiftedText: "?"; keycode: Keycode.KEY_SLASH } - ActionKey{ label: "up"; actionKeyImgPath: "qrc:/img/up.svg"; keycode: Keycode.KEY_UP } + LetterKey{ charKeyId_: "key_z"; label: "z" ; shiftedText: "Z"; keycode: Keycode.KEY_Z } + LetterKey{ charKeyId_: "key_x"; label: "x" ; shiftedText: "X"; keycode: Keycode.KEY_X } + LetterKey{ charKeyId_: "key_c"; label: "c" ; shiftedText: "C"; keycode: Keycode.KEY_C } + LetterKey{ charKeyId_: "key_v"; label: "v" ; shiftedText: "V"; keycode: Keycode.KEY_V } + LetterKey{ charKeyId_: "key_b"; label: "b" ; shiftedText: "B"; keycode: Keycode.KEY_B } + LetterKey{ charKeyId_: "key_n"; label: "n" ; shiftedText: "N"; keycode: Keycode.KEY_N } + LetterKey{ charKeyId_: "key_m"; label: "m" ; shiftedText: "M"; keycode: Keycode.KEY_M } + SymbolKey{ charKeyId_: "key_comma"; label: ", "; shiftedText: "<"; keycode: Keycode.KEY_COMMA } + SymbolKey{ charKeyId_: "key_dot"; label: "."; shiftedText: ">"; keycode: Keycode.KEY_DOT } + SymbolKey{ charKeyId_: "key_slash"; label: "/"; shiftedText: "?"; keycode: Keycode.KEY_SLASH } + ActionKey{ charKeyId_: "key_up"; label: "up"; actionKeyImgPath: "qrc:/img/up.svg"; keycode: Keycode.KEY_UP } ShiftKey{ width: virtualKeyboard.keyWidth*2 + virtualKeyboard.keySpacing; alignment: Text.AlignRight; keycode: Keycode.KEY_RIGHTSHIFT } } Row { @@ -108,11 +108,11 @@ Column { // WinKey{} AltKey{ keycode: Keycode.KEY_LEFTALT } ChangeImKey{} - SpaceKey{ keycode: Keycode.KEY_SPACE } + SpaceKey{ charKeyId_: "key_space"; keycode: Keycode.KEY_SPACE } AltKey{ keycode: Keycode.KEY_RIGHTALT } - ActionKey{ label: "left"; actionKeyImgPath: "qrc:/img/left.svg"; keycode: Keycode.KEY_LEFT } - ActionKey{ label: "down"; actionKeyImgPath: "qrc:/img/down.svg"; keycode: Keycode.KEY_DOWN } - ActionKey{ label: "right"; actionKeyImgPath: "qrc:/img/right.svg"; keycode: Keycode.KEY_RIGHT } + ActionKey{ charKeyId_: "key_left"; label: "left"; actionKeyImgPath: "qrc:/img/left.svg"; keycode: Keycode.KEY_LEFT } + ActionKey{ charKeyId_: "key_down"; label: "down"; actionKeyImgPath: "qrc:/img/down.svg"; keycode: Keycode.KEY_DOWN } + ActionKey{ charKeyId_: "key_right"; label: "right"; actionKeyImgPath: "qrc:/img/right.svg"; keycode: Keycode.KEY_RIGHT } CtrlKey{ keycode: Keycode.KEY_RIGHTCTRL } } } diff --git a/qml/LongPressedKeyManager.qml b/qml/LongPressedKeyManager.qml index 0c4637f..c377316 100644 --- a/qml/LongPressedKeyManager.qml +++ b/qml/LongPressedKeyManager.qml @@ -20,4 +20,31 @@ import QtQuick 2.0 Item { property bool isShiftKeyLongPressed: shiftState === "LONG_PRESSED" || shiftState === "OPEN_LONG_PRESSED" + property var charKeyId + property alias charKeyLongPressedTimer: charKeyLongPressedTimer_ + property int keyEnterLongPressedStateInterval: 600 + + signal charKeyRelesed(var keyId) + + onCharKeyRelesed: { + if (keyId === charKeyId) { + charKeyLongPressedTimer_.stop() + sendKeyEventTimer.stop() + } + } + + Timer { + id: charKeyLongPressedTimer_ + interval: keyEnterLongPressedStateInterval + onTriggered: sendKeyEventTimer.start() + } + + Timer { + id: sendKeyEventTimer + interval: longPressInterval + repeat: true + onTriggered: { + charKeyId.sendKeyPressEvent() + } + } } diff --git a/qml/key/CharKey.qml b/qml/key/CharKey.qml index 711af14..8a9e551 100755 --- a/qml/key/CharKey.qml +++ b/qml/key/CharKey.qml @@ -20,11 +20,14 @@ import QtQuick.Controls 2.0 import "../js/utils.js" as Utils BaseKey { + id: charKeyId_ + property var charKeyId_ property string shiftedText property color normalColor: virtualKeyboard.charKeyNormalColor property color pressedColor: virtualKeyboard.charKeyPressedColor property color hoverColor: virtualKeyboard.charKeyHoverColor + function sendKeyEvent(isRelease) { var keysym = Utils.getKeysymByKeyLabel(keyLabel.text) var modifierKeyState = Utils.getModifierKeyStates() @@ -58,15 +61,18 @@ BaseKey { maximumTouchPoints: 1 onReleased: { keyBackground.state = "NORMAL" - timer.stop() sendKeyReleaseEvent() + + longPressedKeyManager.charKeyRelesed(charKeyId_) charKeyClicked() } onPressed: { keyBackground.state = "PRESSED" - timer.start() sendKeyPressEvent() + + longPressedKeyManager.charKeyId = charKeyId_ + longPressedKeyManager.charKeyLongPressedTimer.start() } } @@ -102,14 +108,4 @@ BaseKey { } } ] - - - Timer { - id:timer - interval: virtualKeyboard.longPressInterval - repeat: true - onTriggered: { - sendKeyPressEvent() - } - } } -- Gitee