Sketcher: Optional extended naming for constraints widget giving first-second-third information

This commit is contained in:
Abdullah Tahiri
2018-05-23 17:44:00 +02:00
committed by wmayer
parent 78b7510ee1
commit dccb86a5db
3 changed files with 47 additions and 1 deletions

View File

@@ -157,6 +157,22 @@ public:
default:
break;
}
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
bool extended = hGrp->GetBool("ExtendedConstraintInformation",false);
if(extended) {
if(constraint->Second == Sketcher::Constraint::GeoUndef) {
name = QString::fromLatin1("%1 [(%2,%3)]").arg(name).arg(constraint->First).arg(constraint->FirstPos);
}
else if(constraint->Third == Sketcher::Constraint::GeoUndef) {
name = QString::fromLatin1("%1 [(%2,%3),(%4,%5)]").arg(name).arg(constraint->First).arg(constraint->FirstPos).arg(constraint->Second).arg(constraint->SecondPos);
}
else {
name = QString::fromLatin1("%1 [(%2,%3),(%4,%5),(%6,%7)]").arg(name).arg(constraint->First).arg(constraint->FirstPos).arg(constraint->Second).arg(constraint->SecondPos).arg(constraint->Third).arg(constraint->ThirdPos);
}
}
return name;
}
else if (role == Qt::DecorationRole) {
@@ -594,7 +610,11 @@ TaskSketcherConstrains::TaskSketcherConstrains(ViewProviderSketch *sketchView)
QObject::connect(
ui->filterInternalAlignment, SIGNAL(stateChanged(int)),
this , SLOT (on_filterInternalAlignment_stateChanged(int))
);
);
QObject::connect(
ui->extendedInformation, SIGNAL(stateChanged(int)),
this , SLOT (on_extendedInformation_stateChanged(int))
);
connectionConstraintsChanged = sketchView->signalConstraintsChanged.connect(
boost::bind(&SketcherGui::TaskSketcherConstrains::slotConstraintsChanged, this));
@@ -602,6 +622,7 @@ TaskSketcherConstrains::TaskSketcherConstrains(ViewProviderSketch *sketchView)
this->groupLayout()->addWidget(proxy);
this->ui->filterInternalAlignment->onRestore();
this->ui->extendedInformation->onRestore();
slotConstraintsChanged();
}
@@ -609,6 +630,7 @@ TaskSketcherConstrains::TaskSketcherConstrains(ViewProviderSketch *sketchView)
TaskSketcherConstrains::~TaskSketcherConstrains()
{
this->ui->filterInternalAlignment->onSave();
this->ui->extendedInformation->onSave();
connectionConstraintsChanged.disconnect();
delete ui;
}
@@ -667,6 +689,13 @@ void TaskSketcherConstrains::on_filterInternalAlignment_stateChanged(int state)
slotConstraintsChanged();
}
void TaskSketcherConstrains::on_extendedInformation_stateChanged(int state)
{
Q_UNUSED(state);
this->ui->extendedInformation->onSave();
slotConstraintsChanged();
}
void TaskSketcherConstrains::on_listWidgetConstraints_emitCenterSelectedItems()
{
sketchView->centerSelection();

View File

@@ -87,6 +87,7 @@ public Q_SLOTS:
void on_listWidgetConstraints_updateDrivingStatus(QListWidgetItem *item, bool status);
void on_listWidgetConstraints_emitCenterSelectedItems(void);
void on_filterInternalAlignment_stateChanged(int state);
void on_extendedInformation_stateChanged(int state);
protected:
void changeEvent(QEvent *e);

View File

@@ -73,6 +73,22 @@
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="extendedInformation">
<property name="text">
<string>Extended Information</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>ExtendedConstraintInformation</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Sketcher</cstring>
</property>
</widget>
</item>
<item>
<widget class="ConstraintView" name="listWidgetConstraints">
<property name="modelColumn">