From 55a37897c0cc4a4b0dba0bec3aebf08de93b62c7 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Wed, 21 Jul 2021 11:29:17 +0200 Subject: [PATCH] remote control all 4 wheels --- qml/RemoteControl.qml | 49 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/qml/RemoteControl.qml b/qml/RemoteControl.qml index 486561e..5a2132f 100644 --- a/qml/RemoteControl.qml +++ b/qml/RemoteControl.qml @@ -1,4 +1,5 @@ import QtQuick 2.15 +import QtQuick.Controls 2.15 GamePage { id: remoteControlPage @@ -22,11 +23,10 @@ GamePage { radius: GameSettings.buttonRadius color: GameSettings.viewColor - property real maxSpeed: 100 - property real remoteControlFrontLeft: maxSpeed * handler.relativeY * (handler.relativeX < 0 ? 1 + handler.relativeX : 1) - property real remoteControlFrontRight: maxSpeed * handler.relativeY * (handler.relativeX > 0 ? 1 - handler.relativeX : 1) - property real remoteControlBackLeft: 0 - property real remoteControlBackRight: 0 + property real remoteControlFrontLeft: (handler.relativeX * frontLeftRightSpinbox.value) + (handler.relativeY * frontUpDownSpinbox.value) + property real remoteControlFrontRight: (-handler.relativeX * frontLeftRightSpinbox.value) + (handler.relativeY * frontUpDownSpinbox.value) + property real remoteControlBackLeft: (handler.relativeX * backLeftRightSpinbox.value) + (handler.relativeY * backUpDownSpinbox.value) + property real remoteControlBackRight: (-handler.relativeX * backLeftRightSpinbox.value) + (handler.relativeY * backUpDownSpinbox.value) onRemoteControlFrontLeftChanged: deviceHandler.remoteControlFrontLeft = remoteControlFrontLeft onRemoteControlFrontRightChanged: deviceHandler.remoteControlFrontRight = remoteControlFrontRight @@ -78,4 +78,43 @@ GamePage { onActiveChanged: deviceHandler.remoteControlActive = handler.active } } + + Grid { + anchors.top: container.bottom + anchors.left: container.left + anchors.right: container.right + columns: 2 + + SpinBox { + id: frontLeftRightSpinbox + value: 100 + editable: true + from: 0 + to: 1000 + } + + SpinBox { + id: frontUpDownSpinbox + value: 100 + editable: true + from: 0 + to: 1000 + } + + SpinBox { + id: backLeftRightSpinbox + value: 100 + editable: true + from: 0 + to: 1000 + } + + SpinBox { + id: backUpDownSpinbox + value: 100 + editable: true + from: 0 + to: 1000 + } + } }