On Sat, Apr 12, 2014 at 6:04 PM, Yosef Hamza <[email protected]> wrote:

> As a warining for the user mark the field red.
> if user inputs invaild input that will be ignored
> while parsing.
>

The pattern matching is a bit broken. E.g. following input for temperature
is accepted:
2 8.5°C fff  asfdf ,

If the input contains ° or , characters, then it is accepted, no matter
what else is in it. I would go for a single regexp pattern that includes
all valid inputs. Something like this:

    if
(!text.contains(QRegExp("^[-+]{0,1}[0-9]+([,.][0-9]+){0,1}(°[CF]){0,1}$")))
{

This matches the full input field and allows optionally different parts of
temperature to be given. I am not sure if the unit makes sense after the
degree sign, as it is not parsed but the configured unit is used instead.

miika
_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to