Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. A problem with my xbox gamepad when I use QGamepad
Forum Updated to NodeBB v4.3 + New Features

A problem with my xbox gamepad when I use QGamepad

Scheduled Pinned Locked Moved Solved Game Development
ubuntu 20.04qgamepadxbox
5 Posts 2 Posters 815 Views 1 Watching
  • 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.
  • J Offline
    J Offline
    JackczyAf
    wrote on last edited by JackczyAf
    #1

    I'm making a project under Ubuntu20.04 with Qt, I need to get the data of my XBox gamepad, but when I use the function "isConnected()", it returns is always false:
    2023-11-15 20-13-25 的屏幕截图.png
    2023-11-15 20-24-12 的屏幕截图.png
    I checked the connection, it is correct, like this:
    2023-11-15 20-20-09 的屏幕截图.png
    And the joy_node package is all so can be used:
    2023-11-15 20-21-43 的屏幕截图.png
    When I'm running my project, I disconnect my gamepad and it returns the following message:
    2023-11-15 20-29-51 的屏幕截图.png
    What should I do, who can help me!
    Thanks!!
    QAQ

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      From a quick look at the module, I would first use the QGamepadManager class to check what is available.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi and welcome to devnet,

        From a quick look at the module, I would first use the QGamepadManager class to check what is available.

        J Offline
        J Offline
        JackczyAf
        wrote on last edited by
        #3

        @SGaist Thank you bro, I sovled it.

        1 Reply Last reply
        0
        • J JackczyAf has marked this topic as solved on
        • J Offline
          J Offline
          JackczyAf
          wrote on last edited by
          #4

          I checked the connection with QGamepadManager, its output:
          2023-11-16 08-49-57 的屏幕截图.png
          it shows that No.(2848) gamepad has been connected,
          so I changed the port when I create the QGamepad like this:
          2023-11-16 08-50-25 的屏幕截图.png
          It works!
          2023-11-16 08-50-15 的屏幕截图.png

          1 Reply Last reply
          1
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            If you only have one controller, a more flexible approach would be to take the first value returned by the QGamepadManager rather than hard coding it like that. It's not guaranteed that you will have the same value each time.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            • Login

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