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. Help with Gamepad connection
Forum Updated to NodeBB v4.3 + New Features

Help with Gamepad connection

Scheduled Pinned Locked Moved Unsolved Game Development
9 Posts 2 Posters 4.2k 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.
  • B Offline
    B Offline
    BadHombre
    wrote on last edited by
    #1

    Hi guys,

    i need some Help for implementing my xbox controller in QT.
    i started the QT Example simple for Gamepad ... i run it but my gamepad doesn't get recognized by the code.

    auto gamepads = QGamepadManager::instance()->connectedGamepads();
        qDebug() << "Number of gamepads:" << gamepads.size();
    

    i tried the gamepad with the QML examples and here the gamepad get recognized... so it should has sth to do with the qgamepadmanager and not my gamepad...

    has anybody an idea ?
    Thanks in advance

    greetz

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

      Hi
      What Qt version?
      Maybe its related to
      https://bugreports.qt.io/browse/QTBUG-61553
      you could try the hax.

      1 Reply Last reply
      1
      • B Offline
        B Offline
        BadHombre
        wrote on last edited by BadHombre
        #3

        Yes i tried them, but IT doesnt worked :/ i am Using qt 5.9.2

        1 Reply Last reply
        0
        • B Offline
          B Offline
          BadHombre
          wrote on last edited by
          #4

          Or is it maybe possible to get the gamepad via qml ... because this iss working in the example and then use it in the c++ code ?

          mrjjM 1 Reply Last reply
          0
          • B BadHombre

            Or is it maybe possible to get the gamepad via qml ... because this iss working in the example and then use it in the c++ code ?

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @BadHombre

            Hmm. Sad. IT really sounds like that.
            Hi yes in theory you can forward most from QML to c++ via the normal integration methods.
            More work but maybe you can use QML for something else also.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              BadHombre
              wrote on last edited by
              #6

              Hmm okay ... do you know how to do that ... i m really new to QML

              what i have done now is this in QML:

                  Gamepad {
                      id: gamepad1
                      deviceId: GamepadManager.connectedGamepads.length > 0 ? GamepadManager.connectedGamepads[0] : -1
                  }
              
              

              Ho do i transfer now that "connection" to c++

              mrjjM 1 Reply Last reply
              0
              • B BadHombre

                Hmm okay ... do you know how to do that ... i m really new to QML

                what i have done now is this in QML:

                    Gamepad {
                        id: gamepad1
                        deviceId: GamepadManager.connectedGamepads.length > 0 ? GamepadManager.connectedGamepads[0] : -1
                    }
                
                

                Ho do i transfer now that "connection" to c++

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @BadHombre
                I dont think you can export whole object but i could be wrong.

                Im not into QML so lets see if others have better ideas.

                B 1 Reply Last reply
                0
                • mrjjM mrjj

                  @BadHombre
                  I dont think you can export whole object but i could be wrong.

                  Im not into QML so lets see if others have better ideas.

                  B Offline
                  B Offline
                  BadHombre
                  wrote on last edited by
                  #8

                  @mrjj okay but anyway thank you very much

                  mrjjM 1 Reply Last reply
                  0
                  • B BadHombre

                    @mrjj okay but anyway thank you very much

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @BadHombre
                    Np :)
                    I think you will use some of these methods
                    http://doc.qt.io/qt-5/qtqml-cppintegration-interactqmlfromcpp.html

                    Maybe its as easy to just find the object and cast it.

                    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