X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FValidator.h;h=36250bbdca924721211af2eb446d1e4a39937803;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=ee3ae343697d3d76c8d01d90acdcddf1c3e77225;hpb=d93679c1db2692a85637f2db08b605e16ab29c8b;p=lyx.git diff --git a/src/frontends/qt4/Validator.h b/src/frontends/qt4/Validator.h index ee3ae34369..36250bbdca 100644 --- a/src/frontends/qt4/Validator.h +++ b/src/frontends/qt4/Validator.h @@ -75,44 +75,52 @@ private: /// @returns a new @c LengthValidator that does not accept negative lengths. LengthValidator * unsignedLengthValidator(QLineEdit *); -//FIXME This should be generalized to take "text" as part of the -//constructor and so to set what text we check for, rather than -//hard-coding it as "auto". But see qt_helpers.h for reasons this -//is not so trivial and an idea about how to do it. (RGH) + +/** @returns a new @c LengthValidator that does not accept negative lengths. + * but glue lengths. + */ +LengthValidator * unsignedGlueLengthValidator(QLineEdit *); + + /** A class to ascertain whether the data passed to the @c validate() - * member function can be interpretted as a GlueLength or is "auto". + * member function can be interpretted as a GlueLength or is @param autotext. */ class LengthAutoValidator : public LengthValidator { Q_OBJECT public: /// Define a validator for widget @c parent. - LengthAutoValidator(QWidget * parent); + LengthAutoValidator(QWidget * parent, QString const autotext); /** @returns QValidator::Acceptable if @c data is a GlueLength * or is "auto". If not, returns QValidator::Intermediate. */ QValidator::State validate(QString & data, int &) const; + +private: + QString autotext_; }; /// @returns a new @c LengthAutoValidator that does not accept negative lengths. -LengthAutoValidator * unsignedLengthAutoValidator(QLineEdit *); +LengthAutoValidator * unsignedLengthAutoValidator(QLineEdit *, QString const autotext); -//FIXME As above, this should really take a text argument. /** * A class to determine whether the passed is a double - * or is "auto". + * or is @param autotext. * */ class DoubleAutoValidator : public QDoubleValidator { Q_OBJECT public: - DoubleAutoValidator(QWidget * parent); + DoubleAutoValidator(QWidget * parent, QString const autotext); DoubleAutoValidator(double bottom, double top, int decimals, QObject * parent); QValidator::State validate(QString & input, int & pos) const; + +private: + QString autotext_; };