From d6742eff24c0a096279fdf7e646d65a1d4eb0274 Mon Sep 17 00:00:00 2001 From: zhaokexin Date: Thu, 1 Feb 2024 11:00:59 +0800 Subject: [PATCH] =?UTF-8?q?=E9=95=BF=E6=8C=89=E4=B8=80=E4=B8=AAshift,?= =?UTF-8?q?=E5=AD=97=E6=AF=8D=E9=94=AE=E5=8F=98=E5=A4=A7=E5=86=99=EF=BC=8C?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E5=8F=A6=E4=B8=80=E4=B8=AAshift=EF=BC=8C?= =?UTF-8?q?=E5=AD=97=E6=AF=8D=E9=94=AE=E5=8F=98=E5=B0=8F=E5=86=99=EF=BC=8C?= =?UTF-8?q?=E9=95=BF=E6=8C=89shift=E6=9D=BE=E6=89=8B=EF=BC=8C=E5=AD=97?= =?UTF-8?q?=E6=AF=8D=E9=94=AE=E4=BB=8D=E7=84=B6=E6=98=AF=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qml/VirtualKeyboard.qml | 2 ++ qml/key/ShiftKey.qml | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/qml/VirtualKeyboard.qml b/qml/VirtualKeyboard.qml index 92665fa..f3369a1 100644 --- a/qml/VirtualKeyboard.qml +++ b/qml/VirtualKeyboard.qml @@ -135,6 +135,8 @@ Rectangle { property bool isCurrentIMListVisible: false property bool isShiftKeyLongPressed: shiftState === "LONG_PRESSED" || shiftState === "OPEN_LONG_PRESSED" + property int shiftPressedCount: 0 + property int shiftReleaseCount: 0 //内部使用 signal showToolbar() diff --git a/qml/key/ShiftKey.qml b/qml/key/ShiftKey.qml index 3110483..f0e6b79 100755 --- a/qml/key/ShiftKey.qml +++ b/qml/key/ShiftKey.qml @@ -38,6 +38,26 @@ TemporarySwitchKey { virtualKeyboard.shiftState = shiftState } + multiPointTouchArea.onPressed: { + virtualKeyboard.shiftPressedCount += 1 + } + + multiPointTouchArea.onReleased: { + //每个按键只能点击一次 + //如果shiftPressedCount总数大于1,说明是长按一个shift的同时又点击的另一个shift按键 + //这个情况下,shift按键都设置为normal状态 + virtualKeyboard.shiftReleaseCount += 1 + + if (virtualKeyboard.shiftPressedCount >= 2) { + virtualKeyboard.shiftState = "NORMAL" + switchKeyState = "NORMAL" + } + if (virtualKeyboard.shiftPressedCount === virtualKeyboard.shiftReleaseCount) { + virtualKeyboard.shiftPressedCount = 0 + virtualKeyboard.shiftReleaseCount = 0 + } + } + state: virtualKeyboard.shiftState states: [ State { -- Gitee