prevent parts from being dragged into parts

This commit is contained in:
Stefan Tröger 2016-01-15 19:24:57 +01:00
parent 7d30833349
commit 2585598c55
2 changed files with 11 additions and 0 deletions

View File

@ -72,6 +72,16 @@ bool ViewProviderPart::doubleClicked(void)
return true; return true;
} }
bool ViewProviderPart::canDropObject(App::DocumentObject* obj) const {
//it is not allowed to have any part or assembly object within a part, hence we exclude origin groups
if(obj->isDerivedFrom(App::OriginGroup::getClassTypeId()))
return false;
return Gui::ViewProvider::canDropObject(obj);
}
/** /**
* Returns the pixmap for the list item. * Returns the pixmap for the list item.
*/ */

View File

@ -44,6 +44,7 @@ public:
QIcon getIcon(void) const; QIcon getIcon(void) const;
virtual bool doubleClicked(void); virtual bool doubleClicked(void);
virtual bool canDropObject(App::DocumentObject*) const;
protected: protected:
/// get called by the container whenever a property has been changed /// get called by the container whenever a property has been changed
virtual void onChanged(const App::Property* prop); virtual void onChanged(const App::Property* prop);