Copy link
@SebastienPeillet

SebastienPeillet Nov 5, 2020

Contributor

It seems you are right, I guess I had some troubles with the thousands separator before removing it from the validator. But as it is the validator valids the value even if there is too much decimal.

This should work instead :

const QString PERMISSIVE_DOUBLE = R"(-?[\d]{0,1000}([\.%1][\d]{0,1000}e[+-]?[\d]{0,1000}|[\.%1][\d]{0,%2})?)";

or even :

const QString PERMISSIVE_DOUBLE = R"(-?[\d]{0,1000}([\.\%1][\d]{0,%2})?(e[+-]?[\d]{0,1000})?)";

if we choose to limit decimal in scientific notation, even if the value is a high number, but I'm not sure it's a good idea as it can round great number.

Notice that the value will return a Intermediate validation in validate function, and we can use it in toDouble to round value on the decimal