diff --git a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp index bfb134b658..c27383ec25 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp @@ -781,6 +781,7 @@ TaskSketcherConstraints::TaskSketcherConstraints(ViewProviderSketch *sketchView) action4->setChecked(hGrp->GetBool("ExtendedConstraintInformation", false)); action5->setChecked(hGrp->GetBool("HideInternalAlignment", false)); } + hGrp->Attach(this); auto settingsBut = qAsConst(ui->settingsButton); @@ -886,6 +887,7 @@ TaskSketcherConstraints::TaskSketcherConstraints(ViewProviderSketch *sketchView) TaskSketcherConstraints::~TaskSketcherConstraints() { connectionConstraintsChanged.disconnect(); + App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher")->Detach(this); } void TaskSketcherConstraints::on_settings_extendedInformation_changed(bool value) @@ -1296,6 +1298,29 @@ void TaskSketcherConstraints::onSelectionChanged(const Gui::SelectionChanges& ms } } +void TaskSketcherConstraints::OnChange(Base::Subject &rCaller,const char* rcReason) +{ + Q_UNUSED(rCaller); + int actNum = -1; + auto hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); + if (strcmp(rcReason, "AutoRemoveRedundants") == 0) { + actNum = 1; + } + else if (strcmp(rcReason, "VisualisationTrackingFilter") == 0) { + actNum = 2; + } + else if (strcmp(rcReason, "ExtendedConstraintInformation") == 0) { + actNum = 3; + } + else if (strcmp(rcReason, "HideInternalAlignment") == 0) { + actNum = 4; + } + if (actNum >= 0) { + assert(actNum < static_cast(ui->settingsButton->actions().size())); + qAsConst(ui->settingsButton)->actions()[actNum]->setChecked(hGrp->GetBool(rcReason, false)); + } +} + void TaskSketcherConstraints::getSelectionGeoId(QString expr, int & geoid, Sketcher::PointPos & pointpos) { QRegularExpression rxEdge(QString::fromLatin1("^Edge(\\d+)$")); diff --git a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.h b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.h index 0e73755d36..04d01f255c 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.h +++ b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.h @@ -24,6 +24,7 @@ #ifndef GUI_TASKVIEW_TaskSketcherConstraints_H #define GUI_TASKVIEW_TaskSketcherConstraints_H +#include #include #include #include @@ -131,7 +132,10 @@ private: }; }; -class TaskSketcherConstraints : public Gui::TaskView::TaskBox, public Gui::SelectionObserver +class TaskSketcherConstraints : + public Gui::TaskView::TaskBox, + public Gui::SelectionObserver, + public ParameterGrp::ObserverType { Q_OBJECT @@ -152,6 +156,7 @@ public: /// Observer message from the Selection void onSelectionChanged(const Gui::SelectionChanges& msg) override; + void OnChange(Base::Subject &rCaller,const char* rcReason) override; SpecialFilterType specialFilterMode;