Browse Source

Add numericValuesOnly support

QGC4.4
Don Gagne 2 years ago committed by Don Gagne
parent
commit
26f9b4805a
  1. 13
      src/FactSystem/FactControls/FactTextField.qml
  2. 4
      src/QmlControls/QGCTextField.qml

13
src/FactSystem/FactControls/FactTextField.qml

@ -11,10 +11,11 @@ import QGroundControl.ScreenTools 1.0 @@ -11,10 +11,11 @@ import QGroundControl.ScreenTools 1.0
QGCTextField {
id: _textField
text: fact ? fact.valueString : ""
unitsLabel: fact ? fact.units : ""
showUnits: true
showHelp: true
text: fact ? fact.valueString : ""
unitsLabel: fact ? fact.units : ""
showUnits: true
showHelp: true
numericValuesOnly: fact && !fact.typeIsString
signal updated()
@ -22,10 +23,6 @@ QGCTextField { @@ -22,10 +23,6 @@ QGCTextField {
property string _validateString
inputMethodHints: ((fact && fact.typeIsString) || ScreenTools.isiOS) ?
Qt.ImhNone : // iOS numeric keyboard has no done button, we can't use it
Qt.ImhFormattedNumbersOnly // Forces use of virtual numeric keyboard
onEditingFinished: {
var errorString = fact.validate(text, false /* convertOnly */)
if (errorString === "") {

4
src/QmlControls/QGCTextField.qml

@ -12,11 +12,15 @@ TextField { @@ -12,11 +12,15 @@ TextField {
implicitHeight: ScreenTools.implicitTextFieldHeight
activeFocusOnPress: true
antialiasing: true
inputMethodHints: numericValuesOnly && !ScreenTools.isiOS ?
Qt.ImhNone : // iOS numeric keyboard has no done button, we can't use it.
Qt.ImhFormattedNumbersOnly // Forces use of virtual numeric keyboard instead of full keyboard
property bool showUnits: false
property bool showHelp: false
property string unitsLabel: ""
property string extraUnitsLabel: ""
property bool numericValuesOnly: false // true: Used as hint for mobile devices to show numeric only keyboard
signal helpClicked

Loading…
Cancel
Save