Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to make Qquickview doesn't obtain focus ?

How to make Qquickview doesn't obtain focus ?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 352 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Soul
    wrote on last edited by
    #1

    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[2];
        memset(input, 0, 2 * sizeof(INPUT));
    
        input[0].type = INPUT_KEYBOARD;
        input[0].ki.wVk = 'K';
        SendInput(1, input, sizeof(INPUT));
    
        input[1].type = INPUT_KEYBOARD;
        input[1].ki.wVk = 'K';
        input[1].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……

    A champion is someone who gets up even when he can´t.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Soul
      wrote on last edited by Soul
      #2

      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.

      A champion is someone who gets up even when he can´t.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved