Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved How to understand connection is lost on qt gamepad?

    General and Desktop
    2
    4
    64
    Loading More Posts
    • 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
      firsnur96 last edited by

      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 Reply Quote 0
      • Christian Ehrlicher
        Christian Ehrlicher Lifetime Qt Champion last edited by

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

        Qt has to stay free or it will die.

        F 1 Reply Last reply Reply Quote 0
        • F
          firsnur96 @Christian Ehrlicher last edited by

          @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 Reply Quote 0
          • Christian Ehrlicher
            Christian Ehrlicher Lifetime Qt Champion last edited by

            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 has to stay free or it will die.

            1 Reply Last reply Reply Quote 1
            • First post
              Last post