Skip to content

Commit

Permalink
Fixes for joystick event handling in QML
Browse files Browse the repository at this point in the history
This update changes the method signatures for "onAxisValueChanged", "onRawButtonPressedChanged", and "onAxisValues" events in QML according to Qt6 requirements. Each event now directly accepts the necessary arguments.
  • Loading branch information
s-lisovenko authored and julianoes committed Apr 11, 2024
1 parent 752bee4 commit 5b5a18c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/VehicleSetup/JoystickConfigButtons.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ColumnLayout {

Connections {
target: _activeJoystick
onRawButtonPressedChanged: {
onRawButtonPressedChanged: (index, pressed) => {
if (buttonActionRepeater.itemAt(index)) {
buttonActionRepeater.itemAt(index).pressed = pressed
}
Expand All @@ -40,7 +40,6 @@ ColumnLayout {
ColumnLayout {
id: flowColumn
width: parent.width
anchors.centerIn: parent
spacing: ScreenTools.defaultFontPixelHeight

// Note for reminding the use of multiple buttons for the same action
Expand Down
2 changes: 1 addition & 1 deletion src/VehicleSetup/JoystickConfigCalibration.qml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Item {
anchors.verticalCenter: parent.verticalCenter
Connections {
target: controller
onAxisValueChanged: {
onAxisValueChanged: (axis, value) => {
if (axisMonitorRepeater.itemAt(axis)) {
axisMonitorRepeater.itemAt(axis).axis.axisValue = value
}
Expand Down
2 changes: 1 addition & 1 deletion src/VehicleSetup/JoystickConfigGeneral.qml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ Item {

Connections {
target: _activeJoystick
onAxisValues: {
onAxisValues: (roll, pitch, yaw, throttle) => {
rollAxis.axisValue = roll * 32768.0
pitchAxis.axisValue = pitch * 32768.0
yawAxis.axisValue = yaw * 32768.0
Expand Down

0 comments on commit 5b5a18c

Please sign in to comment.