IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QGamepad Class

A gamepad device connected to a system.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QGamepad Class

  • Header: QGamepad

  • qmake: QT += gamepad

  • Inherited By:

  • Instantiated By: qml-qtgamepad-gamepad.xml

  • Inherits: QObject

Detailed Description

QGamepad is used to access the current state of gamepad hardware connected to a system.

Property Documentation

 

[read-only] axisLeftX : const double

The value of the left thumbstick's X axis. The axis values range from -1.0 to 1.0.

Access functions:

  • double axisLeftX() const

Notifier signal:

  • void axisLeftXChanged(double value)

[read-only] axisLeftY : const double

The value of the left thumbstick's Y axis. The axis values range from -1.0 to 1.0.

Access functions:

  • double axisLeftY() const

Notifier signal:

  • void axisLeftYChanged(double value)

[read-only] axisRightX : const double

This value of the right thumbstick's X axis. The axis values range from -1.0 to 1.0.

Access functions:

  • double axisRightX() const

Notifier signal:

  • void axisRightXChanged(double value)

[read-only] axisRightY : const double

This value of the right thumbstick's Y axis. The axis values range from -1.0 to 1.0.

Access functions:

  • double axisRightY() const

Notifier signal:

  • void axisRightYChanged(double value)

[read-only] buttonL1 : const bool

The state of the left shoulder button. The value is true when pressed, and false when not pressed.

Access functions:

  • bool buttonL1() const

Notifier signal:

  • void buttonL1Changed(bool value)

[read-only] buttonL2 : const double

The value of the left trigger button. This trigger value ranges from 0.0 when not pressed to 1.0 when pressed completely.

Access functions:

  • double buttonL2() const

Notifier signal:

  • void buttonL2Changed(double value)

[read-only] buttonL3 : const bool

The state of the left stick button. The value is true when pressed, and false when not pressed. This button is usually triggered by pressing the left joystick itself.

Access functions:

  • bool buttonL3() const

Notifier signal:

  • void buttonL3Changed(bool value)

[read-only] buttonR1 : const bool

The state of the right shoulder button. The value is true when pressed, and false when not pressed.

Access functions:

  • bool buttonR1() const

Notifier signal:

  • void buttonR1Changed(bool value)

[read-only] buttonR2 : const double

The value of the right trigger button. This trigger value ranges from 0.0 when not pressed to 1.0 when pressed completely.

Access functions:

  • double buttonR2() const

Notifier signal:

  • void buttonR2Changed(double value)

[read-only] buttonR3 : const bool

The state of the right stick button. The value is true when pressed, and false when not pressed. This button is usually triggered by pressing the right joystick itself.

Access functions:

  • bool buttonR3() const

Notifier signal:

  • void buttonR3Changed(bool value)

[read-only] buttonA : const bool

The state of the A button. The value is true when pressed, and false when not pressed.

Access functions:

  • bool buttonA() const

Notifier signal:

  • void buttonAChanged(bool value)

[read-only] buttonB : const bool

The state of the B button. The value is true when pressed, and false when not pressed.

Access functions:

  • bool buttonB() const

Notifier signal:

  • void buttonBChanged(bool value)

[read-only] buttonCenter : const bool

The state of the center button. The value is true when pressed, and false when not pressed.

Access functions:

  • bool buttonCenter() const

Notifier signal:

  • void buttonCenterChanged(bool value)

[read-only] buttonDown : const bool

The state of the direction pad down button. The value is true when pressed, and false when not pressed.

Access functions:

  • bool buttonDown() const

Notifier signal:

  • void buttonDownChanged(bool value)

[read-only] buttonGuide : const bool

The state of the guide button. The value is true when pressed, and false when not pressed. This button is typically the one in the center of the gamepad with a logo. Some gamepads will not have a guide button.

Access functions:

  • bool buttonGuide() const

Notifier signal:

  • void buttonGuideChanged(bool value)

[read-only] buttonLeft : const bool

The state of the direction pad left button. The value is true when pressed, and false when not pressed.

Access functions:

  • bool buttonLeft() const

Notifier signal:

  • void buttonLeftChanged(bool value)

[read-only] buttonRight : const bool

The state of the direction pad right button. The value is true when pressed, and false when not pressed.

Access functions:

  • bool buttonRight() const

Notifier signal:

  • void buttonRightChanged(bool value)

[read-only] buttonSelect : const bool

The state of the Select button. The value is true when pressed, and false when not pressed. This button can sometimes be labeled as the Back button on some gamepads.

Access functions:

  • bool buttonSelect() const

Notifier signal:

  • void buttonSelectChanged(bool value)

[read-only] buttonStart : const bool

The state of the Start button. The value is true when pressed, and false when not pressed. This button can sometimes be labeled as the Forward button on some gamepads.

Access functions:

  • bool buttonStart() const

Notifier signal:

  • void buttonStartChanged(bool value)

[read-only] buttonUp : const bool

The state of the direction pad up button. The value is true when pressed, and false when not pressed.

Access functions:

  • bool buttonUp() const

Notifier signal:

  • void buttonUpChanged(bool value)

[read-only] buttonX : const bool

The state of the X button. The value is true when pressed, and false when not pressed.

Access functions:

  • bool buttonX() const

Notifier signal:

  • void buttonXChanged(bool value)

[read-only] buttonY : const bool

The state of the Y button. The value is true when pressed, and false when not pressed.

Access functions:

  • bool buttonY() const

Notifier signal:

  • void buttonYChanged(bool value)

[read-only] connected : const bool

The connectivity state of the gamepad device. If a gamepad is connected, this property will be true, otherwise false.

Access functions:

  • bool isConnected() const

Notifier signal:

  • void connectedChanged(bool value)

deviceId : int

This property holds the deviceId of the gamepad device. Multiple gamepad devices can be connected at any given time, so setting this property defines which gamepad to use.

Access functions:

  • int deviceId() const

  • void setDeviceId(int number)

Notifier signal:

  • void deviceIdChanged(int value)

See Also

[read-only] name : const QString

The reported name of the gamepad if one is available.

Access functions:

  • name() const

Notifier signal:

  • void nameChanged( value)

Member Function Documentation

 

[explicit] QGamepad::QGamepad(int deviceId = 0, QObject *parent = nullptr)

Constructs a QGamepad with the given deviceId and parent.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+