[FEM] Use modal add/remove for more constraints (8/??)

Use the previously added superclass `TaskConstraintOnBoundary` for more
constraints where it's usable.

Currently done:
TaskFemConstraintDisplacement
TaskFemConstraintForce
TaskFemConstraintSpring
TaskFemConstraintFluidBoundary
TaskFemConstraintHeatflux
TaskFemConstraintFixed
TaskFemConstraintTemperature
TaskFemConstraintPressure

Too different:
TaskFemConstraintTransform (single selection)
TaskFemConstraintContact (single selection, two fields)
TaskFemConstraintPlaneRotation (single selection)
(Other constraint tasks, which do not use `addToSelection`)
This commit is contained in:
Ajinkya Dahale
2021-10-22 20:51:39 -04:00
committed by Uwe
parent 0aeed0e53b
commit c558fc7195
21 changed files with 162 additions and 45 deletions

View File

@@ -59,8 +59,8 @@ using namespace Gui;
/* TRANSLATOR FemGui::TaskFemConstraintSpring */
TaskFemConstraintSpring::TaskFemConstraintSpring(ViewProviderFemConstraintSpring *ConstraintView, QWidget *parent)
: TaskFemConstraint(ConstraintView, parent, "FEM_ConstraintSpring")
{
: TaskFemConstraintOnBoundary(ConstraintView, parent, "FEM_ConstraintSpring")
{
proxy = new QWidget(this);
ui = new Ui_TaskFemConstraintSpring();
ui->setupUi(proxy);
@@ -95,7 +95,7 @@ TaskFemConstraintSpring::TaskFemConstraintSpring(ViewProviderFemConstraintSpring
ui->if_tan->setMaximum(FLOAT_MAX);
Base::Quantity ts = Base::Quantity((pcConstraint->tangentialStiffness.getValue()), Base::Unit::Stiffness);
ui->if_tan->setValue(ts);
/* */
ui->lw_references->clear();
@@ -107,8 +107,10 @@ TaskFemConstraintSpring::TaskFemConstraintSpring(ViewProviderFemConstraintSpring
}
//Selection buttons
connect(ui->btnAdd, SIGNAL(clicked()), this, SLOT(addToSelection()));
connect(ui->btnRemove, SIGNAL(clicked()), this, SLOT(removeFromSelection()));
connect(ui->btnAdd, SIGNAL(toggled(bool)),
this, SLOT(_addToSelection(bool)));
connect(ui->btnRemove, SIGNAL(toggled(bool)),
this, SLOT(_removeFromSelection(bool)));
updateUI();
}
@@ -261,6 +263,12 @@ void TaskFemConstraintSpring::changeEvent(QEvent *)
{
}
void TaskFemConstraintSpring::clearButtons(const SelectionChangeModes notThis)
{
if (notThis != refAdd) ui->btnAdd->setChecked(false);
if (notThis != refRemove) ui->btnRemove->setChecked(false);
}
//**************************************************************************
// TaskDialog
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++