File 0001-Fem-add-context-menu-entry-for-clearing-the-referenc.patch of Package FreeCAD

diff -ur FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintBearing.cpp FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintBearing.cpp
--- FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintBearing.cpp	2025-05-14 04:58:13.000000000 +0200
+++ FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintBearing.cpp	2025-05-22 16:08:54.840212867 +0200
@@ -60,7 +60,7 @@
     QMetaObject::connectSlotsByName(this);
 
     // create a context menu for the listview of the references
-    createDeleteAction(ui->listReferences);
+    createActions(ui->listReferences);
     connect(deleteAction, &QAction::triggered, this, &TaskFemConstraintBearing::onReferenceDeleted);
 
     this->groupLayout()->addWidget(proxy);
diff -ur FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraint.cpp FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraint.cpp
--- FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraint.cpp	2025-05-14 04:58:13.000000000 +0200
+++ FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraint.cpp	2025-05-22 16:08:54.840212867 +0200
@@ -57,6 +57,8 @@
               true,
               parent)
     , proxy(nullptr)
+    , actionList(nullptr)
+    , clearListAction(nullptr)
     , deleteAction(nullptr)
     , ConstraintView(ConstraintView)
     , selectionMode(selref)
@@ -129,6 +131,12 @@
     Gui::Selection().addSelection(docName.c_str(), objName.c_str(), ItemName.c_str(), 0, 0, 0);
 }
 
+void TaskFemConstraint::onReferenceClearList()
+{
+    QSignalBlocker block(actionList);
+    actionList->clear();
+}
+
 void TaskFemConstraint::onReferenceDeleted(const int row)
 {
     Fem::Constraint* pcConstraint = static_cast<Fem::Constraint*>(ConstraintView->getObject());
@@ -163,6 +171,22 @@
     return QString::fromUtf8((std::string(obj->getNameInDocument()) + ":" + subName).c_str());
 }
 
+void TaskFemConstraint::createActions(QListWidget* parentList)
+{
+    actionList = parentList;
+    createDeleteAction(parentList);
+    createClearListAction(parentList);
+}
+
+void TaskFemConstraint::createClearListAction(QListWidget* parentList)
+{
+    clearListAction = new QAction(tr("Clear list"), this);
+    connect(clearListAction, &QAction::triggered, this, &TaskFemConstraint::onReferenceClearList);
+
+    parentList->addAction(clearListAction);
+    parentList->setContextMenuPolicy(Qt::ActionsContextMenu);
+}
+
 void TaskFemConstraint::createDeleteAction(QListWidget* parentList)
 {
     // creates a context menu, a shortcut for it and connects it to a slot function
diff -ur FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp
--- FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp	2025-05-14 04:58:13.000000000 +0200
+++ FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp	2025-05-22 16:08:54.840212867 +0200
@@ -56,7 +56,7 @@
     QMetaObject::connectSlotsByName(this);
 
     // create a context menu for the listview of the references
-    createDeleteAction(ui->lw_references);
+    createActions(ui->lw_references);
     connect(deleteAction,
             &QAction::triggered,
             this,
diff -ur FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp
--- FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp	2025-05-14 04:58:13.000000000 +0200
+++ FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp	2025-05-22 16:08:54.840212867 +0200
@@ -54,7 +54,7 @@
     QMetaObject::connectSlotsByName(this);
 
     // create a context menu for the listview of the references
-    createDeleteAction(ui->lw_references);
+    createActions(ui->lw_references);
     connect(deleteAction, &QAction::triggered, this, &TaskFemConstraintFixed::onReferenceDeleted);
     connect(ui->lw_references,
             &QListWidget::currentItemChanged,
diff -ur FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp
--- FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp	2025-05-14 04:58:13.000000000 +0200
+++ FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp	2025-05-22 16:08:54.840212867 +0200
@@ -138,7 +138,7 @@
     QMetaObject::connectSlotsByName(this);
 
     // create a context menu for the listview of the references
-    createDeleteAction(ui->listReferences);
+    createActions(ui->listReferences);
     connect(deleteAction,
             &QAction::triggered,
             this,
diff -ur FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp
--- FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp	2025-05-14 04:58:13.000000000 +0200
+++ FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp	2025-05-22 16:08:54.840212867 +0200
@@ -89,7 +89,7 @@
     ui->checkReverse->setChecked(reversed);
 
     // create a context menu for the listview of the references
-    createDeleteAction(ui->listReferences);
+    createActions(ui->listReferences);
     connect(deleteAction, &QAction::triggered, this, &TaskFemConstraintForce::onReferenceDeleted);
     connect(ui->buttonDirection,
             &QToolButton::clicked,
diff -ur FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraint.h FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraint.h
--- FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraint.h	2025-05-14 04:58:13.000000000 +0200
+++ FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraint.h	2025-05-22 16:08:54.840212867 +0200
@@ -60,6 +60,7 @@
 protected Q_SLOTS:
     void onReferenceDeleted(const int row);
     void onButtonReference(const bool pressed = true);
+    void onReferenceClearList();
     void setSelection(QListWidgetItem* item);
 
     bool event(QEvent* event) override;
@@ -72,12 +73,16 @@
     const QString makeRefText(const std::string& objName, const std::string& subName) const;
     const QString makeRefText(const App::DocumentObject* obj, const std::string& subName) const;
     void keyPressEvent(QKeyEvent* ke) override;
+    void createActions(QListWidget* parentList);
+    void createClearListAction(QListWidget* parentList);
     void createDeleteAction(QListWidget* parentList);
     void onSelectionChanged(const Gui::SelectionChanges&) override
     {}
 
 protected:
     QWidget* proxy;
+    QListWidget* actionList;
+    QAction* clearListAction;
     QAction* deleteAction;
     Gui::WeakPtrT<ViewProviderFemConstraint> ConstraintView;
     enum
diff -ur FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp
--- FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp	2025-05-14 04:58:13.000000000 +0200
+++ FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp	2025-05-22 16:08:54.840212867 +0200
@@ -56,7 +56,7 @@
     QMetaObject::connectSlotsByName(this);
 
     // create a context menu for the listview of the references
-    createDeleteAction(ui->lw_references);
+    createActions(ui->lw_references);
     connect(deleteAction,
             &QAction::triggered,
             this,
diff -ur FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp
--- FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp	2025-05-14 04:58:13.000000000 +0200
+++ FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp	2025-05-22 16:08:54.840212867 +0200
@@ -60,7 +60,7 @@
     QMetaObject::connectSlotsByName(this);
 
     // create a context menu for the listview of the references
-    createDeleteAction(ui->lw_references);
+    createActions(ui->lw_references);
     connect(deleteAction,
             &QAction::triggered,
             this,
diff -ur FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp
--- FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp	2025-05-14 04:58:13.000000000 +0200
+++ FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp	2025-05-22 16:08:54.840212867 +0200
@@ -81,7 +81,7 @@
     }
 
     // create a context menu for the listview of the references
-    createDeleteAction(ui->lw_references);
+    createActions(ui->lw_references);
     connect(deleteAction,
             &QAction::triggered,
             this,
diff -ur FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp
--- FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp	2025-05-14 04:58:13.000000000 +0200
+++ FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp	2025-05-22 16:08:54.840212867 +0200
@@ -54,7 +54,7 @@
     QMetaObject::connectSlotsByName(this);
 
     // create a context menu for the listview of the references
-    createDeleteAction(ui->lw_references);
+    createActions(ui->lw_references);
     deleteAction->connect(deleteAction,
                           &QAction::triggered,
                           this,
diff -ur FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp
--- FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp	2025-05-14 04:58:13.000000000 +0200
+++ FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp	2025-05-22 16:08:54.840212867 +0200
@@ -54,7 +54,7 @@
     QMetaObject::connectSlotsByName(this);
 
     // create a context menu for the listview of the references
-    createDeleteAction(ui->lw_references);
+    createActions(ui->lw_references);
     connect(deleteAction, &QAction::triggered, this, &TaskFemConstraintSpring::onReferenceDeleted);
 
     connect(ui->lw_references,
diff -ur FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp
--- FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp	2025-05-14 04:58:13.000000000 +0200
+++ FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp	2025-05-22 16:08:54.840212867 +0200
@@ -99,7 +99,7 @@
     }
 
     // create a context menu for the listview of the references
-    createDeleteAction(ui->lw_references);
+    createActions(ui->lw_references);
     connect(deleteAction,
             &QAction::triggered,
             this,
diff -ur FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp
--- FreeCAD-1.0.1.orig/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp	2025-05-14 04:58:13.000000000 +0200
+++ FreeCAD-1.0.1/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp	2025-05-22 16:08:54.840212867 +0200
@@ -59,7 +59,7 @@
     QMetaObject::connectSlotsByName(this);
 
     // create a context menu for the listview of the references
-    createDeleteAction(ui->lw_Rect);
+    createActions(ui->lw_Rect);
     connect(deleteAction,
             &QAction::triggered,
             this,
openSUSE Build Service is sponsored by