How to understand connection is lost on qt gamepad?
Unsolved
General and Desktop
-
Hi everyone. I have a question about qt gamepad.
I have logitech F310 and im using qt gamepad examples.
When i cut the connection while application is running, there isnt any warning on the screenHow can i understand the connection lost?
Here is my code``` QLoggingCategory::setFilterRules(QStringLiteral("qt.gamepad.debug=true")); auto gamepads = QGamepadManager::instance()->connectedGamepads(); if (gamepads.isEmpty()) { qDebug() << "Gamepad bağlanamadı!"; QWidget::setWindowTitle("Gamepad baglanamadı!"); return; } m_gamepad = new QGamepad(*gamepads.begin(), this); // qDebug() << m_gamepad->name(); js_name = m_gamepad->name(); QWidget::setWindowTitle(js_name);
-
Looking at the documentation you will find a signal which is emitted when the connection changes.
-
connect(m_gamepad, &QGamepad::connectedChanged, [this](bool change) { qDebug() << "connection lost" << change; });
i wrote this but it doesnt work at all
-
If the signal is not emitted then it's maybe a bug - create a minimal, reproducible example and create a bug report if you're sure it's not a failure on your side.
But looks like https://bugreports.qt.io/browse/QTBUG-85830 so no need to create a new bug report then.