mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 11:23:45 +00:00
Factor out (signed) glueLenghValidator
This commit is contained in:
parent
2244ac3dee
commit
112c2c3d0e
@ -894,9 +894,7 @@ GuiDocument::GuiDocument(GuiView & lv)
|
|||||||
textLayoutModule->indentLE->setValidator(new LengthValidator(
|
textLayoutModule->indentLE->setValidator(new LengthValidator(
|
||||||
textLayoutModule->indentLE, false));
|
textLayoutModule->indentLE, false));
|
||||||
// parskip accepts glue length
|
// parskip accepts glue length
|
||||||
LengthValidator * skipLEValidator = new LengthValidator(textLayoutModule->skipLE, false);
|
textLayoutModule->skipLE->setValidator(glueLengthValidator(textLayoutModule->skipLE));
|
||||||
skipLEValidator->setBottom(GlueLength());
|
|
||||||
textLayoutModule->skipLE->setValidator(skipLEValidator);
|
|
||||||
|
|
||||||
textLayoutModule->indentCO->addItem(qt_("Default"), toqstr("default"));
|
textLayoutModule->indentCO->addItem(qt_("Default"), toqstr("default"));
|
||||||
textLayoutModule->indentCO->addItem(qt_("Custom"), toqstr("custom"));
|
textLayoutModule->indentCO->addItem(qt_("Custom"), toqstr("custom"));
|
||||||
|
@ -56,10 +56,7 @@ GuiLine::GuiLine(QWidget * parent) : InsetParamsWidget(parent)
|
|||||||
addCheckedWidget(WidthLE, WidthValueL);
|
addCheckedWidget(WidthLE, WidthValueL);
|
||||||
addCheckedWidget(HeightLE, HeightValueL);
|
addCheckedWidget(HeightLE, HeightValueL);
|
||||||
|
|
||||||
// Set up a signed glue length validator
|
OffsetLE->setValidator(glueLengthValidator(OffsetLE));
|
||||||
LengthValidator * v = new LengthValidator(OffsetLE);
|
|
||||||
v->setBottom(GlueLength());
|
|
||||||
OffsetLE->setValidator(v);
|
|
||||||
WidthLE->setValidator(unsignedGlueLengthValidator(WidthLE));
|
WidthLE->setValidator(unsignedGlueLengthValidator(WidthLE));
|
||||||
HeightLE->setValidator(unsignedGlueLengthValidator(HeightLE));
|
HeightLE->setValidator(unsignedGlueLengthValidator(HeightLE));
|
||||||
|
|
||||||
|
@ -53,10 +53,7 @@ GuiVSpace::GuiVSpace(QWidget * parent) : InsetParamsWidget(parent)
|
|||||||
connect(spacingCO, SIGNAL(activated(int)),
|
connect(spacingCO, SIGNAL(activated(int)),
|
||||||
this, SLOT(enableCustom(int)));
|
this, SLOT(enableCustom(int)));
|
||||||
|
|
||||||
// Set up a signed glue length validator
|
valueLE->setValidator(glueLengthValidator(valueLE));
|
||||||
LengthValidator * v = new LengthValidator(valueLE);
|
|
||||||
v->setBottom(GlueLength());
|
|
||||||
valueLE->setValidator(v);
|
|
||||||
|
|
||||||
// initialize the length validator
|
// initialize the length validator
|
||||||
addCheckedWidget(valueLE, valueL);
|
addCheckedWidget(valueLE, valueL);
|
||||||
|
@ -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)
|
LengthAutoValidator::LengthAutoValidator(QWidget * parent, QString const & autotext)
|
||||||
: LengthValidator(parent),
|
: LengthValidator(parent),
|
||||||
autotext_(autotext)
|
autotext_(autotext)
|
||||||
|
@ -86,6 +86,11 @@ LengthValidator * unsignedLengthValidator(QLineEdit *);
|
|||||||
*/
|
*/
|
||||||
LengthValidator * unsignedGlueLengthValidator(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()
|
/** A class to ascertain whether the data passed to the @c validate()
|
||||||
* member function can be interpreted as a GlueLength or is @param autotext.
|
* member function can be interpreted as a GlueLength or is @param autotext.
|
||||||
|
Loading…
Reference in New Issue
Block a user