Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
void CQGlobalQuantityDM::deleteGlobalQuantityRows(QList <UndoGlobalQuantityData *>& pData)
{
  switchToWidget(CCopasiUndoCommand::GLOBALQUANTITYIES);

  QList <UndoGlobalQuantityData *>::const_iterator j;

  for (j = pData.begin(); j != pData.end(); ++j)
    {
      UndoGlobalQuantityData * data = *j;
      size_t index = mpGlobalQuantities->getIndex(data->getName());
      removeRow((int) index);
    }
}