Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-51538

Can't grab keyboard from QWindow created with QWindow::fromWinId from HWND pointer

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.6.0 RC
    • QPA: Windows
    • None
    • Qt 5.6.0 RC built from source

    Description

      I'm trying to grab the keyboard input on a QWindow created with QWindow::fromWinId from a HWND pointer, in Windows. I simply can't!

      The HWND pointer is provided by another application as this windows is supposed to appear as a Tool window of the application. This is what I am doing:

      _window = QWindow::fromWinId((WId)ptr);
      _window->requestActivate();
      _window->setKeyboardGrabEnabled(true);
      
      I have also tried the following without success:
      
      _widget = QWidget::createWindowContainer(_window);
      _widget->setFocus();
      _widget->grabKeyboard(); 
      

      No matter what I try, the keyboard events are always passed to the host app and I can't use them in text qml input boxes.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            sinosoidal Nuno Santos
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes