bool CQGlobalQuantityDM::insertGlobalQuantityRows(QList <UndoGlobalQuantityData *>& pData) { //reinsert all the GlobalQuantities QList <UndoGlobalQuantityData *>::const_iterator i; for (i = pData.begin(); i != pData.end(); ++i) { UndoGlobalQuantityData * data = *i; if (mpGlobalQuantities->getIndex(data->getName()) != C_INVALID_INDEX) continue; beginInsertRows(QModelIndex(), 1, 1); CModelValue *pGlobalQuantity = data->restoreObjectIn(mpDataModel->getModel()); if (pGlobalQuantity != NULL) emit notifyGUI(ListViews::MODELVALUE, ListViews::ADD, pGlobalQuantity->getKey()); endInsertRows(); } switchToWidget(CCopasiUndoCommand::GLOBALQUANTITYIES); return true; }
void UndoDependentData::restoreDependentObjects(CModel *pModel, QList<UndoGlobalQuantityData *> *pGlobalQuantityData) { //reinsert the dependency global quantity if (pModel == NULL || pGlobalQuantityData == NULL || pGlobalQuantityData->empty()) return; QList <UndoGlobalQuantityData *>::const_iterator g; for (g = pGlobalQuantityData->begin(); g != pGlobalQuantityData->end(); ++g) { UndoGlobalQuantityData* data = *g; CModelValue *pGlobalQuantity = data->restoreObjectIn(pModel); if (pGlobalQuantity == NULL) continue; data->restoreDependentObjects(pModel); updateGUI(ListViews::MODELVALUE, ListViews::ADD, pGlobalQuantity->getKey()); } }