+ property editor handles case when dynamic property is removed

This commit is contained in:
wmayer
2015-11-16 15:24:36 +01:00
parent 4f4d747968
commit ba21766096
10 changed files with 114 additions and 1 deletions

View File

@@ -99,12 +99,20 @@ PropertyView::PropertyView(QWidget *parent)
this->connectPropView =
Gui::Application::Instance->signalChangedObject.connect(boost::bind
(&PropertyView::slotChangePropertyView, this, _1, _2));
this->connectPropAppend =
App::GetApplication().signalAppendDynamicProperty.connect(boost::bind
(&PropertyView::slotAppendDynamicProperty, this, _1));
this->connectPropRemove =
App::GetApplication().signalRemoveDynamicProperty.connect(boost::bind
(&PropertyView::slotRemoveDynamicProperty, this, _1));
}
PropertyView::~PropertyView()
{
this->connectPropData.disconnect();
this->connectPropView.disconnect();
this->connectPropAppend.disconnect();
this->connectPropRemove.disconnect();
}
void PropertyView::slotChangePropertyData(const App::DocumentObject&, const App::Property& prop)
@@ -117,6 +125,28 @@ void PropertyView::slotChangePropertyView(const Gui::ViewProvider&, const App::P
propertyEditorView->updateProperty(prop);
}
void PropertyView::slotAppendDynamicProperty(const App::Property& prop)
{
App::PropertyContainer* parent = prop.getContainer();
if (parent && parent->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
propertyEditorData->appendProperty(prop);
}
else if (parent && parent->isDerivedFrom(Gui::ViewProvider::getClassTypeId())) {
propertyEditorView->appendProperty(prop);
}
}
void PropertyView::slotRemoveDynamicProperty(const App::Property& prop)
{
App::PropertyContainer* parent = prop.getContainer();
if (parent && parent->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
propertyEditorData->removeProperty(prop);
}
else if (parent && parent->isDerivedFrom(Gui::ViewProvider::getClassTypeId())) {
propertyEditorView->removeProperty(prop);
}
}
struct PropertyView::PropInfo
{
std::string propName;