connect(fillPatternCO, SIGNAL(activated(int)),
this, SLOT(changedSlot()));
+ // Set up a signed (glue) length validator
+ LengthValidator * v = new LengthValidator(valueLE);
if (math_mode_)
- valueLE->setValidator(unsignedLengthValidator(valueLE));
+ v->setBottom(Length());
else
- valueLE->setValidator(unsignedGlueLengthValidator(valueLE));
+ v->setBottom(GlueLength());
+ valueLE->setValidator(v);
// initialize the length validator
addCheckedWidget(valueLE, valueL);
}
-void GuiHSpace::enableWidgets()
+void GuiHSpace::enableWidgets() const
{
QString const selection = spacingCO->itemData(spacingCO->currentIndex()).toString();
bool const custom = selection == "custom";
valueLE->setEnabled(custom);
+ if (custom)
+ valueLE->setFocus();
+ valueL->setEnabled(custom);
unitCO->setEnabled(custom);
fillPatternCO->setEnabled(!math_mode_ && selection == "hfill");
+ fillPatternL->setEnabled(!math_mode_ && selection == "hfill");
bool const no_pattern = fillPatternCO->currentIndex() == 0 || math_mode_;
bool const enable_keep =
- selection == "normal" || selection == "halfquad" || (selection == "hfill" && no_pattern) || custom;
+ selection == "normal" || selection == "halfquad"
+ || (selection == "hfill" && no_pattern) || custom;
keepCB->setEnabled(enable_keep);
+ keepL->setEnabled(enable_keep);
}
}
-bool GuiHSpace::checkWidgets() const
+bool GuiHSpace::checkWidgets(bool readonly) const
{
+ valueLE->setReadOnly(readonly);
+
+ if (readonly) {
+ spacingCO->setEnabled(false);
+ unitCO->setEnabled(false);
+ fillPatternCO->setEnabled(false);
+ keepCB->setEnabled(false);
+ valueLE->setEnabled(false);
+ } else
+ enableWidgets();
+
if (!InsetParamsWidget::checkWidgets())
return false;
return spacingCO->itemData(spacingCO->currentIndex()).toString() != "custom"