From 3020ec058fe5f1c10e0a16006974e89a812d3eb4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Sun, 19 Jul 2009 16:53:50 +0000 Subject: [PATCH] * Validator.{cpp, h}: - add usignedGlueLengthValidator * GuiVSpace.cpp: - re-allow the insertion of glue lengths (regression of the qt4 frontend) (bug 6097) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30692 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiVSpace.cpp | 2 +- src/frontends/qt4/Validator.cpp | 8 ++++++++ src/frontends/qt4/Validator.h | 7 +++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/frontends/qt4/GuiVSpace.cpp b/src/frontends/qt4/GuiVSpace.cpp index 995393a979..9df86fe318 100644 --- a/src/frontends/qt4/GuiVSpace.cpp +++ b/src/frontends/qt4/GuiVSpace.cpp @@ -59,7 +59,7 @@ GuiVSpace::GuiVSpace(GuiView & lv) connect(unitCO, SIGNAL(selectionChanged(lyx::Length::UNIT)), this, SLOT(change_adaptor())); - valueLE->setValidator(unsignedLengthValidator(valueLE)); + valueLE->setValidator(unsignedGlueLengthValidator(valueLE)); // Manage the ok, apply, restore and cancel/close buttons bc().setPolicy(ButtonPolicy::OkApplyCancelReadOnlyPolicy); diff --git a/src/frontends/qt4/Validator.cpp b/src/frontends/qt4/Validator.cpp index 59655eb004..e156dcb099 100644 --- a/src/frontends/qt4/Validator.cpp +++ b/src/frontends/qt4/Validator.cpp @@ -89,6 +89,14 @@ LengthValidator * unsignedLengthValidator(QLineEdit * ed) } +LengthValidator * unsignedGlueLengthValidator(QLineEdit * ed) +{ + LengthValidator * v = new LengthValidator(ed); + v->setBottom(GlueLength()); + return v; +} + + LengthAutoValidator::LengthAutoValidator(QWidget * parent, QString const autotext) : LengthValidator(parent), autotext_(autotext) diff --git a/src/frontends/qt4/Validator.h b/src/frontends/qt4/Validator.h index 81e46b0f57..36250bbdca 100644 --- a/src/frontends/qt4/Validator.h +++ b/src/frontends/qt4/Validator.h @@ -75,6 +75,13 @@ private: /// @returns a new @c LengthValidator that does not accept negative lengths. LengthValidator * unsignedLengthValidator(QLineEdit *); + +/** @returns a new @c LengthValidator that does not accept negative lengths. + * but glue lengths. + */ +LengthValidator * unsignedGlueLengthValidator(QLineEdit *); + + /** A class to ascertain whether the data passed to the @c validate() * member function can be interpretted as a GlueLength or is @param autotext. */ -- 2.39.2