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

QGamepadManager fails to detect gamepads on Windows if no QWindow was shown yet

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • P3: Somewhat important
    • None
    • 5.9.0
    • GamePad
    • None
    • Qt 5.9.0 on Windows 7, tested both with Xbox 360 controller and an Xbox One controller.

    Description

      Detecting connected gamepads with QGamepadManager::instance()->connectedGamepads() fails on Windows 7 when no QWindow was shown on screen yet.

      This can be verified using the Qt example programs: Qt Gamepad Qt Quick Example works fine, but Qt Gamepad Simple Example does not detect the connected controller.

      A workaround is to create, show, and delete a dummy window before detecting gamepads:

      QWindow* window = new QWindow();
      window->show();
      delete window;
      QApplication::processEvents();
      QGamepadManager::instance()->connectedGamepads()

      Note that both show() and processEvents() are necessary. Presumably some initialization stuff happens on Windows platforms when the first window is shown on screen, and QGamepadManager relies on that.

      The problem does not exist on Linux. I did not test other systems.

      Attachments

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

        Activity

          People

            janichol Andy Nichols
            marlam Martin Lambers
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes