Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to make Qquickview doesn't obtain focus ?
Soul last edited by
I want to make a Input Method Editor(IME) .
The IME send text to another application which has the input coursor .
I called the Win-API as below:
INPUT input; memset(input, 0, 2 * sizeof(INPUT)); input.type = INPUT_KEYBOARD; input.ki.wVk = 'K'; SendInput(1, input, sizeof(INPUT)); input.type = INPUT_KEYBOARD; input.ki.wVk = 'K'; input.ki.dwFlags = KEYEVENTF_KEYUP; SendInput(1, input + 1, sizeof(INPUT));
It can work when I call those code every seconds with timer(The ‘k’ can be sent to the editor which coursor is flashing).
But when I show my Quickview window with hotkey, it can't work.
I know may be my quickview window obtained focus at that moment, but at that time the input coursor
is flashing at other window. So it confused me, I have no idea about this……
Soul last edited by Soul
I found a way like this, and it works:
InputWindow *inputWind = new InputWindow(); HWND wid = (HWND)(inputWind->winId()); SetWindowLong(wid, GWL_EXSTYLE, GetWindowLong(wid, GWL_EXSTYLE) | WS_EX_NOACTIVATE | WS_EX_COMPOSITED);
Through this way, make the window can't obtain focus, and the sendinput works.
But I don't know if this is good enough.