Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to understand connection is lost on qt gamepad?
QtWS25 Last Chance

How to understand connection is lost on qt gamepad?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 209 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    firsnur96
    wrote on last edited by
    #1

    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 screen

    How 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);
    
    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Looking at the documentation you will find a signal which is emitted when the connection changes.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      F 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        Looking at the documentation you will find a signal which is emitted when the connection changes.

        F Offline
        F Offline
        firsnur96
        wrote on last edited by
        #3

        @Christian-Ehrlicher

        connect(m_gamepad, &QGamepad::connectedChanged, [this](bool change) {
        
            qDebug() << "connection lost" << change;
        
        });
        

        i wrote this but it doesnt work at all

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved