I’m using Qt 4.3.1 (I’m not able to uptade at the moment) for a program, anyway in Windows dead keys (^, ´, `, …) don’t arrive at the keyPressedEvent(), i always have to press them twice.
So why don’t those dead keys arrive? How can I fix it?
In MacOS everything works fine though.
Thx, eL.
After looking at the Qt documentation I’m not sure if keyPressEvent is supposed to deliver dead keys or not. I’m actually kind of surprised that you see them on a Mac.
I’m guessing that Qt is choosing to wait for WM_CHAR events, or something, before sending the keyPressEvent for your widget. As you can see from this page: http://msdn.microsoft.com/en-us/library/ms646267(VS.85).aspx#_win32_Dead_Character_Messages the order of key events when a user pressed a dead-key followed by a real-key is:
If you really want to capture the deadchar key-presses, look at subclassing QApplication and overriding the winEventFilter (http://doc.qt.io/qt-4.8/qcoreapplication.html#winEventFilter) method. This will let you capture the WM_DEADCHAR events as they come in. You can then create a KeyEvent and dispatch it to the widget that currently has focus.