+ dynamically hide/show and enable/disable item in property editor

This commit is contained in:
wmayer
2016-03-05 13:13:23 +01:00
parent 7ba4da0913
commit c15da7f463
6 changed files with 75 additions and 0 deletions

View File

@@ -105,6 +105,9 @@ PropertyView::PropertyView(QWidget *parent)
this->connectPropRemove =
App::GetApplication().signalRemoveDynamicProperty.connect(boost::bind
(&PropertyView::slotRemoveDynamicProperty, this, _1));
this->connectPropChange =
App::GetApplication().signalChangePropertyEditor.connect(boost::bind
(&PropertyView::slotChangePropertyEditor, this, _1));
}
PropertyView::~PropertyView()
@@ -113,6 +116,7 @@ PropertyView::~PropertyView()
this->connectPropView.disconnect();
this->connectPropAppend.disconnect();
this->connectPropRemove.disconnect();
this->connectPropChange.disconnect();
}
void PropertyView::slotChangePropertyData(const App::DocumentObject&, const App::Property& prop)
@@ -150,6 +154,17 @@ void PropertyView::slotRemoveDynamicProperty(const App::Property& prop)
}
}
void PropertyView::slotChangePropertyEditor(const App::Property& prop)
{
App::PropertyContainer* parent = prop.getContainer();
if (parent && parent->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
propertyEditorData->updatetEditorMode(prop);
}
else if (parent && parent->isDerivedFrom(Gui::ViewProvider::getClassTypeId())) {
propertyEditorView->updatetEditorMode(prop);
}
}
struct PropertyView::PropInfo
{
std::string propName;