aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-04-21 11:08:42 +0200
committerLiang Qi <liang.qi@qt.io>2017-04-21 11:08:42 +0200
commite5f9fbd342574bada201b5a96d8a2a68f2f37cf1 (patch)
treedbe63c2042fc5b23f4853ba159fe7eb198ef67d6
parentd0981a74998205016076604884244c95c9cd83af (diff)
parent36846eca9ae810d213b2fe2ae5d9ff11137d4597 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
-rw-r--r--.gitignore1
-rw-r--r--examples/gamepad/configureButtons/main.qml944
-rw-r--r--examples/gamepad/gamepad.pro12
-rw-r--r--examples/gamepad/keyNavigation/keyNavigation.pro2
-rw-r--r--examples/gamepad/keyNavigation/qml/main.qml4
-rw-r--r--examples/gamepad/mouseItem/main.cpp4
-rw-r--r--examples/gamepad/mouseItem/mouseItem.pro2
-rw-r--r--examples/gamepad/mouseItem/qml/main.qml48
-rw-r--r--examples/gamepad/quickGamepad/qml/main.qml317
-rw-r--r--qtgamepad.pro2
-rw-r--r--src/gamepad/doc/src/qtgamepad-index.qdoc2
-rw-r--r--src/gamepad/qgamepad.cpp97
-rw-r--r--src/gamepad/qgamepadbackendfactory.cpp19
-rw-r--r--src/gamepad/qgamepadkeynavigation.cpp134
-rw-r--r--src/gamepad/qgamepadmanager.cpp37
-rw-r--r--src/plugins/gamepads/android/src/qandroidgamepadbackend_p.h4
-rw-r--r--src/plugins/gamepads/xinput/qxinputgamepadbackend.cpp2
17 files changed, 930 insertions, 701 deletions
diff --git a/.gitignore b/.gitignore
index 5a23b64..b82a7ca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@ examples/tutorials/*/*/*
!examples/tutorials/*
!examples/tutorials/*/*
!examples/ja_JP/*/*
+!examples/*/*/qml/*
demos/*/*
!demos/spectrum/*
demos/spectrum/bin
diff --git a/examples/gamepad/configureButtons/main.qml b/examples/gamepad/configureButtons/main.qml
index c93ddf2..6522631 100644
--- a/examples/gamepad/configureButtons/main.qml
+++ b/examples/gamepad/configureButtons/main.qml
@@ -35,10 +35,7 @@
****************************************************************************/
import QtQuick 2.5
-import QtQuick.Controls 1.4
-
-import QtQuick 2.5
-import QtQuick.Controls 1.4
+import QtQuick.Controls 2.1
import QtQuick.Layouts 1.2
import QtQuick.Window 2.0
import QtGamepad 1.0
@@ -47,6 +44,8 @@ import QtGamepad 1.0
ApplicationWindow {
visible: true
title: qsTr("Configure gamepad")
+ width: 400
+ height: 600
Component.onCompleted: {
if (Qt.platform.os === "android")
@@ -74,541 +73,570 @@ ApplicationWindow {
onConfigurationCanceled: pressButton(null)
}
- ColumnLayout {
- anchors.fill: parent
+ Rectangle {
+ id: headerRectangle
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.left: parent.left
+ height: headerLayout.implicitHeight + 16
+ color: "white"
+ z: 1
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("Connected gamepads")
- }
- ComboBox {
- model: GamepadManager.connectedGamepads
- onCurrentIndexChanged: gamepad.deviceId[GamepadManager.connectedGamepads[currentIndex]]
- }
- }
+ ColumnLayout {
+ id: headerLayout
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.left: parent.left
+ anchors.margins: 8
- Text {
- Layout.fillWidth: true
- text: qsTr("Start button cancel's current configuration")
- }
+ Label {
+ text: qsTr("Gamepad configuration Utility")
+ font.pointSize: 16
+ }
- RowLayout {
- Layout.fillWidth: true
- Layout.fillHeight: true
- GroupBox {
- title: qsTr("Configure Gamepad Buttons")
+ RowLayout {
Layout.fillWidth: true
- Layout.fillHeight: true
+ Label {
+ text: qsTr("Connected gamepads")
+ }
+ ComboBox {
+ Layout.fillWidth: true
+ model: GamepadManager.connectedGamepads
+ onCurrentIndexChanged: gamepad.deviceId[GamepadManager.connectedGamepads[currentIndex]]
+ }
+ }
- ColumnLayout {
- anchors.fill: parent
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("ButtonA")
- horizontalAlignment: Text.AlignRight
- }
+ Label {
+ text: qsTr("Start button cancel's current configuration")
+ Layout.fillWidth: true
+ }
+ }
+ }
- Text {
- text: gamepad.buttonA ? qsTr("DOWN") : qsTr("UP")
+ Flickable {
+ id: scrollArea
+ anchors.top: headerRectangle.bottom
+ anchors.right: parent.right
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ anchors.margins: 8
+ contentHeight: contentLayout.implicitHeight
+ ScrollIndicator.vertical: ScrollIndicator { }
+ ColumnLayout {
+ id: contentLayout
+ width: parent.width
+ ColumnLayout {
+ GroupBox {
+ title: qsTr("Configure Gamepad Buttons")
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ RowLayout {
Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
- }
+ Label {
+ text: qsTr("ButtonA")
+ horizontalAlignment: Text.AlignRight
+ }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonA);
+ Label {
+ text: gamepad.buttonA ? qsTr("DOWN") : qsTr("UP")
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
+ }
+
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonA);
+ }
}
}
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("ButtonB")
- horizontalAlignment: Text.AlignRight
- }
- Text {
- text: gamepad.buttonB ? qsTr("DOWN") : qsTr("UP")
+ RowLayout {
Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonB);
+ Label {
+ text: qsTr("ButtonB")
+ horizontalAlignment: Text.AlignRight
+ }
+ Label {
+ text: gamepad.buttonB ? qsTr("DOWN") : qsTr("UP")
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
+ }
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonB);
+ }
}
}
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("ButtonX")
- horizontalAlignment: Text.AlignRight
- }
- Text {
- text: gamepad.buttonX ? qsTr("DOWN") : qsTr("UP")
+ RowLayout {
Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonX);
+ Label {
+ text: qsTr("ButtonX")
+ horizontalAlignment: Text.AlignRight
+ }
+ Label {
+ text: gamepad.buttonX ? qsTr("DOWN") : qsTr("UP")
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
+ }
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonX);
+ }
}
}
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("ButtonY")
- horizontalAlignment: Text.AlignRight
- }
- Text {
- text: gamepad.buttonY ? qsTr("DOWN") : qsTr("UP")
+ RowLayout {
Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonY);
+ Label {
+ text: qsTr("ButtonY")
+ horizontalAlignment: Text.AlignRight
+ }
+ Label {
+ text: gamepad.buttonY ? qsTr("DOWN") : qsTr("UP")
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
+ }
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonY);
+ }
}
}
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("ButtonStart")
- horizontalAlignment: Text.AlignRight
- }
- Text {
- text: gamepad.buttonStart ? qsTr("DOWN") : qsTr("UP")
+ RowLayout {
Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonStart);
+ Label {
+ text: qsTr("ButtonStart")
+ horizontalAlignment: Text.AlignRight
+ }
+ Label {
+ text: gamepad.buttonStart ? qsTr("DOWN") : qsTr("UP")
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
+ }
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonStart);
+ }
}
}
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("ButtonSelect")
- horizontalAlignment: Text.AlignRight
- }
- Text {
- text: gamepad.buttonSelect ? qsTr("DOWN") : qsTr("UP")
+ RowLayout {
Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonSelect);
+ Label {
+ text: qsTr("ButtonSelect")
+ horizontalAlignment: Text.AlignRight
+ }
+ Label {
+ text: gamepad.buttonSelect ? qsTr("DOWN") : qsTr("UP")
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
+ }
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonSelect);
+ }
}
}
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("Button L1")
- horizontalAlignment: Text.AlignRight
- }
- Text {
- text: gamepad.buttonL1 ? qsTr("DOWN") : qsTr("UP")
+ RowLayout {
Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonL1);
+ Label {
+ text: qsTr("Button L1")
+ horizontalAlignment: Text.AlignRight
+ }
+ Label {
+ text: gamepad.buttonL1 ? qsTr("DOWN") : qsTr("UP")
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
+ }
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonL1);
+ }
}
}
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("Button R1")
- horizontalAlignment: Text.AlignRight
- }
- Text {
- text: gamepad.buttonR1 ? qsTr("DOWN") : qsTr("UP")
+ RowLayout {
Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonR1);
+ Label {
+ text: qsTr("Button R1")
+ horizontalAlignment: Text.AlignRight
+ }
+ Label {
+ text: gamepad.buttonR1 ? qsTr("DOWN") : qsTr("UP")
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
+ }
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonR1);
+ }
}
}
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("Button L2")
- horizontalAlignment: Text.AlignRight
- }
- Text {
- text: gamepad.buttonL2 ? qsTr("DOWN") : qsTr("UP")
+ RowLayout {
Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonL2);
+ Label {
+ text: qsTr("Button L2")
+ horizontalAlignment: Text.AlignRight
+ }
+ Label {
+ text: gamepad.buttonL2 ? qsTr("DOWN") : qsTr("UP")
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
+ }
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonL2);
+ }
}
}
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("Button R2")
- horizontalAlignment: Text.AlignRight
- }
- Text {
- text: gamepad.buttonR2 ? qsTr("DOWN") : qsTr("UP")
+ RowLayout {
Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonR2);
+ Label {
+ text: qsTr("Button R2")
+ horizontalAlignment: Text.AlignRight
+ }
+ Label {
+ text: gamepad.buttonR2 ? qsTr("DOWN") : qsTr("UP")
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
+ }
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonR2);
+ }
}
}
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("Button L3")
- horizontalAlignment: Text.AlignRight
- }
- Text {
- text: gamepad.buttonL3 ? qsTr("DOWN") : qsTr("UP")
+ RowLayout {
Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonL3);
+ Label {
+ text: qsTr("Button L3")
+ horizontalAlignment: Text.AlignRight
+ }
+ Label {
+ text: gamepad.buttonL3 ? qsTr("DOWN") : qsTr("UP")
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
+ }
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonL3);
+ }
}
}
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("Button R3")
- horizontalAlignment: Text.AlignRight
- }
- Text {
- text: gamepad.buttonR3 ? qsTr("DOWN") : qsTr("UP")
+ RowLayout {
Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonR3);
+ Label {
+ text: qsTr("Button R3")
+ horizontalAlignment: Text.AlignRight
+ }
+ Label {
+ text: gamepad.buttonR3 ? qsTr("DOWN") : qsTr("UP")
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
+ }
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonR3);
+ }
}
}
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("Button Up")
- horizontalAlignment: Text.AlignRight
- }
- Text {
- text: gamepad.buttonUp ? qsTr("DOWN") : qsTr("UP")
+ RowLayout {
Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonUp);
+ Label {
+ text: qsTr("Button Up")
+ horizontalAlignment: Text.AlignRight
+ }
+ Label {
+ text: gamepad.buttonUp ? qsTr("DOWN") : qsTr("UP")
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
+ }
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonUp);
+ }
}
}
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("Button Down")
- horizontalAlignment: Text.AlignRight
- }
- Text {
- text: gamepad.buttonDown ? qsTr("DOWN") : qsTr("UP")
+ RowLayout {
Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonDown );
+ Label {
+ text: qsTr("Button Down")
+ horizontalAlignment: Text.AlignRight
+ }
+ Label {
+ text: gamepad.buttonDown ? qsTr("DOWN") : qsTr("UP")
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
+ }
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonDown );
+ }
}
}
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("Button Left")
- horizontalAlignment: Text.AlignRight
- }
- Text {
+ RowLayout {
Layout.fillWidth: true
- text: gamepad.buttonLeft ? qsTr("DOWN") : qsTr("UP")
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonLeft);
+ Label {
+ text: qsTr("Button Left")
+ horizontalAlignment: Text.AlignRight
+ }
+ Label {
+ Layout.fillWidth: true
+ text: gamepad.buttonLeft ? qsTr("DOWN") : qsTr("UP")
+ horizontalAlignment: Text.AlignRight
+ }
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonLeft);
+ }
}
}
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("Button Right")
- horizontalAlignment: Text.AlignRight
- }
- Text {
+ RowLayout {
Layout.fillWidth: true
- text: gamepad.buttonRight ? qsTr("DOWN") : qsTr("UP")
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonRight);
+ Label {
+ text: qsTr("Button Right")
+ horizontalAlignment: Text.AlignRight
+ }
+ Label {
+ Layout.fillWidth: true
+ text: gamepad.buttonRight ? qsTr("DOWN") : qsTr("UP")
+ horizontalAlignment: Text.AlignRight
+ }
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonRight);
+ }
}
}
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("Button Center")
- horizontalAlignment: Text.AlignRight
- }
- Text {
+ RowLayout {
Layout.fillWidth: true
- text: gamepad.buttonCenter ? qsTr("DOWN") : qsTr("UP")
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonCenter);
+ Label {
+ text: qsTr("Button Center")
+ horizontalAlignment: Text.AlignRight
+ }
+ Label {
+ Layout.fillWidth: true
+ text: gamepad.buttonCenter ? qsTr("DOWN") : qsTr("UP")
+ horizontalAlignment: Text.AlignRight
+ }
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonCenter);
+ }
}
}
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("Button Guide")
- horizontalAlignment: Text.AlignRight
- }
- Text {
+ RowLayout {
Layout.fillWidth: true
- text: gamepad.buttonGuide ? qsTr("DOWN") : qsTr("UP")
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonGuide);
+ Label {
+ text: qsTr("Button Guide")
+ horizontalAlignment: Text.AlignRight
+ }
+ Label {
+ Layout.fillWidth: true
+ text: gamepad.buttonGuide ? qsTr("DOWN") : qsTr("UP")
+ horizontalAlignment: Text.AlignRight
+ }
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureButton(gamepad.deviceId, GamepadManager.ButtonGuide);
+ }
}
}
}
}
- }
- GroupBox {
- title: qsTr("Gamepad Axies")
- Layout.fillWidth: true
- Layout.fillHeight: true
+ GroupBox {
+ title: qsTr("Gamepad Axies")
+ Layout.fillWidth: true
- ColumnLayout {
- anchors.fill: parent
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("AxisLeftX")
- horizontalAlignment: Text.AlignRight
- }
-
- Text {
- text: gamepad.axisLeftX
+ ColumnLayout {
+ anchors.fill: parent
+ RowLayout {
Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
- }
+ Label {
+ text: qsTr("AxisLeftX")
+ horizontalAlignment: Text.AlignRight
+ }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureAxis(gamepad.deviceId, GamepadManager.AxisLeftX);
+ Label {
+ text: gamepad.axisLeftX
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
}
- }
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("AxisLeftY")
- horizontalAlignment: Text.AlignRight
- }
- Text {
- text: gamepad.axisLeftY
- Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureAxis(gamepad.deviceId, GamepadManager.AxisLeftX);
+ }
+ }
}
+ RowLayout {
+ Layout.fillWidth: true
+ Label {
+ text: qsTr("AxisLeftY")
+ horizontalAlignment: Text.AlignRight
+ }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureAxis(gamepad.deviceId, GamepadManager.AxisLeftY);
+ Label {
+ text: gamepad.axisLeftY
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
}
- }
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("AxisRightX")
- horizontalAlignment: Text.AlignRight
- }
- Text {
- text: gamepad.axisRightX
- Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureAxis(gamepad.deviceId, GamepadManager.AxisLeftY);
+ }
+ }
}
+ RowLayout {
+ Layout.fillWidth: true
+ Label {
+ text: qsTr("AxisRightX")
+ horizontalAlignment: Text.AlignRight
+ }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureAxis(gamepad.deviceId, GamepadManager.AxisRightX);
+ Label {
+ text: gamepad.axisRightX
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
}
- }
- }
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: qsTr("AxisRightY")
- horizontalAlignment: Text.AlignRight
- }
- Text {
- text: gamepad.axisRightY
- Layout.fillWidth: true
- horizontalAlignment: Text.AlignHCenter
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureAxis(gamepad.deviceId, GamepadManager.AxisRightX);
+ }
+ }
}
+ RowLayout {
+ Layout.fillWidth: true
+ Label {
+ text: qsTr("AxisRightY")
+ horizontalAlignment: Text.AlignRight
+ }
- Button {
- text: qsTr("Configure")
- checkable: true
- enabled: !checked
- onCheckedChanged: {
- pressButton(this);
- if (checked)
- GamepadManager.configureAxis(gamepad.deviceId, GamepadManager.AxisRightY);
+ Label {
+ text: gamepad.axisRightY
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignRight
+ }
+
+ Button {
+ text: qsTr("Configure")
+ checkable: true
+ enabled: !checked
+ onCheckedChanged: {
+ pressButton(this);
+ if (checked)
+ GamepadManager.configureAxis(gamepad.deviceId, GamepadManager.AxisRightY);
+ }
}
}
- }
- Item {
- Layout.fillHeight: true
+ Item {
+ Layout.fillHeight: true
+ }
}
}
}
diff --git a/examples/gamepad/gamepad.pro b/examples/gamepad/gamepad.pro
index aa36739..5622954 100644
--- a/examples/gamepad/gamepad.pro
+++ b/examples/gamepad/gamepad.pro
@@ -3,11 +3,13 @@ TEMPLATE = subdirs
SUBDIRS += simple
qtHaveModule(quick) {
- SUBDIRS += configureButtons
+ SUBDIRS += \
+ mouseItem \
+ keyNavigation
- qtHaveModule(widgets) {
- SUBDIRS += quickGamepad \
- keyNavigation \
- mouseItem
+ qtHaveModule(quickcontrols2) {
+ SUBDIRS += \
+ configureButtons \
+ quickGamepad
}
}
diff --git a/examples/gamepad/keyNavigation/keyNavigation.pro b/examples/gamepad/keyNavigation/keyNavigation.pro
index 6091e39..65f9ce3 100644
--- a/examples/gamepad/keyNavigation/keyNavigation.pro
+++ b/examples/gamepad/keyNavigation/keyNavigation.pro
@@ -1,6 +1,6 @@
TEMPLATE = app
-QT += qml quick widgets
+QT += qml quick
SOURCES += main.cpp
diff --git a/examples/gamepad/keyNavigation/qml/main.qml b/examples/gamepad/keyNavigation/qml/main.qml
index d58bfc5..6b72142 100644
--- a/examples/gamepad/keyNavigation/qml/main.qml
+++ b/examples/gamepad/keyNavigation/qml/main.qml
@@ -40,10 +40,10 @@
import QtQuick 2.2
-import QtQuick.Controls 1.1
+import QtQuick.Window 2.0
import QtGamepad 1.0
-ApplicationWindow {
+Window {
visible: true
width: 640
height: 480
diff --git a/examples/gamepad/mouseItem/main.cpp b/examples/gamepad/mouseItem/main.cpp
index ab95334..c853d2c 100644
--- a/examples/gamepad/mouseItem/main.cpp
+++ b/examples/gamepad/mouseItem/main.cpp
@@ -39,12 +39,12 @@
****************************************************************************/
-#include <QApplication>
+#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
- QApplication app(argc, argv);
+ QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:///qml/main.qml")));
diff --git a/examples/gamepad/mouseItem/mouseItem.pro b/examples/gamepad/mouseItem/mouseItem.pro
index 05f1c2c..95d667d 100644
--- a/examples/gamepad/mouseItem/mouseItem.pro
+++ b/examples/gamepad/mouseItem/mouseItem.pro
@@ -1,6 +1,6 @@
TEMPLATE = app
-QT += qml quick widgets
+QT += qml quick
SOURCES += main.cpp
diff --git a/examples/gamepad/mouseItem/qml/main.qml b/examples/gamepad/mouseItem/qml/main.qml
index 4c05e90..c6e9de5 100644
--- a/examples/gamepad/mouseItem/qml/main.qml
+++ b/examples/gamepad/mouseItem/qml/main.qml
@@ -38,16 +38,27 @@
**
****************************************************************************/
-
import QtQuick 2.2
-import QtQuick.Controls 1.1
+import QtQuick.Window 2.0
import QtGamepad 1.0
-ApplicationWindow {
+Window {
visible: true
width: 640
height: 480
- title: qsTr("Hello World")
+ title: qsTr("Gamepad Mouse Item")
+
+ Text {
+ id: instructionLabel
+ anchors.centerIn: parent
+ text: qsTr("Simulate mouse input using a Gamepad")
+ }
+ Text {
+ id: outputLabel
+ anchors.horizontalCenter: instructionLabel.horizontalCenter
+ anchors.top: instructionLabel.bottom
+ text: ""
+ }
Connections {
target: GamepadManager
@@ -61,9 +72,10 @@ ApplicationWindow {
onButtonAChanged: {
if (value == true) {
gamepadMouse.mouseButtonPressed(Qt.LeftButton);
- console.log("fake clicked qt: " + gamepadMouse.mousePosition.x + "," + gamepadMouse.mousePosition.y);
+ outputLabel.text = "Mouse click at: " + gamepadMouse.mousePosition.x + "," + gamepadMouse.mousePosition.y;
} else {
gamepadMouse.mouseButtonReleased(Qt.LeftButton);
+ outputLabel.text = "";
}
}
}
@@ -76,18 +88,36 @@ ApplicationWindow {
Rectangle {
id: cursor
- width: 4
- height: 4
+ width: 9
+ height: 9
+ radius: 4.5
x: gamepadMouse.mousePosition.x
y: gamepadMouse.mousePosition.y
- color: "red"
+ color: "transparent"
+ border.color: "red"
+ Rectangle {
+ x: cursor.width * 0.5 - 0.5
+ y: 1
+ width: 1
+ height: cursor.height - 2
+ color: "black"
+ }
+ Rectangle {
+ x: 1
+ y: cursor.height * 0.5 - 0.5
+ height: 1
+ width: cursor.width - 2
+ color: "black"
+ }
}
}
+
+
MouseArea {
anchors.fill: parent
onClicked: {
- console.log("clicked qt: " + mouse.x + "," + mouse.y);
+ console.log("clicked at: " + mouse.x + "," + mouse.y);
}
}
}
diff --git a/examples/gamepad/quickGamepad/qml/main.qml b/examples/gamepad/quickGamepad/qml/main.qml
index 049e72b..70ea5ec 100644
--- a/examples/gamepad/quickGamepad/qml/main.qml
+++ b/examples/gamepad/quickGamepad/qml/main.qml
@@ -39,191 +39,174 @@
****************************************************************************/
import QtQuick 2.2
-import QtQuick.Controls 1.1
+import QtQuick.Controls 2.0
+import QtQuick.Layouts 1.1
+import QtQuick.Window 2.0
import QtGamepad 1.0
-ApplicationWindow {
+Window {
id: applicationWindow1
visible: true
width: 800
height: 600
title: qsTr("QtGamepad Example")
+ color: "#363330"
- Rectangle {
+ Item {
id: background
- color: "#363330"
anchors.fill: parent
- Item {
- id: buttonL2Item
- height: leftTrigger.height
- width: leftTrigger.width + buttonL2Value.width
- anchors.left: parent.left
- anchors.leftMargin: 8
- anchors.top: parent.top
- anchors.topMargin: 8
-
- ButtonImage {
- id: leftTrigger
- anchors.top: parent.top
- anchors.left: parent.left
- anchors.bottom: parent.bottom
- source: "xboxControllerLeftTrigger.png"
- active: gamepad.buttonL2 != 0
- }
-
- ProgressBar {
- id: buttonL2Value
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- anchors.left: leftTrigger.right
- orientation: 0
- value: gamepad.buttonL2
- }
- }
- ButtonImage {
- id: buttonL1
- anchors.left: buttonL2Item.left
- anchors.top: buttonL2Item.bottom
- anchors.topMargin: 8
- source: "xboxControllerLeftShoulder.png"
- active: gamepad.buttonL1
- }
-
-
- Item {
- id: buttonR2Item
- height: rightTrigger.height
- width: rightTrigger.width + buttonR2Value.width
- anchors.right: parent.right
- anchors.rightMargin: 8
- anchors.top: parent.top
- anchors.topMargin: 8
-
- ButtonImage {
- id: rightTrigger
- anchors.top: parent.top
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- source: "xboxControllerRightTrigger.png"
- active: gamepad.buttonR2 != 0
- }
-
- ProgressBar {
- id: buttonR2Value
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- anchors.right: rightTrigger.left
- orientation: 0
- value: gamepad.buttonR2
- }
- }
- ButtonImage {
- id: buttonR1
- anchors.right: buttonR2Item.right
- anchors.top: buttonR2Item.bottom
- anchors.topMargin: 8
- source: "xboxControllerRightShoulder.png"
- active: gamepad.buttonR1
- }
-
- Item {
- id: centerButtons
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.top: parent.top
- anchors.topMargin: 8
- height: guideButton.height
- width: guideButton.width + 16 + backButton.width + startButton.width
- ButtonImage {
- id: backButton
- anchors.verticalCenter: parent.verticalCenter
- anchors.right: guideButton.left
- anchors.rightMargin: 8
- source: "xboxControllerBack.png"
- active: gamepad.buttonSelect
- }
- ButtonImage {
- id: guideButton
- anchors.centerIn: parent
- source: "xboxControllerButtonGuide.png"
- active: gamepad.buttonGuide
- }
- ButtonImage {
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: guideButton.right
- anchors.leftMargin: 8
- id: startButton
- source: "xboxControllerStart.png"
- active: gamepad.buttonStart
- }
- }
-
-
-
-
- DPad {
- id: dPad
- gamepad: gamepad
- anchors.left: parent.left
- anchors.bottom: parent.bottom
- anchors.margins: 8
- }
-
- Row {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottom: parent.bottom
+ ColumnLayout {
+ anchors.fill: parent
anchors.margins: 8
- spacing: 16
-
- LeftThumbstick {
- id: leftThumbstick
- gamepad: gamepad
+ RowLayout {
+ id: topRow
+ width: parent.width
+ ColumnLayout {
+ id: buttonL2Item
+ Layout.alignment: Qt.AlignLeft
+ ButtonImage {
+ id: leftTrigger
+ Layout.alignment: Qt.AlignCenter
+ source: "xboxControllerLeftTrigger.png"
+ active: gamepad.buttonL2 != 0
+ }
+ ProgressBar {
+ id: buttonL2Value
+ width: leftTrigger.width
+ value: gamepad.buttonL2
+ }
+ }
+
+ Item {
+ id: centerButtons
+ Layout.alignment: Qt.AlignCenter
+ Layout.fillWidth: true
+ height: guideButton.height
+ width: guideButton.width + 16 + backButton.width + startButton.width
+ ButtonImage {
+ id: backButton
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: guideButton.left
+ anchors.rightMargin: 8
+ source: "xboxControllerBack.png"
+ active: gamepad.buttonSelect
+ }
+ ButtonImage {
+ id: guideButton
+ anchors.centerIn: parent
+ source: "xboxControllerButtonGuide.png"
+ active: gamepad.buttonGuide
+ }
+ ButtonImage {
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: guideButton.right
+ anchors.leftMargin: 8
+ id: startButton
+ source: "xboxControllerStart.png"
+ active: gamepad.buttonStart
+ }
+ }
+
+
+ ColumnLayout {
+ id: buttonR2Item
+ Layout.alignment: Qt.AlignRight
+ ButtonImage {
+ id: rightTrigger
+ Layout.alignment: Qt.AlignCenter
+ source: "xboxControllerRightTrigger.png"
+ active: gamepad.buttonR2 != 0
+ }
+
+ ProgressBar {
+ id: buttonR2Value
+ width: rightTrigger.width
+ value: gamepad.buttonR2
+ }
+ }
}
- RightThumbstick {
- id: rightThumbstick
- gamepad: gamepad
+ RowLayout {
+ id: middleRow
+ ButtonImage {
+ id: buttonL1
+ source: "xboxControllerLeftShoulder.png"
+ active: gamepad.buttonL1
+ }
+ Item {
+ id: spacer1
+ Layout.fillWidth: true
+ }
+
+ ButtonImage {
+ id: buttonR1
+ source: "xboxControllerRightShoulder.png"
+ active: gamepad.buttonR1
+ }
}
- }
-
- Item {
- width: 200
- height: 200
- anchors.right: parent.right
- anchors.rightMargin: 8
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 8
- ButtonImage {
- id: buttonA
- anchors.bottom: parent.bottom
- anchors.horizontalCenter: parent.horizontalCenter
- source: "xboxControllerButtonA.png";
- active: gamepad.buttonA
- }
- ButtonImage {
- id: buttonB
- anchors.right: parent.right
- anchors.verticalCenter: parent.verticalCenter
- source: "xboxControllerButtonB.png";
- active: gamepad.buttonB
- }
- ButtonImage {
- id: buttonX
- anchors.left: parent.left
- anchors.verticalCenter: parent.verticalCenter
- source: "xboxControllerButtonX.png";
- active: gamepad.buttonX
- }
- ButtonImage {
- id: buttonY
- anchors.top: parent.top
- anchors.horizontalCenter: parent.horizontalCenter
- source: "xboxControllerButtonY.png";
- active: gamepad.buttonY
+ RowLayout {
+ id: bottomRow
+ width: parent.width
+ DPad {
+ id: dPad
+ Layout.alignment: Qt.AlignLeft
+ gamepad: gamepad
+ }
+
+ LeftThumbstick {
+ id: leftThumbstick
+ Layout.alignment: Qt.AlignLeft
+ gamepad: gamepad
+ }
+
+ Item {
+ id: spacer2
+ Layout.fillWidth: true
+ }
+
+ RightThumbstick {
+ id: rightThumbstick
+ Layout.alignment: Qt.AlignRight
+ gamepad: gamepad
+ }
+
+ Item {
+ width: 200
+ height: 200
+ Layout.alignment: Qt.AlignRight
+ ButtonImage {
+ id: buttonA
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ source: "xboxControllerButtonA.png";
+ active: gamepad.buttonA
+ }
+ ButtonImage {
+ id: buttonB
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ source: "xboxControllerButtonB.png";
+ active: gamepad.buttonB
+ }
+ ButtonImage {
+ id: buttonX
+ anchors.left: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ source: "xboxControllerButtonX.png";
+ active: gamepad.buttonX
+ }
+ ButtonImage {
+ id: buttonY
+ anchors.top: parent.top
+ anchors.horizontalCenter: parent.horizontalCenter
+ source: "xboxControllerButtonY.png";
+ active: gamepad.buttonY
+ }
+ }
}
}
-
}
Connections {
diff --git a/qtgamepad.pro b/qtgamepad.pro
index 58c33f2..7d21914 100644
--- a/qtgamepad.pro
+++ b/qtgamepad.pro
@@ -1 +1,3 @@
load(qt_parts)
+
+requires(qtHaveModule(gui))
diff --git a/src/gamepad/doc/src/qtgamepad-index.qdoc b/src/gamepad/doc/src/qtgamepad-index.qdoc
index 8b4aa25..272eeb9 100644
--- a/src/gamepad/doc/src/qtgamepad-index.qdoc
+++ b/src/gamepad/doc/src/qtgamepad-index.qdoc
@@ -86,7 +86,7 @@
present, and is sending events, via the \c lsinput and \c evtest utilities.
PlayStation controllers will likely need the help of an additional tool like
- \l{xboxdrv}{https://github.com/xboxdrv/xboxdrv}. Once installed, and having a
+ \l{https://github.com/xboxdrv/xboxdrv}{xboxdrv}. Once installed, and having a
PS3 controller connected via USB, the following will ensure correct operation
with QtGamepad:
diff --git a/src/gamepad/qgamepad.cpp b/src/gamepad/qgamepad.cpp
index 399e801..f4db27e 100644
--- a/src/gamepad/qgamepad.cpp
+++ b/src/gamepad/qgamepad.cpp
@@ -394,8 +394,8 @@ int QGamepad::deviceId() const
/*!
* \property QGamepad::connected
- * This property holds the connectivity state of the gamepad device. If a gamepad is connected
- * this property will be true, otherwise false.
+ * This read-only property holds the connectivity state of the gamepad device.
+ * If a gamepad is connected, this property will be true, otherwise false.
*/
bool QGamepad::isConnected() const
{
@@ -406,7 +406,8 @@ bool QGamepad::isConnected() const
/*!
* \property QGamepad::name
*
- * This property holds the reported name of the gamepad if one is available.
+ * This read-only property holds the reported name of the gamepad if one
+ * is available.
*/
QString QGamepad::name() const
{
@@ -417,8 +418,8 @@ QString QGamepad::name() const
/*!
* \property QGamepad::axisLeftX
*
- * This property holds the value of the left thumbstick's X axis.
- * The range of axis values are from -1.0 to 1.0.
+ * This read-only property holds the value of the left thumbstick's X axis.
+ * The axis values range from -1.0 to 1.0.
*/
double QGamepad::axisLeftX() const
{
@@ -429,8 +430,8 @@ double QGamepad::axisLeftX() const
/*!
* \property QGamepad::axisLeftY
*
- * This property holds the value of the left thumbstick's Y axis.
- * The range of axis values are from -1.0 to 1.0.
+ * This read-only property holds the value of the left thumbstick's Y axis.
+ * The axis values range from -1.0 to 1.0.
*/
double QGamepad::axisLeftY() const
{
@@ -441,8 +442,8 @@ double QGamepad::axisLeftY() const
/*!
* \property QGamepad::axisRightX
*
- * This property holds the value of the right thumbstick's X axis.
- * The range of axis values are from -1.0 to 1.0.
+ * This read-only property holds the value of the right thumbstick's X axis.
+ * The axis values range from -1.0 to 1.0.
*/
double QGamepad::axisRightX() const
{
@@ -453,8 +454,8 @@ double QGamepad::axisRightX() const
/*!
* \property QGamepad::axisRightY
*
- * This property holds the value of the right thumbstick's Y axis.
- * The range of axis values are from -1.0 to 1.0.
+ * This read-only property holds the value of the right thumbstick's Y axis.
+ * The axis values range from -1.0 to 1.0.
*/
double QGamepad::axisRightY() const
{
@@ -465,8 +466,8 @@ double QGamepad::axisRightY() const
/*!
* \property QGamepad::buttonA
*
- * This property holds the state of the A button. True when pressed, false when not
- * pressed.
+ * This read-only property holds the state of the A button.
+ * The value is \c true when pressed, and \c false when not pressed.
*/
bool QGamepad::buttonA() const
{
@@ -477,8 +478,8 @@ bool QGamepad::buttonA() const
/*!
* \property QGamepad::buttonB
*
- * This property holds the state of the B button. True when pressed, false when not
- * pressed.
+ * This read-only property holds the state of the B button.
+ * The value is \c true when pressed, and \c false when not pressed.
*
* \sa QGamepadManager::connectedGamepads()
*/
@@ -491,8 +492,8 @@ bool QGamepad::buttonB() const
/*!
* \property QGamepad::buttonX
*
- * This property holds the state of the X button. True when pressed, false when not
- * pressed.
+ * This read-only property holds the state of the X button.
+ * The value is \c true when pressed, and \c false when not pressed.
*/
bool QGamepad::buttonX() const
{
@@ -503,8 +504,8 @@ bool QGamepad::buttonX() const
/*!
* \property QGamepad::buttonY
*
- * This property holds the state of the Y button. True when pressed, false when not
- * pressed.
+ * This read-only property holds the state of the Y button.
+ * The value is \c true when pressed, and \c false when not pressed.
*/
bool QGamepad::buttonY() const
{
@@ -515,8 +516,8 @@ bool QGamepad::buttonY() const
/*!
* \property QGamepad::buttonL1
*
- * This property holds the state of the left shoulder button.
- * True when pressed, false when not pressed.
+ * This read-only property holds the state of the left shoulder button.
+ * The value is \c true when pressed, and \c false when not pressed.
*/
bool QGamepad::buttonL1() const
{
@@ -527,8 +528,8 @@ bool QGamepad::buttonL1() const
/*!
* \property QGamepad::buttonR1
*
- * This property holds the state of the right shoulder button.
- * True when pressed, false when not pressed.
+ * This read-only property holds the state of the right shoulder button.
+ * The value is \c true when pressed, and \c false when not pressed.
*/
bool QGamepad::buttonR1() const
{
@@ -539,7 +540,7 @@ bool QGamepad::buttonR1() const
/*!
* \property QGamepad::buttonL2
*
- * This property holds the value of the left trigger button.
+ * This read-only property holds the value of the left trigger button.
* This trigger value ranges from 0.0 when not pressed to 1.0
* when pressed completely.
*/
@@ -552,7 +553,7 @@ double QGamepad::buttonL2() const
/*!
* \property QGamepad::buttonR2
*
- * This property holds the value of the right trigger button.
+ * This read-only property holds the value of the right trigger button.
* This trigger value ranges from 0.0 when not pressed to 1.0
* when pressed completely.
*/
@@ -565,8 +566,9 @@ double QGamepad::buttonR2() const
/*!
* \property QGamepad::buttonSelect
*
- * This property holds the state of the Select button. True when pressed, false when not
- * pressed. This button can sometimes be labeled as the Back button on some gamepads.
+ * This read-only property holds the state of the Select button.
+ * The value is \c true when pressed, and \c false when not pressed.
+ * This button can sometimes be labeled as the Back button on some gamepads.
*/
bool QGamepad::buttonSelect() const
{
@@ -577,8 +579,9 @@ bool QGamepad::buttonSelect() const
/*!
* \property QGamepad::buttonStart
*
- * This property holds the state of the Start button. True when pressed, false when not
- * pressed. This button can sometimes be labeled as the Forward button on some gamepads.
+ * This read-only property holds the state of the Start button.
+ * The value is \c true when pressed, and \c false when not pressed.
+ * This button can sometimes be labeled as the Forward button on some gamepads.
*/
bool QGamepad::buttonStart() const
{
@@ -589,8 +592,9 @@ bool QGamepad::buttonStart() const
/*!
* \property QGamepad::buttonL3
*
- * This property holds the state of the left stick button. True when pressed, false when not
- * pressed. This button is usually triggered by pressing the left joystick itself.
+ * This read-only property holds the state of the left stick button.
+ * The value is \c true when pressed, and \c false when not pressed.
+ * This button is usually triggered by pressing the left joystick itself.
*/
bool QGamepad::buttonL3() const
{
@@ -601,8 +605,9 @@ bool QGamepad::buttonL3() const
/*!
* \property QGamepad::buttonR3
*
- * This property holds the state of the right stick button. True when pressed, false when not
- * pressed. This button is usually triggered by pressing the right joystick itself.
+ * This read-only property holds the state of the right stick button.
+ * The value is \c true when pressed, and \c false when not pressed.
+ * This button is usually triggered by pressing the right joystick itself.
*/
bool QGamepad::buttonR3() const
{
@@ -613,8 +618,8 @@ bool QGamepad::buttonR3() const
/*!
* \property QGamepad::buttonUp
*
- * This property holds the state of the direction pad up button.
- * True when pressed, false when not pressed.
+ * This read-only property holds the state of the direction pad up button.
+ * The value is \c true when pressed, and \c false when not pressed.
*/
bool QGamepad::buttonUp() const
{
@@ -625,8 +630,8 @@ bool QGamepad::buttonUp() const
/*!
* \property QGamepad::buttonDown
*
- * This property holds the state of the direction pad down button.
- * True when pressed, false when not pressed.
+ * This read-only property holds the state of the direction pad down button.
+ * The value is \c true when pressed, and \c false when not pressed.
*/
bool QGamepad::buttonDown() const
{
@@ -637,8 +642,8 @@ bool QGamepad::buttonDown() const
/*!
* \property QGamepad::buttonLeft
*
- * This property holds the state of the direction pad left button.
- * True when pressed, false when not pressed.
+ * This read-only property holds the state of the direction pad left button.
+ * The value is \c true when pressed, and \c false when not pressed.
*/
bool QGamepad::buttonLeft() const
{
@@ -649,8 +654,8 @@ bool QGamepad::buttonLeft() const
/*!
* \property QGamepad::buttonRight
*
- * This property holds the state of the direction pad right button.
- * True when pressed, false when not pressed.
+ * This read-only property holds the state of the direction pad right button.
+ * The value is \c true when pressed, and \c false when not pressed.
*/
bool QGamepad::buttonRight() const
{
@@ -658,6 +663,12 @@ bool QGamepad::buttonRight() const
return d->buttonRight;
}
+/*!
+ * \property QGamepad::buttonCenter
+ *
+ * This read-only property holds the state of the center button.
+ * The value is \c true when pressed, and \c false when not pressed.
+ */
bool QGamepad::buttonCenter() const
{
Q_D(const QGamepad);
@@ -667,8 +678,8 @@ bool QGamepad::buttonCenter() const
/*!
* \property QGamepad::buttonGuide
*
- * This property holds the state of the guide button.
- * True when pressed, false when not pressed.
+ * This read-only property holds the state of the guide button.
+ * The value is \c true when pressed, and \c 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.
*/
diff --git a/src/gamepad/qgamepadbackendfactory.cpp b/src/gamepad/qgamepadbackendfactory.cpp
index 25a1064..988de68 100644
--- a/src/gamepad/qgamepadbackendfactory.cpp
+++ b/src/gamepad/qgamepadbackendfactory.cpp
@@ -38,22 +38,23 @@
#include "qgamepadbackendplugin_p.h"
#include "qgamepadbackend_p.h"
+#include <QtCore/qdebug.h>
#include <QtCore/private/qfactoryloader_p.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_LIBRARY
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QtGamepadBackendFactoryInterface_iid, QLatin1String("/gamepads"), Qt::CaseInsensitive))
+#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, (QtGamepadBackendFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
#endif
QStringList QGamepadBackendFactory::keys(const QString &pluginPath)
{
-#ifndef QT_NO_LIBRARY
QStringList list;
if (!pluginPath.isEmpty()) {
+#if QT_CONFIG(library)
QCoreApplication::addLibraryPath(pluginPath);
list = directLoader()->keyMap().values();
if (!list.isEmpty()) {
@@ -64,25 +65,29 @@ QStringList QGamepadBackendFactory::keys(const QString &pluginPath)
for (QStringList::iterator it = list.begin(); it != end; ++it)
(*it).append(postFix);
}
+#else
+ qWarning("Cannot query QGamepadBackend plugins at %s: Library loading is disabled.",
+ pluginPath.toLocal8Bit().constData());
+#endif
}
list.append(loader()->keyMap().values());
return list;
-#else
- return QStringList();
-#endif
}
QGamepadBackend *QGamepadBackendFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
{
-#ifndef QT_NO_LIBRARY
if (!pluginPath.isEmpty()) {
+#if QT_CONFIG(library)
QCoreApplication::addLibraryPath(pluginPath);
if (QGamepadBackend *ret = qLoadPlugin<QGamepadBackend, QGamepadBackendPlugin>(directLoader(), name, args))
return ret;
+#else
+ qWarning("Cannot load QGamepadBackend plugin from %s. Library loading is disabled.",
+ pluginPath.toLocal8Bit().constData());
+#endif
}
if (QGamepadBackend *ret = qLoadPlugin<QGamepadBackend, QGamepadBackendPlugin>(loader(), name, args))
return ret;
-#endif
return 0;
}
diff --git a/src/gamepad/qgamepadkeynavigation.cpp b/src/gamepad/qgamepadkeynavigation.cpp
index 686e8bd..dce193c 100644
--- a/src/gamepad/qgamepadkeynavigation.cpp
+++ b/src/gamepad/qgamepadkeynavigation.cpp
@@ -162,120 +162,181 @@ QGamepadKeyNavigation::QGamepadKeyNavigation(QObject *parent)
this, SLOT(_q_processGamepadButtonReleaseEvent(int,QGamepadManager::GamepadButton)));
}
+/*!
+ * Returns whether key navigation on the gamepad is active or not.
+*/
bool QGamepadKeyNavigation::active() const
{
Q_D(const QGamepadKeyNavigation);
return d->active;
}
+/*!
+ * Returns a pointer the current QGamepad
+ */
QGamepad *QGamepadKeyNavigation::gamepad() const
{
Q_D(const QGamepadKeyNavigation);
return d->gamepad;
}
+/*!
+ * Returns the key mapping of the Up button.
+ */
Qt::Key QGamepadKeyNavigation::upKey() const
{
Q_D(const QGamepadKeyNavigation);
return d->keyMapping[QGamepadManager::ButtonUp];
}
+/*!
+ * Returns the key mapping of the Down button.
+ */
Qt::Key QGamepadKeyNavigation::downKey() const
{
Q_D(const QGamepadKeyNavigation);
return d->keyMapping[QGamepadManager::ButtonDown];
}
+/*!
+ * Returns the key mapping of the Left button.
+ */
Qt::Key QGamepadKeyNavigation::leftKey() const
{
Q_D(const QGamepadKeyNavigation);
return d->keyMapping[QGamepadManager::ButtonLeft];
}
+/*!
+ * Returns the key mapping of the Right button.
+ */
Qt::Key QGamepadKeyNavigation::rightKey() const
{
Q_D(const QGamepadKeyNavigation);
return d->keyMapping[QGamepadManager::ButtonRight];
}
+/*!
+ * Returns the key mapping of A button.
+ */
Qt::Key QGamepadKeyNavigation::buttonAKey() const
{
Q_D(const QGamepadKeyNavigation);
return d->keyMapping[QGamepadManager::ButtonA];
}
+/*!
+ * Returns the key mapping of the B button.
+ */
Qt::Key QGamepadKeyNavigation::buttonBKey() const
{
Q_D(const QGamepadKeyNavigation);
return d->keyMapping[QGamepadManager::ButtonB];
}
+/*!
+ * Returns the key mapping of the X button.
+ */
Qt::Key QGamepadKeyNavigation::buttonXKey() const
{
Q_D(const QGamepadKeyNavigation);
return d->keyMapping[QGamepadManager::ButtonX];
}
+/*!
+ * Returns the key mapping of the Y button.
+ */
Qt::Key QGamepadKeyNavigation::buttonYKey() const
{
Q_D(const QGamepadKeyNavigation);
return d->keyMapping[QGamepadManager::ButtonY];
}
+/*!
+ * Returns the key mapping of the Select button.
+ */
Qt::Key QGamepadKeyNavigation::buttonSelectKey() const
{
Q_D(const QGamepadKeyNavigation);
return d->keyMapping[QGamepadManager::ButtonSelect];
}
+/*!
+ * Returns the key mapping of the Start button.
+ */
Qt::Key QGamepadKeyNavigation::buttonStartKey() const
{
Q_D(const QGamepadKeyNavigation);
return d->keyMapping[QGamepadManager::ButtonStart];
}
+/*!
+ * Returns the key mapping of the Guide button.
+ */
Qt::Key QGamepadKeyNavigation::buttonGuideKey() const
{
Q_D(const QGamepadKeyNavigation);
return d->keyMapping[QGamepadManager::ButtonGuide];
}
+/*!
+ * Returns the key mapping of the left shoulder button.
+ */
Qt::Key QGamepadKeyNavigation::buttonL1Key() const
{
Q_D(const QGamepadKeyNavigation);
return d->keyMapping[QGamepadManager::ButtonL1];
}
+/*!
+ * Returns the key mapping of the Right shoulder button.
+ */
Qt::Key QGamepadKeyNavigation::buttonR1Key() const
{
Q_D(const QGamepadKeyNavigation);
return d->keyMapping[QGamepadManager::ButtonL2];
}
+/*!
+ * Returns the key mapping of the left trigger button.
+ */
Qt::Key QGamepadKeyNavigation::buttonL2Key() const
{
Q_D(const QGamepadKeyNavigation);
return d->keyMapping[QGamepadManager::ButtonL2];
}
+/*!
+ * Returns the key mapping of the Right trigger button.
+ */
Qt::Key QGamepadKeyNavigation::buttonR2Key() const
{
Q_D(const QGamepadKeyNavigation);
return d->keyMapping[QGamepadManager::ButtonL2];
}
+/*!
+ * Returns the key mapping of the left stick button.
+ */
Qt::Key QGamepadKeyNavigation::buttonL3Key() const
{
Q_D(const QGamepadKeyNavigation);
return d->keyMapping[QGamepadManager::ButtonL3];
}
+/*!
+ * Returns the key mapping of the right stick button.
+ */
Qt::Key QGamepadKeyNavigation::buttonR3Key() const
{
Q_D(const QGamepadKeyNavigation);
return d->keyMapping[QGamepadManager::ButtonL3];
}
+/*!
+ * Activates key navigation if \a isActive is true,
+ * disables it otherwise.
+ */
void QGamepadKeyNavigation::setActive(bool isActive)
{
Q_D(QGamepadKeyNavigation);
@@ -285,6 +346,9 @@ void QGamepadKeyNavigation::setActive(bool isActive)
}
}
+/*!
+ * Selects the specified \a gamepad.
+*/
void QGamepadKeyNavigation::setGamepad(QGamepad *gamepad)
{
Q_D(QGamepadKeyNavigation);
@@ -294,6 +358,10 @@ void QGamepadKeyNavigation::setGamepad(QGamepad *gamepad)
}
}
+/*!
+ * Sets the mapping of the Up button with the
+ * keycode specified in \a key.
+*/
void QGamepadKeyNavigation::setUpKey(Qt::Key key)
{
Q_D(QGamepadKeyNavigation);
@@ -303,6 +371,10 @@ void QGamepadKeyNavigation::setUpKey(Qt::Key key)
}
}
+/*!
+ * Sets the mapping of the Down button with the
+ * keycode specified in \a key.
+*/
void QGamepadKeyNavigation::setDownKey(Qt::Key key)
{
Q_D(QGamepadKeyNavigation);
@@ -312,6 +384,10 @@ void QGamepadKeyNavigation::setDownKey(Qt::Key key)
}
}
+/*!
+ * Sets the mapping of the Left button with the
+ * keycode specified in \a key.
+*/
void QGamepadKeyNavigation::setLeftKey(Qt::Key key)
{
Q_D(QGamepadKeyNavigation);
@@ -321,6 +397,10 @@ void QGamepadKeyNavigation::setLeftKey(Qt::Key key)
}
}
+/*!
+ * Sets the mapping of the Right button with the
+ * keycode specified in \a key.
+*/
void QGamepadKeyNavigation::setRightKey(Qt::Key key)
{
Q_D(QGamepadKeyNavigation);
@@ -330,6 +410,10 @@ void QGamepadKeyNavigation::setRightKey(Qt::Key key)
}
}
+/*!
+ * Sets the mapping of the A button with the keycode
+ * specified in \a key.
+*/
void QGamepadKeyNavigation::setButtonAKey(Qt::Key key)
{
Q_D(QGamepadKeyNavigation);
@@ -339,6 +423,10 @@ void QGamepadKeyNavigation::setButtonAKey(Qt::Key key)
}
}
+/*!
+ * Sets the mapping of the B button with the keycode
+ * specified in \a key.
+*/
void QGamepadKeyNavigation::setButtonBKey(Qt::Key key)
{
Q_D(QGamepadKeyNavigation);
@@ -348,6 +436,10 @@ void QGamepadKeyNavigation::setButtonBKey(Qt::Key key)
}
}
+/*!
+ * Sets the mapping of the X button with the
+ * keycode specified in \a key.
+*/
void QGamepadKeyNavigation::setButtonXKey(Qt::Key key)
{
Q_D(QGamepadKeyNavigation);
@@ -357,6 +449,10 @@ void QGamepadKeyNavigation::setButtonXKey(Qt::Key key)
}
}
+/*!
+ * Sets the mapping of the Y button with the
+ * keycode specified in \a key.
+*/
void QGamepadKeyNavigation::setButtonYKey(Qt::Key key)
{
Q_D(QGamepadKeyNavigation);
@@ -366,6 +462,10 @@ void QGamepadKeyNavigation::setButtonYKey(Qt::Key key)
}
}
+/*!
+ * Sets the mapping of the Select button with the
+ * keycode specified in \a key.
+*/
void QGamepadKeyNavigation::setButtonSelectKey(Qt::Key key)
{
Q_D(QGamepadKeyNavigation);
@@ -375,6 +475,10 @@ void QGamepadKeyNavigation::setButtonSelectKey(Qt::Key key)
}
}
+/*!
+ * Sets the mapping of the Start button with the
+ * keycode specified in \a key.
+*/
void QGamepadKeyNavigation::setButtonStartKey(Qt::Key key)
{
Q_D(QGamepadKeyNavigation);
@@ -384,6 +488,10 @@ void QGamepadKeyNavigation::setButtonStartKey(Qt::Key key)
}
}
+/*!
+ * Sets the mapping of the Guide button with the keycode
+ * specified in \a key.
+*/
void QGamepadKeyNavigation::setButtonGuideKey(Qt::Key key)
{
Q_D(QGamepadKeyNavigation);
@@ -393,6 +501,10 @@ void QGamepadKeyNavigation::setButtonGuideKey(Qt::Key key)
}
}
+/*!
+ * Sets the mapping of the left shoulder button with the
+ * keycode specified in \a key.
+*/
void QGamepadKeyNavigation::setButtonL1Key(Qt::Key key)
{
Q_D(QGamepadKeyNavigation);
@@ -402,6 +514,10 @@ void QGamepadKeyNavigation::setButtonL1Key(Qt::Key key)
}
}
+/*!
+ * Sets the mapping of the right shoulder button with the
+ * keycode specified in \a key.
+*/
void QGamepadKeyNavigation::setButtonR1Key(Qt::Key key)
{
Q_D(QGamepadKeyNavigation);
@@ -411,6 +527,10 @@ void QGamepadKeyNavigation::setButtonR1Key(Qt::Key key)
}
}
+/*!
+ * Sets the mapping of the left trigger button with the
+ * keycode specified in \a key.
+*/
void QGamepadKeyNavigation::setButtonL2Key(Qt::Key key)
{
Q_D(QGamepadKeyNavigation);
@@ -420,6 +540,10 @@ void QGamepadKeyNavigation::setButtonL2Key(Qt::Key key)
}
}
+/*!
+ * Sets the mapping of the right trigger button with the
+ * keycode specified in \a key.
+*/
void QGamepadKeyNavigation::setButtonR2Key(Qt::Key key)
{
Q_D(QGamepadKeyNavigation);
@@ -429,6 +553,10 @@ void QGamepadKeyNavigation::setButtonR2Key(Qt::Key key)
}
}
+/*!
+ * Sets the mapping of the left stick button with the
+ * keycode specified in \a key.
+*/
void QGamepadKeyNavigation::setButtonL3Key(Qt::Key key)
{
Q_D(QGamepadKeyNavigation);
@@ -438,6 +566,10 @@ void QGamepadKeyNavigation::setButtonL3Key(Qt::Key key)
}
}
+/*!
+ * Sets the mapping of the right stick button with the
+ * keycode specified in \a key.
+*/
void QGamepadKeyNavigation::setButtonR3Key(Qt::Key key)
{
Q_D(QGamepadKeyNavigation);
@@ -447,8 +579,6 @@ void QGamepadKeyNavigation::setButtonR3Key(Qt::Key key)
}
}
-
-
QT_END_NAMESPACE
#include "moc_qgamepadkeynavigation.cpp"
diff --git a/src/gamepad/qgamepadmanager.cpp b/src/gamepad/qgamepadmanager.cpp
index 9628f0e..32d7642 100644
--- a/src/gamepad/qgamepadmanager.cpp
+++ b/src/gamepad/qgamepadmanager.cpp
@@ -172,54 +172,91 @@ QGamepadManager::~QGamepadManager()
d->gamepadBackend->deleteLater();
}
+/*!
+ Returns the instance of the QGamepadManager.
+*/
QGamepadManager *QGamepadManager::instance()
{
static QGamepadManager instance;
return &instance;
}
+/*!
+ Returns a boolean indicating whether the gamepad with
+ the specified \a deviceId is connected or not.
+*/
bool QGamepadManager::isGamepadConnected(int deviceId) const
{
Q_D(const QGamepadManager);
return d->connectedGamepads.contains(deviceId);
}
+/*!
+ Returns a QList containing the \l {QGamepad::}{deviceId}
+ values of the connected gamepads.
+*/
const QList<int> QGamepadManager::connectedGamepads() const
{
Q_D(const QGamepadManager);
return d->connectedGamepads.toList();
}
+/*!
+ Returns a boolean indicating whether configuration
+ is needed for the specified \a deviceId.
+*/
bool QGamepadManager::isConfigurationNeeded(int deviceId) const
{
Q_D(const QGamepadManager);
return d->gamepadBackend->isConfigurationNeeded(deviceId);
}
+/*!
+ Configures the specified \a button on the gamepad with
+ this \a deviceId.
+ Returns \c true in case of success.
+*/
bool QGamepadManager::configureButton(int deviceId, QGamepadManager::GamepadButton button)
{
Q_D(QGamepadManager);
return d->gamepadBackend->configureButton(deviceId, button);
}
+/*!
+ Configures \a axis on the gamepad with the specified \a deviceId.
+ Returns \c true in case of success.
+*/
bool QGamepadManager::configureAxis(int deviceId, QGamepadManager::GamepadAxis axis)
{
Q_D(QGamepadManager);
return d->gamepadBackend->configureAxis(deviceId, axis);
}
+/*!
+ Configures \a button as the cancel button on the gamepad with
+ id \a deviceId.
+ Returns \c true in case of success.
+*/
bool QGamepadManager::setCancelConfigureButton(int deviceId, QGamepadManager::GamepadButton button)
{
Q_D(QGamepadManager);
return d->gamepadBackend->setCancelConfigureButton(deviceId, button);
}
+/*!
+ Resets the configuration on the gamepad with the
+ specified \a deviceId.
+*/
void QGamepadManager::resetConfiguration(int deviceId)
{
Q_D(QGamepadManager);
d->gamepadBackend->resetConfiguration(deviceId);
}
+/*!
+ Sets the name of the \a file that stores the button and axis
+ configuration data.
+*/
void QGamepadManager::setSettingsFile(const QString &file)
{
Q_D(QGamepadManager);
diff --git a/src/plugins/gamepads/android/src/qandroidgamepadbackend_p.h b/src/plugins/gamepads/android/src/qandroidgamepadbackend_p.h
index fdd1619..fc96c9b 100644
--- a/src/plugins/gamepads/android/src/qandroidgamepadbackend_p.h
+++ b/src/plugins/gamepads/android/src/qandroidgamepadbackend_p.h
@@ -78,8 +78,8 @@ public:
bool handleGenericMotionEvent(jobject event) override;
protected:
- bool start();
- void stop();
+ bool start() override;
+ void stop() override;
public:
struct Mapping {
diff --git a/src/plugins/gamepads/xinput/qxinputgamepadbackend.cpp b/src/plugins/gamepads/xinput/qxinputgamepadbackend.cpp
index e9a04a4..4d042c9 100644
--- a/src/plugins/gamepads/xinput/qxinputgamepadbackend.cpp
+++ b/src/plugins/gamepads/xinput/qxinputgamepadbackend.cpp
@@ -138,7 +138,7 @@ void QXInputThread::dispatch(int idx, XINPUT_GAMEPAD *state)
{ XINPUT_GAMEPAD_X, QGamepadManager::ButtonX },
{ XINPUT_GAMEPAD_Y, QGamepadManager::ButtonY }
};
- for (int i = 0; i < sizeof(buttonMap) / sizeof(ButtonMap); ++i) {
+ for (uint i = 0; i < sizeof(buttonMap) / sizeof(ButtonMap); ++i) {
const unsigned short xb = buttonMap[i].xbutton;
unsigned short isDown = state->wButtons & xb;
if (isDown != (m_controllers[idx].buttons & xb)) {