textLayoutModule->indentLE->setValidator(new LengthValidator(
textLayoutModule->indentLE, false));
// parskip accepts glue length
- LengthValidator * skipLEValidator = new LengthValidator(textLayoutModule->skipLE, false);
- skipLEValidator->setBottom(GlueLength());
- textLayoutModule->skipLE->setValidator(skipLEValidator);
+ textLayoutModule->skipLE->setValidator(glueLengthValidator(textLayoutModule->skipLE));
textLayoutModule->indentCO->addItem(qt_("Default"), toqstr("default"));
textLayoutModule->indentCO->addItem(qt_("Custom"), toqstr("custom"));
addCheckedWidget(WidthLE, WidthValueL);
addCheckedWidget(HeightLE, HeightValueL);
- // Set up a signed glue length validator
- LengthValidator * v = new LengthValidator(OffsetLE);
- v->setBottom(GlueLength());
- OffsetLE->setValidator(v);
+ OffsetLE->setValidator(glueLengthValidator(OffsetLE));
WidthLE->setValidator(unsignedGlueLengthValidator(WidthLE));
HeightLE->setValidator(unsignedGlueLengthValidator(HeightLE));
connect(spacingCO, SIGNAL(activated(int)),
this, SLOT(enableCustom(int)));
- // Set up a signed glue length validator
- LengthValidator * v = new LengthValidator(valueLE);
- v->setBottom(GlueLength());
- valueLE->setValidator(v);
+ valueLE->setValidator(glueLengthValidator(valueLE));
// initialize the length validator
addCheckedWidget(valueLE, valueL);
}
+LengthValidator * glueLengthValidator(QLineEdit * ed)
+{
+ LengthValidator * v = new LengthValidator(ed);
+ v->setBottom(GlueLength());
+ v->setUnsigned(false);
+ return v;
+}
+
+
LengthAutoValidator::LengthAutoValidator(QWidget * parent, QString const & autotext)
: LengthValidator(parent),
autotext_(autotext)
*/
LengthValidator * unsignedGlueLengthValidator(QLineEdit *);
+/** @returns a new @c LengthValidator that does accept negative lengths
+ * and glue lengths.
+ */
+LengthValidator * glueLengthValidator(QLineEdit *);
+
/** A class to ascertain whether the data passed to the @c validate()
* member function can be interpreted as a GlueLength or is @param autotext.