Gui: improve deletion handling in origin feature

This commit is contained in:
Zheng, Lei
2019-07-12 08:53:26 +08:00
committed by wmayer
parent bc26820837
commit 51ab8caace
2 changed files with 16 additions and 12 deletions

View File

@@ -64,10 +64,11 @@ PROPERTY_SOURCE(Gui::ViewProviderOrigin, Gui::ViewProviderDocumentObject)
*/
ViewProviderOrigin::ViewProviderOrigin()
{
ADD_PROPERTY_TYPE ( Size, (Base::Vector3d(10,10,10)), 0, App::Prop_ReadOnly,
QT_TRANSLATE_NOOP("App::Property", "The displayed size of the origin"));
ADD_PROPERTY_TYPE ( Size, (Base::Vector3d(10,10,10)), 0, App::Prop_None,
QT_TRANSLATE_NOOP("App::Property", "The displayed size of the origin"));
Size.setStatus(App::Property::ReadOnly, true);
sPixmap = "CoordinateSystem";
sPixmap = "Std_CoordinateSystem";
Visibility.setValue(false);
pcGroupChildren = new SoGroup();
@@ -212,7 +213,10 @@ bool ViewProviderOrigin::onDelete(const std::vector<std::string> &) {
return false;
}
for (auto obj: origin->OriginFeatures.getValues() ) {
auto objs = origin->OriginFeatures.getValues();
origin->OriginFeatures.setValues({});
for (auto obj: objs ) {
Gui::Command::doCommand( Gui::Command::Doc, "App.getDocument(\"%s\").removeObject(\"%s\")",
obj->getDocument()->getName(), obj->getNameInDocument() );
}