From f229dc014c4599d689c2078e6771012face50447 Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Tue, 8 Feb 2022 14:33:08 +0100 Subject: [PATCH] Fixing bug with TextInput allowing unallowed characters. --- .../qml/eu/ad5001/LogarithmPlotter/Setting/TextSetting.qml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/TextSetting.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/TextSetting.qml index 6c1c355..54a4e82 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/TextSetting.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/TextSetting.qml @@ -112,6 +112,9 @@ Item { verticalAlignment: TextInput.AlignVCenter horizontalAlignment: control.label == "" ? TextInput.AlignLeft : TextInput.AlignHCenter color: sysPalette.windowText + validator: RegExpValidator { + regExp: control.isInt ? /-?[0-9]+/ : control.isDouble ? /-?[0-9]+(\.[0-9]+)?/ : /.+/ + } focus: true text: control.defValue selectByMouse: true