Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt creator and joystick. QtGamepad



  • I try use joystick Logitech Extreme 3D PRO model. In windows gaming devices window it work fine. In QTCreator it does not work. I use QtGamepad library and here

    QGamepadManager* lstDevices= QGamepadManager::instance();
       if (lstDevices.isEmpty()) {
           qDebug() << "Did not find any connected gamepads";
       }
    

    i receive "Did not find any connected gamepads" always.
    In .pro file "QT += gamepad" was added
    What can be wrong?


  • Lifetime Qt Champion

    @Sandres92 Is this really the code you have? I don't think it's going to compile.
    lstDevices is a QGamepadManager.
    And also lstDevices is a pointer.
    Shouldn't you have something like:

    QGamepadManager* manager = QGamepadManager::instance();
    auto lstDevices = manager->connectedGamepads();
    if (lstDevices.isEmpty()) {
        qDebug() << "Did not find any connected gamepads";
    }
    


  • Sorry, yes, i made mistake when write post. My real code

    QGamepadManager *ptrManager = QGamepadManager::instance();
       QList<int> lstDevices = ptrManager->connectedGamepads();
       if (lstDevices.isEmpty()) {
           qDebug() << "Did not find any connected gamepads";
       }
    

    i receive "Did not find any connected gamepads


Log in to reply