[PATCH] Mark Air/Water temp field red for wrong input.

Miika Turkia miika.turkia at gmail.com
Sat Apr 12 09:02:54 PDT 2014


On Sat, Apr 12, 2014 at 6:04 PM, Yosef Hamza <jo.adam.93 at gmail.com> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140412/35b97751/attachment.html>


More information about the subsurface mailing list