[Qt-interest] keyPressEvent with german keyboard

Martin Grossberger mgrossberger at andtek.com
Thu Mar 17 14:02:52 CET 2011


Hi,

You are right, if I use Qt::Key_Adiaeresis for the QShortcut, it works.
Also, if I just use the key Ä, I get the correct key code (0xC4).
However, if I press Control+Ä I get the Key code 0xE4 (with modifier 
Qt::ControlModifier).

It seems the key code gets altered whenever the Control modifier is 
used. I realized this is also the case for other keys, e.g. Ctrl++ 
signals an event with key code 0x5D (Qt::Key_BracketRight).

I'll check if the native scancode and virtual key values are more sensible.

This is basically what I did:
> class HotkeyEdit : public QLineEdit {
>     public:
>         HotkeyEdit(QWidget *parent=NULL) : QLineEdit(parent) {}
>     protected:
>         void keyPressEvent(QKeyEvent *ev) {
>             setText(ev->text());
>         }
> }; 

Kind Regards,
Martin

Am 17.03.2011 12:41, schrieb freekee1:
> hi.
>
> i think "Ö" would be Qt::Key_Odiaeresis (0x0d6)actually, i just tried 
> it with Qt 4.7 and it works, and i think it also used to work in 4.6 
> for me, i used it some time ago ...
> Qt::Key_Adiaeresis and Qt::Key_Udiaeresis are there for "Ä" and "Ü" 
> accordingly.
> maybe you can try those.
>
> julian
>
>
> Am 17.03.2011 11:08, schrieb Martin Grossberger:
>> Hello all,
>>
>> I've implemented a simple hotkey edit, subclassing QLineEdit to 
>> record a hotkey in keyPressEvent, then displaying it. For most keys 
>> this works just fine, however I have trouble with german umlaut keys.
>> For Ö I get the (undocumented) Key 0xF6 with the correct text "ö", 
>> for Ä the (also undocumented) Key 0xE4 with the correct text "ä".
>> For Ü however, I get the Key 0x5B, which is Qt::Key_BracketLeft, with 
>> the according text "]".
>> When I register any of these Keys (with any modifier) as QShortcut, 
>> *none* of them work (i.e. they register fine, but pressing the 
>> specified Hotkey does not trigger them).
>>
>> Can anybody reproduce this issue? Is this a known bug, or did I do 
>> something wrong?
>>
>> I'm currently using Qt 4.6.2 on Windows 7. I didn't get to testing it 
>> on another configuration.
>>
>> Many Thanks,
>> Martin
>>
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at qt.nokia.com
>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>


-- 
Martin Grossberger

Phone : +49 811 95949612
E-Mail : mgrossberger at andtek.com

ANDTEK GmbH
Am Söldnermoos 17
85399 Hallbergmoos
Deutschland/Germany

Phone: +49 811 9594960
FAX: +49 811 95949676
E-Mail: info at andtek.com

ANDTEK GmbH, Am Söldnermoos 17, 85399 Hallbergmoos, Deutschland, 
Geschäftsführer:Stefan Grossberger, Roland Russwurm, Telefon +49 (0) 811 
9594960, Fax +49(0) 811 95949676, Internet: http://www.andtek.com; 
Handelsregister: Gericht München, HRB 133279, USt-ID: DE813064648
The information transmitted is intended only for the person or entity to 
which it is addressed and may contain confidential and/or privileged 
material. Any review, retransmission, dissemination or other use of, or 
taking of any action in reliance upon, this information by persons or 
entities other than the intended recipient is prohibited. Any opinions 
expressed in this email are those of the individual and not necessarily 
the Company.
If you receive this transmission in error, please email to 
info at andtek.com, including a copy of this message. Please then delete 
this email and destroy any copies of it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110317/201da4dd/attachment.html 


More information about the Qt-interest-old mailing list