Unsolved Why nativeEvent can not receive WM_CHAR message?
-
Qt version : 5.5.1; Os: window 7
when i press a key, the focus widget only can receive WM_KEYDOWN and WM_KEYUP message in nativeEvent(),
but in mfc app, it will WM_CHAR message also. What can i do if i want to receive WM_CHAR message in qt app? -
Hi,
Why do you need that ? Does Qt's QKeyEvent provide the information you need ?
-
This post is deleted! -
@SGaist Hi,
Because I want to combine qt widget with cef under cef off-screen mode. My project must be compatible with windows xp, so I can not use QWebEngineView. Cef needs MSG struct, but I don't know how to transfer QKeyEvent* to MSG*, so QKeyEvent seems to be useless. -
but I don't know how to transfer QKeyEvent* to MSG*, so QKeyEvent seems to be useless.
If you're saying that would solve your need, why can you not do that? IIRC a
MSG
struct
has only about 4 fields, are they not equatable to what you can have in aQKeyEvent
? -
You'll need a native event filter. But first take a look at this Qt bug report.
-
@JonB
I find the fields in a MSG struct are not equatable to what I can have in a QKeyEvent. -
@vilas
Oh! Why not? If you are saying it would solve your issue if you could populate aMSG
from aQKeyEvent
, what is it that you cannot successfully copy across? -
@SGaist I have install the native event filter, but it also only receive WM_KEYDOWN and WM_KEYUP message in nativeEventFilter(), without WM_CHAR message.
-
-
@vilas
Seems it was fixed in
Qt 5.11.1 -
After trying, I find that Qt5.11.1 can receive WM_CHAR message in nativeEventFilter() , but can't receive WM_IME_CHAR message.
-
@JonB said in Why nativeEvent can not receive WM_CHAR message?:
your situation compare to the Qt bug report @SGaist gave you
Yes, my situation is similar to the Qt bug report @SGaist gave.But I also want to support the input method in my project.