From 2d7f07024533c879261343b74b974f1d3bf782a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDeljan=20Rikalo?= Date: Mon, 11 Apr 2022 17:51:46 +0200 Subject: [PATCH] Qt5: fixed Ctrl+Shift+Alt with keys. issue #39704 --- lcl/interfaces/qt5/qtwidgets.pas | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lcl/interfaces/qt5/qtwidgets.pas b/lcl/interfaces/qt5/qtwidgets.pas index 019958fec8..45ff41b212 100644 --- a/lcl/interfaces/qt5/qtwidgets.pas +++ b/lcl/interfaces/qt5/qtwidgets.pas @@ -3229,6 +3229,9 @@ begin if QEvent_type(Event) = QEventKeyRelease then LCLModifiers := LCLModifiers or KF_UP; + // Loads the UTF-8 character associated with the keypress, if any + QKeyEvent_text(QKeyEventH(Event), @Text); + {$ifdef windows} ACharCode := QKeyEvent_nativeVirtualKey(QKeyEventH(Event)); KeyMsg.CharCode := ACharCode; @@ -3247,12 +3250,17 @@ begin if QEvent_type(Event) = QEventKeyRelease then LCLModifiers := LCLModifiers or KF_UP; end; + end else + if (Modifiers = QtAltModifier or QtControlModifier or QtShiftModifier) and + (ACharCode > 0) and (length(Text) > 0) then + begin + IsSysKey := False; + if QKeyEvent_isAutoRepeat(QKeyEventH(Event)) then + LCLModifiers := LCLModifiers or KF_REPEAT; end; {$endif} - KeyMsg.KeyData := PtrInt((AKeyCode shl 16) or (LCLModifiers shl 16) or $0001); - // Loads the UTF-8 character associated with the keypress, if any - QKeyEvent_text(QKeyEventH(Event), @Text); + KeyMsg.KeyData := PtrInt((AKeyCode shl 16) or (LCLModifiers shl 16) or $0001); {$IFDEF DARWIN} // qt on mac passes #3 instead of #13 when QtKey_Enter (numpad) is pressed