+ 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

@@ -143,6 +143,8 @@ void PropertyEditor::buildUp(const PropertyModel::PropertyList& props)
QModelIndex index = propertyModel->propertyIndexFromPath(this->selectedProperty);
this->setCurrentIndex(index);
}
propList = props;
}
void PropertyEditor::updateProperty(const App::Property& prop)
@@ -152,4 +154,23 @@ void PropertyEditor::updateProperty(const App::Property& prop)
propertyModel->updateProperty(prop);
}
void PropertyEditor::appendProperty(const App::Property& prop)
{
//TODO: Find any property with the same container parent
//propertyModel->appendProperty(prop);
}
void PropertyEditor::removeProperty(const App::Property& prop)
{
for (PropertyModel::PropertyList::iterator it = propList.begin(); it != propList.end(); ++it) {
// find the given property in the list and remove it if it's there
std::vector<App::Property*>::iterator pos = std::find(it->second.begin(), it->second.end(), &prop);
if (pos != it->second.end()) {
it->second.erase(pos);
propertyModel->removeProperty(prop);
break;
}
}
}
#include "moc_PropertyEditor.cpp"