diff --git a/src/Mod/Sketcher/Gui/DrawSketchDefaultWidgetController.h b/src/Mod/Sketcher/Gui/DrawSketchDefaultWidgetController.h index b9e210e947..4adeeb07be 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchDefaultWidgetController.h +++ b/src/Mod/Sketcher/Gui/DrawSketchDefaultWidgetController.h @@ -456,13 +456,14 @@ private: /// Syncs the construction method selection in the combobox to the handler selection void syncConstructionMethodComboboxToHandler() { - if constexpr (PFirstComboboxIsConstructionMethod == true) { auto constructionmethod = toolWidget->getComboboxIndex(WCombobox::FirstCombo); auto actualconstructionmethod = static_cast(handler->constructionMethod()); if (constructionmethod != actualconstructionmethod) { + boost::signals2::shared_connection_block combobox_block( + connectionComboboxSelectionChanged); toolWidget->setComboboxIndex(WCombobox::FirstCombo, actualconstructionmethod); } } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerBSpline.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerBSpline.h index f2c7b51bff..34819c4c0f 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerBSpline.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerBSpline.h @@ -890,14 +890,21 @@ void DSHBSplineController::configureToolWidget() toolWidget->setParameterLabel( WParameter::First, QApplication::translate("ToolWidgetManager_p4", "Degree (+'U'/ -'J')")); - toolWidget->setParameter(WParameter::First, handler->SplineDegree); toolWidget->configureParameterUnit(WParameter::First, Base::Unit()); toolWidget->configureParameterMin(WParameter::First, 1.0); // NOLINT - // We set a reasonable max to avoid the spinbox from being very large + toolWidget->configureParameterMax(WParameter::First, Geom_BSplineCurve::MaxDegree()); toolWidget->configureParameterDecimals(WParameter::First, 0); } - toolWidget->configureParameterMax(WParameter::First, Geom_BSplineCurve::MaxDegree()); // NOLINT + if (handler->constructionMethod() == ConstructionMethod::ControlPoints) { + toolWidget->setParameter(WParameter::First, handler->SplineDegree); + toolWidget->setParameterVisible(WParameter::First, true); + } + else { + // We still set the value in case user change of mode. + toolWidget->setParameterWithoutPassingFocus(WParameter::First, handler->SplineDegree); + toolWidget->setParameterVisible(WParameter::First, false); + } onViewParameters[OnViewParameter::First]->setLabelType(Gui::SoDatumLabel::DISTANCEX); onViewParameters[OnViewParameter::Second]->setLabelType(Gui::SoDatumLabel::DISTANCEY); @@ -1076,9 +1083,19 @@ void DSHBSplineController::doChangeDrawSketchHandlerMode() template<> -bool DSHBSplineControllerBase::resetOnConstructionMethodeChanged() +void DSHBSplineController::doConstructionMethodChanged() { handler->changeConstructionMethode(); + + syncConstructionMethodComboboxToHandler(); + bool byCtrlPoints = handler->constructionMethod() == ConstructionMethod::ControlPoints; + toolWidget->setParameterVisible(WParameter::First, byCtrlPoints); +} + + +template<> +bool DSHBSplineControllerBase::resetOnConstructionMethodeChanged() +{ return false; }