From f712461c8fe64dff5532b161fab3b59ba13fa8ba Mon Sep 17 00:00:00 2001 From: Ajinkya Dahale Date: Tue, 8 Feb 2022 15:07:43 -0500 Subject: [PATCH] [Sketcher] Fix some points mentioned in #6323 Knot insertions dialog uses decimal precision from preferences. Sets the spinbox step for knot insertion dialog such that it goes from min to max knot in 1000 steps. Removes the mention of multiplicity option from the tooltip. --- src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp b/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp index 71a1ad29d9..a4fb1168b0 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp @@ -32,6 +32,7 @@ #endif #include +#include #include #include #include @@ -979,7 +980,7 @@ CmdSketcherInsertKnot::CmdSketcherInsertKnot() sAppModule = "Sketcher"; sGroup = "Sketcher"; sMenuText = QT_TR_NOOP("Insert knot"); - sToolTipText = QT_TR_NOOP("Inserts knot at given parameter with the given multiplicity. If a knot already exists at that parameter, it's multiplicity is increased by the value."); + sToolTipText = QT_TR_NOOP("Inserts knot at given parameter. If a knot already exists at that parameter, it's multiplicity is increased by one."); sWhatsThis = "Sketcher_BSplineInsertKnot"; sStatusTip = sToolTipText; sPixmap = "Sketcher_BSplineInsertKnot"; @@ -1039,7 +1040,7 @@ void CmdSketcherInsertKnot::activated(int iMsg) const auto& mults = bsp->getMultiplicities(); QInputDialog knotDialog(Gui::getMainWindow()); knotDialog.setInputMode(QInputDialog::DoubleInput); - knotDialog.setDoubleDecimals(8); + knotDialog.setDoubleDecimals(Base::UnitsApi::getDecimals()); knotDialog.setWindowTitle(QObject::tr("Knot parameter")); // use values from `knots` and `weights` and insert in label std::stringstream knotList; @@ -1055,6 +1056,8 @@ void CmdSketcherInsertKnot::activated(int iMsg) .arg(QString::fromUtf8(multList.str().c_str()))); // use an appropriate middle value from `knots` knotDialog.setDoubleValue(0.5 * (knots.front() + knots.back())); + // set step size dependent on the knot range + knotDialog.setDoubleStep(0.001 * (knots.back() - knots.front())); // use min/max from `knots` knotDialog.setDoubleRange(knots.front(), knots.back());