Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Qt Gamepad documentation
Forum Updated to NodeBB v4.3 + New Features

Qt Gamepad documentation

Scheduled Pinned Locked Moved Unsolved Game Development
22 Posts 4 Posters 12.2k Views 1 Watching
  • 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.
  • T Offline
    T Offline
    TimurE
    wrote on last edited by
    #8

    Linux. I tried on Windows (minGW) too, but it doesnt't work at all. Examples don't see any gamepads.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #9

      Did you check that the plugin get correctly loaded ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • T Offline
        T Offline
        TimurE
        wrote on last edited by
        #10

        How cat I check it?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #11

          Add QT_DEBUG_PLUGINS to the environment variables in the Run part of the Project panel and set it to 1.

          You'll have more information on the debug output.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • T Offline
            T Offline
            TimurE
            wrote on last edited by TimurE
            #12
            QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.7.0/5.7/mingw53_32/plugins/gamepads" ...
            QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.7.0/5.7/mingw53_32/plugins/gamepads/xinputgamepad.dll"
            Found metadata in lib C:/Qt/Qt5.7.0/5.7/mingw53_32/plugins/gamepads/xinputgamepad.dll, metadata=
            {
                "IID": "com.bsquask.Qt.Gamepad.QtGamepadBackendFactoryInterface.5.5",
                "MetaData": {
                    "Keys": [
                        "xinput"
                    ]
                },
                "className": "QXInputGamepadBackendPlugin",
                "debug": false,
                "version": 329472
            }
            
            
            Got keys from plugin meta data ("xinput")
            QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.7.0/5.7/mingw53_32/plugins/gamepads/xinputgamepadd.dll"
            Found metadata in lib C:/Qt/Qt5.7.0/5.7/mingw53_32/plugins/gamepads/xinputgamepadd.dll, metadata=
            {
                "IID": "com.bsquask.Qt.Gamepad.QtGamepadBackendFactoryInterface.5.5",
                "MetaData": {
                    "Keys": [
                        "xinput"
                    ]
                },
                "className": "QXInputGamepadBackendPlugin",
                "debug": true,
                "version": 329472
            }
            
            
            "The plugin 'C:/Qt/Qt5.7.0/5.7/mingw53_32/plugins/gamepads/xinputgamepadd.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
                     not a plugin
            QFactoryLoader::QFactoryLoader() checking directory path "C:/build-gamepadexample-Desktop_Qt_5_7_0_MinGW_32bit-Release/release/gamepads" ...
            loaded library "C:/Qt/Qt5.7.0/5.7/mingw53_32/plugins/gamepads/xinputgamepad.dll"
            loaded library "xinput1_4.dll"
            loaded library "xinput1_3.dll"
            

            Windows 7 x86 (32 bit)

            1 Reply Last reply
            0
            • T Offline
              T Offline
              TimurE
              wrote on last edited by
              #13

              I tried to use msvc 2015 instead of MinGW, but I got the same problem.

              X 1 Reply Last reply
              0
              • hskoglundH Online
                hskoglundH Online
                hskoglund
                wrote on last edited by
                #14

                Hi, if you're compiling in Debug mode, try instead to compile in Release mode.

                1 Reply Last reply
                1
                • T Offline
                  T Offline
                  TimurE
                  wrote on last edited by
                  #15

                  Same problem:

                  Starting C:\build-gamepadexample-Desktop_Qt_5_7_0_MinGW_32bit-Release\release\gamepadexample.exe...
                  QGamePadManager Demo
                  
                  QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.7.0/5.7/mingw53_32/plugins/gamepads" ...
                  QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.7.0/5.7/mingw53_32/plugins/gamepads/xinputgamepad.dll"
                  Found metadata in lib C:/Qt/Qt5.7.0/5.7/mingw53_32/plugins/gamepads/xinputgamepad.dll, metadata=
                  {
                      "IID": "com.bsquask.Qt.Gamepad.QtGamepadBackendFactoryInterface.5.5",
                      "MetaData": {
                          "Keys": [
                              "xinput"
                          ]
                      },
                      "className": "QXInputGamepadBackendPlugin",
                      "debug": false,
                      "version": 329472
                  }
                  
                  
                  Got keys from plugin meta data ("xinput")
                  QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.7.0/5.7/mingw53_32/plugins/gamepads/xinputgamepadd.dll"
                  Found metadata in lib C:/Qt/Qt5.7.0/5.7/mingw53_32/plugins/gamepads/xinputgamepadd.dll, metadata=
                  {
                      "IID": "com.bsquask.Qt.Gamepad.QtGamepadBackendFactoryInterface.5.5",
                      "MetaData": {
                          "Keys": [
                              "xinput"
                          ]
                      },
                      "className": "QXInputGamepadBackendPlugin",
                      "debug": true,
                      "version": 329472
                  }
                  
                  
                  "The plugin 'C:/Qt/Qt5.7.0/5.7/mingw53_32/plugins/gamepads/xinputgamepadd.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
                           not a plugin
                  QFactoryLoader::QFactoryLoader() checking directory path "C:/build-gamepadexample-Desktop_Qt_5_7_0_MinGW_32bit-Release/release/gamepads" ...
                  loaded library "C:/Qt/Qt5.7.0/5.7/mingw53_32/plugins/gamepads/xinputgamepad.dll"
                  loaded library "xinput1_4.dll"
                  loaded library "xinput1_3.dll"
                  Number of gamepads: 0
                  
                  
                  
                  1 Reply Last reply
                  0
                  • hskoglundH Online
                    hskoglundH Online
                    hskoglund
                    wrote on last edited by
                    #16

                    Hmm, I checked and it seems Qt Gamepad does not support all the different gamepads available on WIndows :-( I.e. the plugin loads fine but no gamepads are detected, more discussion here

                    Also you can try emulating a Microsoft device like an Xbox360-controller, for example I can use my Playstation4 controller by installing DS4Windows

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      TimurE
                      wrote on last edited by
                      #17

                      I'll try it later.

                      But why Qt can support only part of gamepads? My gamepads are very old and work both in Windows and Linux without additional drivers.

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        TimurE
                        wrote on last edited by
                        #18

                        DS4Windows doesn't see my gamepads. But Windows Control panel sees and shows pressed buttons.

                        1 Reply Last reply
                        0
                        • hskoglundH Online
                          hskoglundH Online
                          hskoglund
                          wrote on last edited by
                          #19

                          Because your gamepad is 12 years old (or more) I think it doesn't support the standard DirectX interface, only Windows control panel, that's why Qt is blind to it.
                          Also, when playing a 64-bit (only) game like BattleField1, I think such game will exhibit the same problem as Qt, i.e. not see your gamepad :-(

                          1 Reply Last reply
                          1
                          • T TimurE

                            I tried to use msvc 2015 instead of MinGW, but I got the same problem.

                            X Offline
                            X Offline
                            xiuscut
                            wrote on last edited by
                            #20

                            @TimurE
                            I work at Win10 64 bits and QT5.7.0 ,msvc14。It canwork at this code.
                            Gamepad::Gamepad(QObject *parent) : QObject(parent)
                            , m_gamepad(0)
                            {
                            m_gamepad = new QGamepad(0,this);//or just m_gamepad = new QGamepad; is ok//
                            connect(m_gamepad,&QGamepad::connectedChanged,this,&MMGamepad::connectedChangedEvent);
                            qDebug() << "A new gamepad:"<<m_gamepad->isConnected();// when start is false
                            }
                            void Gamepad::connectedChangedEvent(bool value)
                            {
                            if(value)
                            {
                            qDebug() << "Gamepad:: decive is connect!" ;
                            }
                            else
                            {
                            qDebug() << "Gamepad:: decive is disconnect!" ;
                            }
                            }
                            and you can get any signal after"Gamepad:: decive is connect".

                            X 1 Reply Last reply
                            1
                            • X xiuscut

                              @TimurE
                              I work at Win10 64 bits and QT5.7.0 ,msvc14。It canwork at this code.
                              Gamepad::Gamepad(QObject *parent) : QObject(parent)
                              , m_gamepad(0)
                              {
                              m_gamepad = new QGamepad(0,this);//or just m_gamepad = new QGamepad; is ok//
                              connect(m_gamepad,&QGamepad::connectedChanged,this,&MMGamepad::connectedChangedEvent);
                              qDebug() << "A new gamepad:"<<m_gamepad->isConnected();// when start is false
                              }
                              void Gamepad::connectedChangedEvent(bool value)
                              {
                              if(value)
                              {
                              qDebug() << "Gamepad:: decive is connect!" ;
                              }
                              else
                              {
                              qDebug() << "Gamepad:: decive is disconnect!" ;
                              }
                              }
                              and you can get any signal after"Gamepad:: decive is connect".

                              X Offline
                              X Offline
                              xiuscut
                              wrote on last edited by
                              #21

                              @xiuscut said in Qt Gamepad documentation:

                              connectedChangedEvent

                              also remenber "QT += gamepad" in .pro and #include <QtGamepad/QGamepad>

                              X 1 Reply Last reply
                              0
                              • X xiuscut

                                @xiuscut said in Qt Gamepad documentation:

                                connectedChangedEvent

                                also remenber "QT += gamepad" in .pro and #include <QtGamepad/QGamepad>

                                X Offline
                                X Offline
                                xiuscut
                                wrote on last edited by
                                #22
                                This post is deleted!
                                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