]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/Validator.h
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / Validator.h
index ee3ae343697d3d76c8d01d90acdcddf1c3e77225..36250bbdca924721211af2eb446d1e4a39937803 100644 (file)
@@ -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_;
 };