Compare commits

...

2 Commits

Author SHA1 Message Date
Juergen Spitzmueller
112c2c3d0e Factor out (signed) glueLenghValidator 2024-09-25 10:22:36 +02:00
Juergen Spitzmueller
2244ac3dee Allow negative offset in GuiLine (#13102) 2024-09-25 09:53:00 +02:00
5 changed files with 17 additions and 8 deletions

View File

@ -894,9 +894,7 @@ GuiDocument::GuiDocument(GuiView & lv)
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"));

View File

@ -56,7 +56,7 @@ GuiLine::GuiLine(QWidget * parent) : InsetParamsWidget(parent)
addCheckedWidget(WidthLE, WidthValueL);
addCheckedWidget(HeightLE, HeightValueL);
OffsetLE->setValidator(unsignedGlueLengthValidator(OffsetLE));
OffsetLE->setValidator(glueLengthValidator(OffsetLE));
WidthLE->setValidator(unsignedGlueLengthValidator(WidthLE));
HeightLE->setValidator(unsignedGlueLengthValidator(HeightLE));

View File

@ -53,10 +53,7 @@ GuiVSpace::GuiVSpace(QWidget * parent) : InsetParamsWidget(parent)
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);

View File

@ -134,6 +134,15 @@ LengthValidator * unsignedGlueLengthValidator(QLineEdit * ed)
}
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)

View File

@ -86,6 +86,11 @@ LengthValidator * unsignedLengthValidator(QLineEdit *);
*/
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.