summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorSebastien Braun2010-10-12 06:12:20 +0200
committerSebastien Braun2010-10-12 06:12:20 +0200
commitd81fa20f32d6285731248405d47fc34b8e612073 (patch)
tree53caed66f704b6c1e0eb54a0244d6cfcc36545b3 /src/gui
parentFix build error. (diff)
downloadpvs-d81fa20f32d6285731248405d47fc34b8e612073.tar.gz
pvs-d81fa20f32d6285731248405d47fc34b8e612073.tar.xz
pvs-d81fa20f32d6285731248405d47fc34b8e612073.zip
Fix control character handling bug.
The code to deal with lowercase and uppercase versions of Latin1 characters was overly broad and sent ASCII Control Characters if Ctrl was pressed.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/frame.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/frame.cpp b/src/gui/frame.cpp
index b9899d8..12d49bc 100644
--- a/src/gui/frame.cpp
+++ b/src/gui/frame.cpp
@@ -538,8 +538,18 @@ void Frame::keyPressEvent(QKeyEvent* event)
QString text = event->text();
if(text.length() == 1 && text.at(0).row() == 0)
{
- // We found a Latin1 char and pray it is the correct case.
- key = text.at(0).cell();
+ QChar c = text.at(0);
+
+ // The next problem is that it may be a control character.
+ // This happens when Ctrl is pressed, so we only
+ // modify keys if they are lowercase or uppercase
+ // versions of the keycode.
+
+ if(c.toLower().toLatin1() == key || c.toUpper().toLatin1() == key)
+ {
+ // We found a Latin1 char and pray it is the correct case.
+ key = c.cell();
+ }
}
}
sendInputEvent(InputEvent::keyboardPress(key, event->modifiers()));