From 2edda6802188723a93292ce0f5462fc91ba58925 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Fri, 5 Aug 2016 15:12:13 +0200 Subject: [PATCH] Improve validator for numeric fields Do not accept fractional input for "int" settings Also only accept a "-" as the first character --- resources/qml/Settings/SettingTextField.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Settings/SettingTextField.qml b/resources/qml/Settings/SettingTextField.qml index 18a55c7a50..4d05bef2b9 100644 --- a/resources/qml/Settings/SettingTextField.qml +++ b/resources/qml/Settings/SettingTextField.qml @@ -100,7 +100,7 @@ SettingItem maximumLength: 10; - validator: RegExpValidator { regExp: /[0-9.,-]{0,10}/ } + validator: RegExpValidator { regExp: (type == "int") ? /^-?[0-9]{0,10}/ : /^-?[0-9.,]{0,10}/ } //"type" property from parent loader used to disallow fractional number entry Binding {