void QtPropertyData::ChildRemove(QtPropertyData *data) { QString key = children.key(data, ""); if(!key.isEmpty()) { ChildRemove(key); } }
bool QtPropertyDataDavaKeyedArcive::UpdateValueInternal() { // update children { QSet<QtPropertyData *> dataToRemove; // at first step of sync we mark (placing to vector) items to remove for(int i = 0; i < ChildCount(); ++i) { QPair<QString, QtPropertyData *> pair = ChildGet(i); if(NULL != pair.second) { dataToRemove.insert(pair.second); } } // as second step we go throught keyed archive and add new data items, // and remove deleting mark from items that are still in archive if(NULL != curArchive) { DAVA::Map<DAVA::String, DAVA::VariantType*> data = curArchive->GetArchieveData(); DAVA::Map<DAVA::String, DAVA::VariantType*>::iterator i = data.begin(); for(; i != data.end(); ++i) { QtPropertyData *childData = ChildGet(i->first.c_str()); // this key already in items list if(NULL != childData) { // remove deleting mark dataToRemove.remove(childData); } // create new child data else { ChildCreate(i->first.c_str(), i->second); } } } // delete all marked items QSetIterator<QtPropertyData *> it(dataToRemove); while(it.hasNext()) { ChildRemove(it.next()); } } return false; }
void QtPropertyItem::DataChildRemoving(const QString &key, QtPropertyData *data) { ChildRemove(data); ApplyNameStyle(); }