From ed0983b26a5fee09ee96c95f7da47eaf79d3acc2 Mon Sep 17 00:00:00 2001 From: zeljko Date: Sun, 7 Jun 2009 09:44:37 +0000 Subject: [PATCH] Qt: fix for #13470. Note that this bug is Qt bug not LCL or qtlcl one, so this commit is an workaround for qt bug. git-svn-id: trunk@20494 - --- lcl/interfaces/qt/qtwidgets.pas | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index 5689763d86..7cd37e3e38 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -2087,6 +2087,7 @@ var UTF8Text: String; // use to prevent 3 time convertion from WideString to utf8 string UTF8Char: TUTF8Char; ACharCode: Word; + TheKey: Integer; AChar: Char; AKeyEvent: QKeyEventH; begin @@ -2117,6 +2118,22 @@ begin // Loads the UTF-8 character associated with the keypress, if any QKeyEvent_text(QKeyEventH(Event), @Text); + {$note this is workaround for Qt bug which reports + wrong keys with Shift+Ctrl pressed. Fixes #13450. + LAST REVISION: Qt-4.5.2 git snapshot 20090607. zeljko} + if (Modifiers = QtShiftModifier or QtControlModifier) then + begin + TheKey := QKeyEvent_key(QKeyEventH(Event)); + if (length(Text) = 1) and (TheKey in [33..41,61]) then + begin + if TheKey = 61 then + TheKey := 32; + ACharCode := QtKeyToLCLKey( TheKey + 16, Text); + KeyMsg.CharCode := ACharCode; + Text := ''; + end; + end; + // Translates a Qt4 Key to a LCL VK_* key if KeyMsg.CharCode = 0 then begin