Solved QGamepad and missing name.
-
Hi
I am using QGamepad 5.7 in Fedora 26.
And the name of the gamepad is always an empty string.I tried to read the code in https://github.com/qt/qtgamepad/blob/5.9/src/gamepad/qgamepad.cpp
and I do not see any possible way for the name to be set, other than myself assigning to it.
evdev provides libevdev_get_name().
This piece of code
const QList<int> gamepads = QGamepadManager::instance()->connectedGamepads();
for (int id : gamepads)
{
QGamepad * gp = new QGamepad(id, this);
QString name = gp->name(); // << ALWAYS empty
}Is there any chance for the name to be set?
-
@Audetto QGamepad only sets a name if one is available. It sounds like in linux evdev is not giving it a name. Or maybe there is a bug in Qt that isn't picking it up. Qt's hardware support is usually pretty bad in my experience. The rest of Qt is awesome but hardware is nasty.
What does
libevdev_get_name()
return for that device id? -
The problem is that there is no support whatsoever to extract and forecast the name from the backend to the qgamepad via the manager. (regardless of which backend is actually used)
I would like to propose a patch.
I wonder if this is the right place? -
-
Ok I will try there.
I have a patch for 5.7 which is used in Fedora 26, but I cant compile 5.10 without the full Qt 5.10 sources...Maybe I can wait for Fedora 27 and 5.9 which might make it easier...
-
@Audetto said in QGamepad and missing name.:
Ok I will try there.
I have a patch for 5.7 which is used in Fedora 26, but I cant compile 5.10 without the full Qt 5.10 sources...You will need to compile Qt from Git to send patches to Gerrit. Please see https://wiki.qt.io/Building_Qt_5_from_Git It looks scaring at the first time, but trust me, under Linux the process is straightforward (I have done it 100 times). Compiling Qt under Windows is an adventure ;)
-
To add to @aha_1980, you don't need to build the whole of Qt, qtbase + the module(s) you want to hack on is enough.
-
I managed to do it in the end.
I guess I will try to follow your advice and build the minimum.Here is the result
-
Congratulation and thank you !