Sketcher: constraint settings are kept in sync with user parameters
This commit is contained in:
@@ -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<const char*> &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<int>(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+)$"));
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#ifndef GUI_TASKVIEW_TaskSketcherConstraints_H
|
||||
#define GUI_TASKVIEW_TaskSketcherConstraints_H
|
||||
|
||||
#include <Base/Parameter.h>
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <boost_signals2.hpp>
|
||||
@@ -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<const char*> &rCaller,const char* rcReason) override;
|
||||
|
||||
SpecialFilterType specialFilterMode;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user