X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiHSpace.cpp;h=07b98aee23b6064f0734e0a9d6f7bf30fe52215c;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=63bccc5ff1c7412d19db9682cb217514036e6f96;hpb=26751d83eee71188fd5501c557e47d504e79aae8;p=lyx.git diff --git a/src/frontends/qt4/GuiHSpace.cpp b/src/frontends/qt4/GuiHSpace.cpp index 63bccc5ff1..07b98aee23 100644 --- a/src/frontends/qt4/GuiHSpace.cpp +++ b/src/frontends/qt4/GuiHSpace.cpp @@ -57,7 +57,10 @@ GuiHSpace::GuiHSpace(GuiView & lv, bool math) connect(fillPatternCO, SIGNAL(activated(int)), this, SLOT(patternChanged())); - valueLE->setValidator(unsignedLengthValidator(valueLE)); + if (params_.math) + valueLE->setValidator(unsignedLengthValidator(valueLE)); + else + valueLE->setValidator(unsignedGlueLengthValidator(valueLE)); // Manage the ok, apply, restore and cancel/close buttons bc().setPolicy(ButtonPolicy::OkApplyCancelReadOnlyPolicy); @@ -74,9 +77,6 @@ GuiHSpace::GuiHSpace(GuiView & lv, bool math) // initialize the length validator bc().addCheckedLineEdit(valueLE, valueL); - - // remove the %-items from the unit choice - unitCO->noPercents(); } @@ -248,9 +248,10 @@ static void setWidgetsFromHSpace(InsetSpaceParams const & params, keep->setChecked(protect); Length::UNIT const default_unit = Length::defaultUnit(); - if (item == (params.math ? 9 : 7)) - lengthToWidgets(value, unit, params.length, default_unit); - else + if (item == (params.math ? 9 : 7)) { + string length = params.length.asString(); + lengthToWidgets(value, unit, length, default_unit); + } else lengthToWidgets(value, unit, "", default_unit); } @@ -272,7 +273,7 @@ static InsetSpaceParams setHSpaceFromWidgets(int spacing, case 8: params.kind = InsetSpaceParams::QQUAD; break; case 9: params.kind = InsetSpaceParams::CUSTOM; - params.length = Length(widgetsToLength(value, unit)); + params.length = GlueLength(widgetsToLength(value, unit)); break; } return params; @@ -326,7 +327,7 @@ static InsetSpaceParams setHSpaceFromWidgets(int spacing, params.kind = InsetSpaceParams::CUSTOM_PROTECTED; else params.kind = InsetSpaceParams::CUSTOM; - params.length = Length(widgetsToLength(value, unit)); + params.length = GlueLength(widgetsToLength(value, unit)); break; } return params;