Honour the ordering of the children returned by claimChildren() in the TreeWidget

This commit is contained in:
jrheinlaender
2013-04-19 14:41:40 +04:30
committed by Stefan Tröger
parent 1b7fbeb622
commit 4bb14de504
2 changed files with 38 additions and 28 deletions

View File

@@ -120,16 +120,15 @@ std::vector<App::DocumentObject*> ViewProviderBody::claimChildren(void)const
}
}
// remove the otherwise handled objects
std::vector<App::DocumentObject*> Result(Model.size());
sort (Model.begin(), Model.end());
std::vector<App::DocumentObject*>::iterator it = set_difference (Model.begin(), Model.end(), OutSet.begin(),OutSet.end(), Result.begin());
// remove the otherwise handled objects, preserving their order so the order in the TreeWidget is correct
std::vector<App::DocumentObject*> Result;
for (std::vector<App::DocumentObject*>::const_iterator it = Model.begin();it!=Model.end();++it) {
if (OutSet.find(*it) == OutSet.end())
Result.push_back(*it);
}
//Base::Console().Error("Body claimed children:\n");
//for (std::vector<App::DocumentObject*>::const_iterator o = Result.begin(); o != it; o++)
// Base::Console().Error("%s\n", (*o)->getNameInDocument());
// return the rest as claim set of the Body
return std::vector<App::DocumentObject*>(Result.begin(),it);
return Result;
}