diff --git a/src/Mod/Sketcher/Gui/DrawSketchController.h b/src/Mod/Sketcher/Gui/DrawSketchController.h index cd54f9e43e..6351462a78 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchController.h +++ b/src/Mod/Sketcher/Gui/DrawSketchController.h @@ -241,8 +241,6 @@ public: /** function that is called by the handler when the construction mode changed */ void onConstructionMethodChanged() { - nOnViewParameter = OnViewParametersT::size(handler->constructionMethod()); - doConstructionMethodChanged(); // NVI handler->updateCursor(); @@ -560,6 +558,7 @@ protected: /** Resets the on-view parameter controls */ void resetOnViewParameters() { + nOnViewParameter = OnViewParametersT::size(handler->constructionMethod()); initNOnViewParameters(nOnViewParameter); onViewIndexWithFocus = 0; diff --git a/src/Mod/Sketcher/Gui/DrawSketchDefaultWidgetController.h b/src/Mod/Sketcher/Gui/DrawSketchDefaultWidgetController.h index d4c2b02397..bcb6f86ee4 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchDefaultWidgetController.h +++ b/src/Mod/Sketcher/Gui/DrawSketchDefaultWidgetController.h @@ -253,25 +253,7 @@ protected: /// Automatic default method update in combobox void doConstructionMethodChanged() override - { - nParameter = WidgetParametersT::size(handler->constructionMethod()); - nCheckbox = WidgetCheckboxesT::size(handler->constructionMethod()); - nCombobox = WidgetComboboxesT::size(handler->constructionMethod()); - - // update the combobox only if necessary (if the change was not triggered by the - // combobox) - if constexpr (PFirstComboboxIsConstructionMethod == true) { - auto currentindex = toolWidget->getComboboxIndex(WCombobox::FirstCombo); - auto methodint = static_cast(handler->constructionMethod()); - - if (currentindex != methodint) { - // avoid triggering of method change - boost::signals2::shared_connection_block combobox_block( - connectionComboboxSelectionChanged); - toolWidget->setComboboxIndex(WCombobox::FirstCombo, methodint); - } - } - } + {} //@} private: @@ -306,11 +288,29 @@ private: boost::signals2::shared_connection_block checkbox_block(connectionCheckboxCheckedChanged); boost::signals2::shared_connection_block combobox_block(connectionComboboxSelectionChanged); + nParameter = WidgetParametersT::size(handler->constructionMethod()); + nCheckbox = WidgetCheckboxesT::size(handler->constructionMethod()); + nCombobox = WidgetComboboxesT::size(handler->constructionMethod()); + toolWidget->initNParameters(nParameter); toolWidget->initNCheckboxes(nCheckbox); toolWidget->initNComboboxes(nCombobox); configureToolWidget(); + + // update the combobox only if necessary (if the change was not triggered by the + // combobox) + if constexpr (PFirstComboboxIsConstructionMethod == true) { + auto currentindex = toolWidget->getComboboxIndex(WCombobox::FirstCombo); + auto methodint = static_cast(handler->constructionMethod()); + + if (currentindex != methodint) { + // avoid triggering of method change + boost::signals2::shared_connection_block combobox_block( + connectionComboboxSelectionChanged); + toolWidget->setComboboxIndex(WCombobox::FirstCombo, methodint); + } + } } private: