From 5f88e71e1f7a8d8ed99c583238e039931f50a3e5 Mon Sep 17 00:00:00 2001 From: Uwe Date: Thu, 31 Mar 2022 00:02:48 +0200 Subject: [PATCH] [FEM] fix function selection for cut filter this is the same fix as https://github.com/FreeCAD/FreeCAD/commit/54ef47276fba for the cut filter --- src/Mod/Fem/Gui/TaskPostBoxes.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Mod/Fem/Gui/TaskPostBoxes.cpp b/src/Mod/Fem/Gui/TaskPostBoxes.cpp index 7a4404c44d..5003cf4dfb 100644 --- a/src/Mod/Fem/Gui/TaskPostBoxes.cpp +++ b/src/Mod/Fem/Gui/TaskPostBoxes.cpp @@ -1206,12 +1206,17 @@ void TaskPostCut::collectImplicitFunctions() { ui->FunctionBox->clear(); QStringList items; + std::size_t currentItem = 0; + App::DocumentObject* currentFunction = static_cast(getObject())->Function.getValue(); const std::vector& funcs = static_cast( pipeline->Functions.getValue())->Functions.getValues(); - for (std::size_t i = 0; i < funcs.size(); ++i) + for (std::size_t i = 0; i < funcs.size(); ++i) { items.push_back(QString::fromLatin1(funcs[i]->getNameInDocument())); - + if (currentFunction == funcs[i]) + currentItem = i; + } ui->FunctionBox->addItems(items); + ui->FunctionBox->setCurrentIndex(currentItem); } } }