+ QLocale loc;
+ bool ok;
+ double d = loc.toDouble(qtext.trimmed(), &ok);
+ // QLocale::toDouble accepts something like "1."
+ // We don't.
+ bool dp = qtext.endsWith(loc.decimalPoint());
+ if (!ok) {
+ // Fall back to C
+ QLocale c(QLocale::C);
+ d = c.toDouble(qtext.trimmed(), &ok);
+ dp = qtext.endsWith(c.decimalPoint());
+ }
+
+ if (ok && unsigned_ && d < 0)
+ return QValidator::Invalid;
+
+ if (qtext.isEmpty() || (ok && !dp))