diff --git a/src/FactSystem/FactControls/FactTextField.qml b/src/FactSystem/FactControls/FactTextField.qml index a4cb05aefed..d44cbda2436 100644 --- a/src/FactSystem/FactControls/FactTextField.qml +++ b/src/FactSystem/FactControls/FactTextField.qml @@ -19,7 +19,9 @@ QGCTextField { property Fact fact: null - onEditingFinished: { + onEditingFinished: _onEditingFinished() + + function _onEditingFinished() { var errorString = fact.validate(text, false /* convertOnly */) if (errorString === "") { clearValidationError() diff --git a/src/UI/MainRootWindow.qml b/src/UI/MainRootWindow.qml index 1d8827e7ed1..96852578700 100644 --- a/src/UI/MainRootWindow.qml +++ b/src/UI/MainRootWindow.qml @@ -16,6 +16,7 @@ import QtQuick.Window import QGroundControl import QGroundControl.Palette import QGroundControl.Controls +import QGroundControl.FactControls import QGroundControl.ScreenTools import QGroundControl.FlightDisplay import QGroundControl.FlightMap @@ -113,8 +114,8 @@ ApplicationWindow { // This function is used to prevent view switching if there are validation errors function allowViewSwitch(previousValidationErrorCount = 0) { // Run validation on active focus control to ensure it is valid before switching views - if (mainWindow.activeFocusControl instanceof QGCTextField) { - mainWindow.activeFocusControl.onEditingFinished() + if (mainWindow.activeFocusControl instanceof FactTextField) { + mainWindow.activeFocusControl._onEditingFinished() } return globals.validationErrorCount <= previousValidationErrorCount }