| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 1 | |
Hi all, I have some code that implements a key event handler directly (by subclassing a widget and implementing the protected methods). What I have been noticing is that the normal compose concept I used in other Qt widgets doesn't work. For example; I hit [compose] ["] [a] and I get ä in a lineEdit, but I get "a in my own widget. I see events come in, one for the compose (which I ignore), one for the shift (also ignored) and then one for the ", and last one for the a. Is there a trick to get one event with the composited character? And how would I have to handle other input methods? I tried on Qt43-beta and 4.2.2 Any help would be appreciated, thanks! -- [ signature omitted ]
Attachment:
pgpJDlZvtuf8h.pgp
Description: PGP signature
On Sunday 01 April 2007 11:30:12 Thomas Zander wrote: > Hi all, > > I have some code that implements a key event handler directly (by > subclassing a widget and implementing the protected methods). > What I have been noticing is that the normal compose concept I used in > other Qt widgets doesn't work. > For example; I hit [compose] ["] [a] and I get ä in a lineEdit, but I get > "a in my own widget. > I see events come in, one for the compose (which I ignore), one for the > shift (also ignored) and then one for the ", and last one for the a. > > Is there a trick to get one event with the composited character? And how > would I have to handle other input methods? On X11 we receive those composited characters on the input method level from the X server. We could try to detect this special case and send a QKeyEvent instead, but we currently just send the resulting string to the widget with a QInputMethodEvent. So in order to receive these characters and input method data in general (on all platforms) you have to implement input method support in your widget, which includes setting the Qt::WA_InputMethodEnabled window attribute on your widget, handling QWidget::inputMethodQuery and QWidget::inputMethodEvent as well as calling QWidget::updateMicroFocus. Simon
Attachment:
Attachment:
pgpH7nLR8XLHi.pgp
Description: PGP signature