Commit ec11971d authored by Gus Grubba's avatar Gus Grubba

Handle unit

parent 66c2a33f
...@@ -14,6 +14,7 @@ import QtQuick.Controls.Styles 1.4 ...@@ -14,6 +14,7 @@ import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.2 import QtQuick.Layouts 1.2
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import QGroundControl 1.0
import QGroundControl.FactSystem 1.0 import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0 import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
...@@ -197,7 +198,7 @@ SetupPage { ...@@ -197,7 +198,7 @@ SetupPage {
} }
QGCLabel { QGCLabel {
text: qsTr("Minimum Distance:") text: qsTr("Minimum Distance: (") + QGroundControl.appSettingsDistanceUnitsString + ")"
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
} }
...@@ -208,20 +209,24 @@ SetupPage { ...@@ -208,20 +209,24 @@ SetupPage {
Layout.minimumHeight: ScreenTools.defaultFontPixelHeight * 2 Layout.minimumHeight: ScreenTools.defaultFontPixelHeight * 2
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
maximumValue: 15 maximumValue: QGroundControl.metersToAppSettingsDistanceUnits(15)
minimumValue: 0 minimumValue: QGroundControl.metersToAppSettingsDistanceUnits(1)
stepSize: 1 stepSize: 1
displayValue: true displayValue: true
updateValueWhileDragging: false updateValueWhileDragging: false
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
//-- Looking at raw value on purpose. I don't know how to handle the value: {
// slider range when not using metric system. if (_collisionPrevention && _collisionPrevention.rawValue > 0) {
value: (_collisionPrevention && _collisionPrevention.rawValue > 0) ? _collisionPrevention.rawValue : 0 return QGroundControl.metersToAppSettingsDistanceUnits(_collisionPrevention.rawValue)
} else {
return 1;
}
}
onValueChanged: { onValueChanged: {
if(_collisionPrevention) { if(_collisionPrevention) {
//-- Negative means disabled //-- Negative means disabled
if(_collisionPrevention.rawValue >= 0) { if(_collisionPrevention.rawValue >= 0) {
_collisionPrevention.rawValue = value _collisionPrevention.rawValue = QGroundControl.appSettingsDistanceUnitsToMeters(value)
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment