vedderb / vesc_tool

The source code for VESC Tool. See vesc-project.com
GNU General Public License v3.0
722 stars 531 forks source link

QGamepadManager hai #120

Open BlackZcc opened 3 years ago

BlackZcc commented 3 years ago

QGamepadManager::instance()->gamepadName(g)

BlackZcc commented 3 years ago

Hello I can't build the new version 0.95,as it debug "QGamepadManager has no method as gamepadName()" for this line---QGamepadManager::instance()->gamepadName(g) in pages/PageSettings.cpp in line 111 for return the device name on order to delete the error device;

As I check the official QT class QGamepadManager do not contain such method,the you old version 0.91 dose use this class. Is that QGamepadManager class your own class or I make some cofigurion error.

ravens2 commented 2 years ago

I'm having issues with the gamepad as well.

I'm running the project in QtCreator with qmake reduced version 6.22.2 (community/open-source). I get an error when I try to compile the code that says: Project ERROR: Unknown module(s) in QT: gamepad

Having a look at the files I can see that for android applications the gamepad is called. Doing a search for Qt's forums for a similar error/fix I came across this post where the suggested code/solution is:

QGamepadManager* gamepad_manager = QGamepadManager::instance();
QList<int> gamepads;
int i = 0;
while (i < 10)
{
    a.processEvents();
    qInfo() << "get connected gamepads iteration : " << i;
    gamepads = gamepad_manager->connectedGamepads();
    if(!gamepads.isEmpty())
    {
        i = 10;
    }
    i++;
}
qInfo() << "connected gamepads : " << gamepads.size();

Where when the code initializes does a run through to count the number of gamepad devices.

I think that might be the solution however I think my problem now is I'm not sure how/where to inject that snippet of code.