Qt Gamepad documentation
-
@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!