Gui: Disallow dragging features outside of body

This commit is contained in:
Kacper Donat
2025-09-07 01:24:56 +02:00
parent 5fbe1b66a8
commit 288255f074
2 changed files with 11 additions and 0 deletions

View File

@@ -453,3 +453,13 @@ void ViewProviderBody::dropObject(App::DocumentObject* obj)
}
}
}
bool ViewProviderBody::canDragObjectToTarget(App::DocumentObject* obj,
App::DocumentObject* target) const
{
if (obj->isDerivedFrom<PartDesign::Feature>()) {
return target && target->is<PartDesign::Body>();
}
return ViewProviderPart::canDragObjectToTarget(obj, target);
}

View File

@@ -88,6 +88,7 @@ public:
bool canDropObject(App::DocumentObject*) const override;
/** Add an object to the view provider by drag and drop */
void dropObject(App::DocumentObject*) override;
bool canDragObjectToTarget(App::DocumentObject* obj, App::DocumentObject* target) const override;
protected:
/// Copy over all visual properties to the child features