Qt Gamepad documentation
-
wrote on 27 Nov 2016, 17:29 last edited by TimurE
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)
-
wrote on 27 Nov 2016, 22:06 last edited by
I tried to use msvc 2015 instead of MinGW, but I got the same problem.
-
wrote on 27 Nov 2016, 22:40 last edited by
Hi, if you're compiling in Debug mode, try instead to compile in Release mode.
-
wrote on 28 Nov 2016, 03:05 last edited by
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
-
wrote on 28 Nov 2016, 03:25 last edited by
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
-
wrote on 28 Nov 2016, 05:09 last edited by
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.
-
wrote on 29 Nov 2016, 23:48 last edited by
DS4Windows doesn't see my gamepads. But Windows Control panel sees and shows pressed buttons.
-
wrote on 30 Nov 2016, 17:09 last edited by
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 :-( -
wrote on 6 Mar 2017, 04:50 last edited by
@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". -
@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".wrote on 6 Mar 2017, 05:07 last edited by@xiuscut said in Qt Gamepad documentation:
connectedChangedEvent
also remenber "QT += gamepad" in .pro and #include <QtGamepad/QGamepad>
-
@xiuscut said in Qt Gamepad documentation:
connectedChangedEvent
also remenber "QT += gamepad" in .pro and #include <QtGamepad/QGamepad>
wrote on 27 Apr 2021, 07:37 last edited byThis post is deleted!