Fix bug nParameter is not initialized based on construction methode.

Also fix bug construction methode combobox is not at correct index on tool start if not first methode.
This commit is contained in:
Paddle
2023-11-05 08:59:59 +01:00
committed by abdullahtahiriyo
parent 2b2a20d9d9
commit 5e8701a2ca
2 changed files with 20 additions and 21 deletions

View File

@@ -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;

View File

@@ -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<int>(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<int>(handler->constructionMethod());
if (currentindex != methodint) {
// avoid triggering of method change
boost::signals2::shared_connection_block combobox_block(
connectionComboboxSelectionChanged);
toolWidget->setComboboxIndex(WCombobox::FirstCombo, methodint);
}
}
}
private: