X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FValidator.cpp;h=e156dcb099dedbe83a86326438d197cae0c494b3;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=34141894971f0ca8020f2556b2adacc1909a9be3;hpb=94442d8b30c779b37b5147a189549a5eb40c6076;p=lyx.git diff --git a/src/frontends/qt4/Validator.cpp b/src/frontends/qt4/Validator.cpp index 3414189497..e156dcb099 100644 --- a/src/frontends/qt4/Validator.cpp +++ b/src/frontends/qt4/Validator.cpp @@ -24,6 +24,7 @@ #include "support/lstrings.h" #include +#include #include using namespace std; @@ -39,10 +40,13 @@ LengthValidator::LengthValidator(QWidget * parent) QValidator::State LengthValidator::validate(QString & qtext, int &) const { - string const text = fromqstr(qtext); - if (text.empty() || support::isStrDbl(text)) + bool ok; + qtext.trimmed().toDouble(&ok); + if (qtext.isEmpty() || ok) return QValidator::Acceptable; + string const text = fromqstr(qtext); + if (glue_length_) { GlueLength gl; return (isValidGlueLength(text, &gl)) ? @@ -85,6 +89,14 @@ LengthValidator * unsignedLengthValidator(QLineEdit * ed) } +LengthValidator * unsignedGlueLengthValidator(QLineEdit * ed) +{ + LengthValidator * v = new LengthValidator(ed); + v->setBottom(GlueLength()); + return v; +} + + LengthAutoValidator::LengthAutoValidator(QWidget * parent, QString const autotext) : LengthValidator(parent), autotext_(autotext)