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

Unexpected behaviour of QGamepadManager on Windows 10

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • P2: Important
    • None
    • 5.10.0
    • GamePad
    • None
    • OS: Windows 10 (64-bit)

      Qt version 5.10 (64-bit)

      Compiler: Visual Studio 2017 (Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25831)

      Gamepad: Logitech Wireless Gamepad F710

       

    Description

      QGamepadManager doesn't find connected gamepads on Windows 10, QList of zero length is returned by connectedGamepads(). However connectedGamepadsChanged signal is emitted when gamepad is connected/disconnected. Workaround is to connect to this signal, and then connectedGamepads() works as it should.

      QML example configureButtons doesn't show not anything in the field "Connected gamepads", but reacts to all buttons.

      QList<int> gamepads = QGamepadManager::instance()->connectedGamepads();
      qDebug() << "Found" << gamepads.size();
      
      // With one connected gamepad on Ubuntu 16.04 this yields
      // > Found 1
      // On Windows 10 (Visual C++ 2017) the output is:
      // > Found 0
      
      // Workaround on Win10, is to use signal connectedGamepadsChanged() to monitor connected gamepads
      connect(QGamepadManager::instance(), &QGamepadManager::connectedGamepadsChanged, this, [=]()
        {
            qDebug() << "Connected";
            qDebug() << "Found " << QGamepadManager::instance()->connectedGamepads().size();
      
      }
      

       

      outputs

      Attachments

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

        Activity

          People

            janichol Andy Nichols
            mathias.vonessen Mathias von Essen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes