2 * \file lengthvalidator.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Angus Leeming
8 * Full author contact details are available in file CREDITS.
14 #include "lengthvalidator.h"
16 #include "support/lstrings.h"
18 #include "qt_helpers.h"
23 using lyx::support::isStrDbl;
27 LengthValidator::LengthValidator(QWidget * parent, const char * name)
28 : QValidator(parent, name),
33 QValidator::State LengthValidator::validate(QString & qtext, int &) const
35 string const text = fromqstr(qtext);
36 if (text.empty() || isStrDbl(text))
37 return QValidator::Acceptable;
40 bool const valid_length = isValidLength(text, &l);
42 return QValidator::Intermediate;
45 return QValidator::Acceptable;
47 return b_.inPixels(100) <= l.inPixels(100) ?
48 QValidator::Acceptable : QValidator::Intermediate;
52 void LengthValidator::setBottom(LyXLength b)