O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

What just happened?

The preceding code simply adds a signal handler for the gamepadConnected signal of the GamepadManager object. The usual way to add a signal handler is to declare it directly in the section of the sender. However, we can't do that in this case, since  GamepadManager is an existing global object that is not part of our QML object tree. Thus, we use the Connections QML type that allows us to specify an arbitrary sender (using the target property) and attach a signal handler to it. You can think of Connections as a declarative version of QObject::connect calls.

The initialization is done, so we can now use the gamepad object to request information about the gamepad input. There are two ways to do that.

First, we can use property ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required