| 43 | /* TRANSLATOR FemGui::TaskFemConstraintSpring */ |
| 44 | |
| 45 | TaskFemConstraintSpring::TaskFemConstraintSpring( |
| 46 | ViewProviderFemConstraintSpring* ConstraintView, |
| 47 | QWidget* parent |
| 48 | ) |
| 49 | : TaskFemConstraintOnBoundary(ConstraintView, parent, "FEM_ConstraintSpring") |
| 50 | , ui(new Ui_TaskFemConstraintSpring) |
| 51 | { |
| 52 | proxy = new QWidget(this); |
| 53 | ui->setupUi(proxy); |
| 54 | QMetaObject::connectSlotsByName(this); |
| 55 | |
| 56 | // create a context menu for the listview of the references |
| 57 | createActions(ui->lw_references); |
| 58 | connect(deleteAction, &QAction::triggered, this, &TaskFemConstraintSpring::onReferenceDeleted); |
| 59 | |
| 60 | connect( |
| 61 | ui->lw_references, |
| 62 | &QListWidget::currentItemChanged, |
| 63 | this, |
| 64 | &TaskFemConstraintSpring::setSelection |
| 65 | ); |
| 66 | connect(ui->lw_references, &QListWidget::itemClicked, this, &TaskFemConstraintSpring::setSelection); |
| 67 | |
| 68 | this->groupLayout()->addWidget(proxy); |
| 69 | |
| 70 | /* Note: */ |
| 71 | // Get the feature data |
| 72 | Fem::ConstraintSpring* pcConstraint = ConstraintView->getObject<Fem::ConstraintSpring>(); |
| 73 | |
| 74 | std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues(); |
| 75 | std::vector<std::string> SubElements = pcConstraint->References.getSubValues(); |
| 76 | |
| 77 | // Fill data into dialog elements |
| 78 | ui->qsb_norm->setUnit(pcConstraint->NormalStiffness.getUnit()); |
| 79 | ui->qsb_norm->setMaximum(std::numeric_limits<float>::max()); |
| 80 | ui->qsb_norm->setValue(pcConstraint->NormalStiffness.getQuantityValue()); |
| 81 | |
| 82 | ui->qsb_tan->setUnit(pcConstraint->TangentialStiffness.getUnit()); |
| 83 | ui->qsb_tan->setMaximum(std::numeric_limits<float>::max()); |
| 84 | ui->qsb_tan->setValue(pcConstraint->TangentialStiffness.getQuantityValue()); |
| 85 | |
| 86 | ui->cb_elmer_stiffness->clear(); |
| 87 | auto stiffnesses = pcConstraint->ElmerStiffness.getEnumVector(); |
| 88 | QStringList stiffnessesList; |
| 89 | for (auto item : stiffnesses) { |
| 90 | stiffnessesList << QLatin1String(item.c_str()); |
| 91 | } |
| 92 | ui->cb_elmer_stiffness->addItems(stiffnessesList); |
| 93 | ui->cb_elmer_stiffness->setCurrentIndex(pcConstraint->ElmerStiffness.getValue()); |
| 94 | |
| 95 | ui->lw_references->clear(); |
| 96 | for (std::size_t i = 0; i < Objects.size(); i++) { |
| 97 | ui->lw_references->addItem(makeRefText(Objects[i], SubElements[i])); |
| 98 | } |
| 99 | if (!Objects.empty()) { |
| 100 | ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect); |
| 101 | } |
| 102 |
nothing calls this directly
no test coverage detected