COPASI API  4.16.103
Public Member Functions | Protected Slots | Private Member Functions | Private Attributes | List of all members
CQParameterOverviewWidget Class Reference

#include <CQParameterOverviewWidget.h>

Inheritance diagram for CQParameterOverviewWidget:
Inheritance graph
[legend]
Collaboration diagram for CQParameterOverviewWidget:
Collaboration graph
[legend]

Public Member Functions

 CQParameterOverviewWidget (QWidget *parent=0, const char *name=0)
 
virtual bool leave ()
 
virtual void setFramework (int framework)
 
virtual bool update (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key)
 
virtual ~CQParameterOverviewWidget ()
 
- Public Member Functions inherited from CopasiWidget
 CopasiWidget (QWidget *parent=0, const char *name=0, Qt::WFlags f=0)
 
bool enter (const std::string &key)
 
CCopasiDataModelgetDataModel ()
 
bool getIgnoreUpdates ()
 
void setIgnoreUpdates (bool v)
 

Protected Slots

virtual void slotBtnCommit ()
 
virtual void slotBtnCopy ()
 
virtual void slotBtnDelete ()
 
virtual void slotBtnNew ()
 
virtual void slotBtnRevert ()
 
virtual void slotBtnSaveAs ()
 
virtual void slotBtnSaveToFile ()
 
void slotCloseEditor (const QModelIndex &index)
 
void slotOpenEditor (const QModelIndex &index)
 
void slotResolve (const QModelIndex &index)
 
- Protected Slots inherited from CopasiWidget
virtual bool protectedNotify (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
 

Private Member Functions

void buildSelectionList ()
 
virtual bool enterProtected ()
 

Private Attributes

QStringList mGlobalQuantities
 
CModelParameterSetmpParameterSet
 
CModelParameterSetmpParameterSetCopy
 
CQParameterOverviewDMmpParameterSetDM
 
QSortFilterProxyModel * mpParameterSetSortDM
 

Additional Inherited Members

- Protected Attributes inherited from CopasiWidget
int mFramework
 
bool mIgnoreUpdates
 
std::string mKey
 
CCopasiDataModelmpDataModel
 
ListViewsmpListView
 
CCopasiObjectmpObject
 

Detailed Description

Definition at line 17 of file CQParameterOverviewWidget.h.

Constructor & Destructor Documentation

CQParameterOverviewWidget::CQParameterOverviewWidget ( QWidget *  parent = 0,
const char *  name = 0 
)

Definition at line 24 of file CQParameterOverviewWidget.cpp.

References mGlobalQuantities, mpParameterSetDM, mpParameterSetSortDM, CQPushButtonDelegate::PushButton, slotCloseEditor(), slotOpenEditor(), and slotResolve().

24  :
25  CopasiWidget(parent, name),
26  mpParameterSet(NULL),
27  mpParameterSetCopy(NULL),
28  mpParameterSetDM(NULL),
31 {
32  setupUi(this);
33 
34  // create a new QListview to be displayed on the screen..and set its property
36  mpParameterSetSortDM = new QSortFilterProxyModel(this);
37 
38  mpParameterSetSortDM->setSourceModel(mpParameterSetDM);
39  mpParameterSetSortDM->setSortRole(Qt::EditRole);
40  mpParameterSetSortDM->setSortCaseSensitivity(Qt::CaseInsensitive);
41  // pSortModel->sort(0, Qt::AscendingOrder);
42 
43  mpTreeView->setModel(mpParameterSetSortDM);
44  mpTreeView->sortByColumn(0, Qt::AscendingOrder);
45 
47  mpTreeView->setItemDelegateForColumn(1, pPushButtonDelegate);
48  connect(pPushButtonDelegate, SIGNAL(clicked(const QModelIndex &)), this, SLOT(slotResolve(const QModelIndex &)));
49 
50  CQComboDelegate * pComboDelegate = new CQComboDelegate(&mGlobalQuantities, this);
51  mpTreeView->setItemDelegateForColumn(5, pComboDelegate);
52 
53  connect(mpParameterSetDM, SIGNAL(signalOpenEditor(const QModelIndex &)), this, SLOT(slotOpenEditor(const QModelIndex &)));
54  connect(mpParameterSetDM, SIGNAL(signalCloseEditor(const QModelIndex &)), this, SLOT(slotCloseEditor(const QModelIndex &)));
55 }
CQParameterOverviewDM * mpParameterSetDM
void slotOpenEditor(const QModelIndex &index)
void slotResolve(const QModelIndex &index)
void slotCloseEditor(const QModelIndex &index)
CopasiWidget(QWidget *parent=0, const char *name=0, Qt::WFlags f=0)
QSortFilterProxyModel * mpParameterSetSortDM
CModelParameterSet * mpParameterSetCopy
CQParameterOverviewWidget::~CQParameterOverviewWidget ( )
virtual

Definition at line 57 of file CQParameterOverviewWidget.cpp.

58 {
59  // TODO Auto-generated destructor stub
60 }

Member Function Documentation

void CQParameterOverviewWidget::buildSelectionList ( )
private

Definition at line 219 of file CQParameterOverviewWidget.cpp.

References CModelParameterGroup::begin(), CModelParameterGroup::end(), FROM_UTF8, CModelParameterGroup::getModelParameter(), mGlobalQuantities, CModelParameter::Missing, and mpParameterSetCopy.

Referenced by enterProtected(), and slotResolve().

220 {
221  // We build the selection for the global parameters for kinetic constants.
222  const CModelParameterGroup *pGlobalQuantities =
223  static_cast< CModelParameterGroup * >(mpParameterSetCopy->getModelParameter(CCopasiStaticString("Initial Global Quantities").getCN()));
224 
225  CModelParameterGroup::const_iterator it = pGlobalQuantities->begin();
226  CModelParameterGroup::const_iterator end = pGlobalQuantities->end();
227 
228  mGlobalQuantities.clear();
229  mGlobalQuantities.append("");
230 
231  for (; it != end; ++it)
232  {
233  if ((*it)->getCompareResult() != CModelParameter::Missing)
234  {
235  mGlobalQuantities.append(FROM_UTF8((*it)->getName()));
236  }
237  }
238 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
CModelParameter * getModelParameter(const std::string &cn) const
std::vector< CModelParameter * >::const_iterator const_iterator
CModelParameterSet * mpParameterSetCopy
bool CQParameterOverviewWidget::enterProtected ( )
privatevirtual

Reimplemented from CopasiWidget.

Definition at line 173 of file CQParameterOverviewWidget.cpp.

References buildSelectionList(), CModelParameterSet::compareWithModel(), CModelParameterGroup::compile(), CModelParameterSet::isActive(), CopasiWidget::mFramework, mGlobalQuantities, CopasiWidget::mpDataModel, CopasiWidget::mpObject, mpParameterSet, mpParameterSetCopy, mpParameterSetDM, pdelete, and CQParameterOverviewDM::setModelParameterset().

Referenced by slotBtnCommit(), slotBtnNew(), slotBtnRevert(), and update().

174 {
175  mpParameterSet = dynamic_cast< CModelParameterSet * >(mpObject);
176 
177  if (!mpParameterSet)
178  {
181 
182  return false;
183  }
184 
185  // We need to make sure the original is fully compiled.
187 
188  CModelParameterSet * pOldParameterSet = mpParameterSetCopy;
190 
191  mGlobalQuantities.clear();
192 
193  if (mpParameterSet->isActive())
194  {
195  mpTreeView->header()->hideSection(1);
196  }
197  else
198  {
199  mpParameterSetCopy->compareWithModel(static_cast< CModelParameter::Framework >(mFramework));
200  mpHeaderWidget->hide();
201  mpBtnWidget->hide();
202  }
203 
205 
207  pdelete(pOldParameterSet);
208 
209  mpTreeView->expandAll();
210 
211  for (int i = 0; i < 6; i++)
212  {
213  mpTreeView->resizeColumnToContents(i);
214  }
215 
216  return true;
217 }
#define pdelete(p)
Definition: copasi.h:215
bool compareWithModel(const CModelParameter::Framework &framework)
CQParameterOverviewDM * mpParameterSetDM
CCopasiObject * mpObject
Definition: copasiWidget.h:64
CCopasiDataModel * mpDataModel
Definition: copasiWidget.h:65
CModelParameterSet * mpParameterSetCopy
void setModelParameterset(CModelParameterSet *pModelParameterSet)
bool CQParameterOverviewWidget::leave ( )
virtual

Reimplemented from CopasiWidget.

Definition at line 122 of file CQParameterOverviewWidget.cpp.

References CModelParameterSet::assignSetContent(), ListViews::CHANGE, CModelParameterGroup::diff(), CCopasiRootContainer::getDatamodelList(), CModelParameter::Identical, CModelParameterSet::isActive(), CopasiWidget::mFramework, CopasiWidget::mKey, ListViews::MODELPARAMETERSET, mpParameterSet, mpParameterSetCopy, CopasiWidget::protectedNotify(), ListViews::STATE, and CModelParameterSet::updateModel().

Referenced by slotBtnCommit().

123 {
124  if (mpParameterSet == NULL)
125  {
126  return true;
127  }
128 
130  static_cast< CModelParameter::Framework >(mFramework),
131  false) != CModelParameter::Identical)
132  {
134 
135  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
136  (*CCopasiRootContainer::getDatamodelList())[0]->changed();
137 
138  if (mpParameterSet->isActive())
139  {
142  }
143  else
144  {
146  }
147  }
148 
149  return true;
150 }
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
virtual bool protectedNotify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
virtual const CompareResult & diff(const CModelParameter &other, const CModelParameter::Framework &framework, const bool &createMissing=false)
CModelParameterSet * mpParameterSetCopy
std::string mKey
Definition: copasiWidget.h:63
void assignSetContent(const CModelParameterSet &src, const bool &createMissing)
virtual bool updateModel()
void CQParameterOverviewWidget::setFramework ( int  framework)
virtual

Reimplemented from CopasiWidget.

Definition at line 153 of file CQParameterOverviewWidget.cpp.

References CModelParameterSet::compareWithModel(), CModelParameterSet::isActive(), CopasiWidget::mFramework, mpParameterSet, mpParameterSetCopy, mpParameterSetDM, CQParameterOverviewDM::setFramework(), and CopasiWidget::setFramework().

154 {
155  CopasiWidget::setFramework(framework);
156 
157  if (mpParameterSet == NULL)
158  {
159  return;
160  }
161 
162  if (!mpParameterSet->isActive())
163  {
164  mpParameterSetCopy->compareWithModel(static_cast< CModelParameter::Framework >(mFramework));
165  }
166 
167  mpParameterSetDM->setFramework(framework);
168  mpTreeView->expandAll();
169  mpTreeView->resizeColumnToContents(3);
170 }
bool compareWithModel(const CModelParameter::Framework &framework)
CQParameterOverviewDM * mpParameterSetDM
void setFramework(const int &framework)
CModelParameterSet * mpParameterSetCopy
virtual void setFramework(int framework)
void CQParameterOverviewWidget::slotBtnCommit ( )
protectedvirtualslot

Definition at line 248 of file CQParameterOverviewWidget.cpp.

References enterProtected(), and leave().

Referenced by slotBtnCopy(), slotBtnNew(), slotBtnSaveAs(), and slotBtnSaveToFile().

249 {
250  mpBtnCommit->setFocus();
251  leave();
252  enterProtected();
253 }
void CQParameterOverviewWidget::slotBtnCopy ( )
protectedvirtualslot

Definition at line 354 of file CQParameterOverviewWidget.cpp.

References ListViews::ADD, CCopasiVectorN< CType >::add(), C_INVALID_INDEX, CCopasiVectorN< CType >::getIndex(), CModelParameterSet::getKey(), CModelParameterSet::getModel(), CModel::getModelParameterSet(), CModel::getModelParameterSets(), ListViews::MODELPARAMETERSET, CopasiWidget::mpListView, mpParameterSet, CopasiWidget::protectedNotify(), CCopasiObject::setObjectName(), slotBtnCommit(), ListViews::switchToOtherWidget(), and TO_UTF8.

355 {
356  // commit all changes
357  slotBtnCommit();
358 
359  // Sanity checks
360  if (mpParameterSet == NULL)
361  {
362  return;
363  }
364 
365  CModel * pModel = mpParameterSet->getModel();
366 
367  if (pModel == NULL)
368  {
369  return;
370  }
371 
373  std::string Name = "Parameter Set";
374  int i = 0;
375 
376  while (Sets.getIndex(Name) != C_INVALID_INDEX)
377  {
378  i++;
379  Name = "Parameter Set ";
380  Name += TO_UTF8(QString::number(i));
381  }
382 
383  CModelParameterSet * pNew = new CModelParameterSet(pModel->getModelParameterSet(), pModel, false);
384  pNew->setObjectName(Name);
385  Sets.add(pNew, true);
386 
387  // Notify the GUI of the insert
389 
391 }
const CModelParameterSet & getModelParameterSet() const
Definition: CModel.cpp:1072
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
#define C_INVALID_INDEX
Definition: copasi.h:222
virtual size_t getIndex(const std::string &name) const
virtual bool add(const CType &src)
virtual const std::string & getKey() const
ListViews * mpListView
Definition: copasiWidget.h:62
const CCopasiVectorN< CModelParameterSet > & getModelParameterSets() const
Definition: CModel.cpp:1066
virtual bool protectedNotify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
Definition: CModel.h:50
bool setObjectName(const std::string &name)
CModel * getModel() const
void CQParameterOverviewWidget::slotBtnDelete ( )
protectedvirtualslot

Definition at line 256 of file CQParameterOverviewWidget.cpp.

References ListViews::DELETE, CModelParameterSet::getModel(), CModel::getModelParameterSets(), CCopasiObject::getObjectName(), CopasiWidget::mKey, ListViews::MODELPARAMETERSET, mpParameterSet, mpParameterSetDM, CopasiWidget::protectedNotify(), CCopasiVectorN< CType >::remove(), and CQParameterOverviewDM::setModelParameterset().

257 {
258  if (mpParameterSet == NULL)
259  {
260  return;
261  }
262 
263  CModel * pModel = mpParameterSet->getModel();
264 
265  if (pModel == NULL)
266  {
267  return;
268  }
269 
271 
273 
274  // Notify the GUI of the delete.
276 }
const std::string & getObjectName() const
CQParameterOverviewDM * mpParameterSetDM
const CCopasiVectorN< CModelParameterSet > & getModelParameterSets() const
Definition: CModel.cpp:1066
virtual bool protectedNotify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
virtual void remove(const std::string &name)
Definition: CModel.h:50
std::string mKey
Definition: copasiWidget.h:63
void setModelParameterset(CModelParameterSet *pModelParameterSet)
CModel * getModel() const
void CQParameterOverviewWidget::slotBtnNew ( )
protectedvirtualslot

Definition at line 279 of file CQParameterOverviewWidget.cpp.

References ListViews::ADD, CCopasiVectorN< CType >::add(), CModelParameterSet::assignSetContent(), CCopasiVector< T >::begin(), ListViews::CHANGE, CCopasiVector< T >::end(), enterProtected(), FROM_UTF8, CModelParameterSet::getKey(), CModel::getKey(), CModelParameterSet::getModel(), CModel::getModelParameterSet(), CModel::getModelParameterSets(), CQNameSelectionDialog::getSelection(), ListViews::MODELPARAMETERSET, mpParameterSet, CopasiWidget::protectedNotify(), CQMessageBox::question(), CCopasiObject::setObjectName(), CQNameSelectionDialog::setSelectionList(), slotBtnCommit(), ListViews::STATE, TO_UTF8, and CModelParameterSet::updateModel().

280 {
281  // This button is shown as Apply and is used to assign the parameter values to the model.
282 
283  // commit all changes
284  slotBtnCommit();
285 
286  // Sanity checks
287  if (mpParameterSet == NULL)
288  {
289  return;
290  }
291 
292  CModel * pModel = mpParameterSet->getModel();
293 
294  if (pModel == NULL)
295  {
296  return;
297  }
298 
299  // We first asked whether the user wants to save the current model values
300  if (CQMessageBox::question(this, "Save current Model Parameters?",
301  "You are about to overwrite the current model values.\n"
302  "Do you want to save them?",
303  QMessageBox::Save | QMessageBox::Discard,
304  QMessageBox::Save) == QMessageBox::Save)
305  {
306  // Save the parameter set to a new or existing set
307  CQNameSelectionDialog Dialog(this);
308 
310 
313  QStringList SelectionList;
314 
315  for (; it != end; ++it)
316  {
317  SelectionList.append(FROM_UTF8((*it)->getName()));
318  }
319 
320  Dialog.setSelectionList(SelectionList);
321  QString Name;
322 
323  if (Dialog.exec() != QDialog::Rejected &&
324  (Name = Dialog.getSelection()) != "")
325  {
326  if (SelectionList.indexOf(Name) == -1)
327  {
328  CModelParameterSet * pNew = new CModelParameterSet(pModel->getModelParameterSet(), pModel, false);
329  pNew->setObjectName(TO_UTF8(Name));
330  Sets.add(pNew, true);
331 
332  // Notify the GUI of the insert
334  }
335  else
336  {
337  CModelParameterSet * pExisting = Sets[TO_UTF8(Name)];
338  pExisting->assignSetContent(pModel->getModelParameterSet(), false);
339 
340  // Notify the GUI of the insert
342  }
343  }
344  }
345 
347 
348  // Notify the GUI that the model state has changed.
350 
351  enterProtected();
352 }
const CModelParameterSet & getModelParameterSet() const
Definition: CModel.cpp:1072
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
iterator begin()
iterator end()
virtual bool add(const CType &src)
virtual const std::string & getKey() const
const CCopasiVectorN< CModelParameterSet > & getModelParameterSets() const
Definition: CModel.cpp:1066
const std::string & getKey() const
Definition: CModel.cpp:1142
virtual bool protectedNotify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
Definition: CModel.h:50
bool setObjectName(const std::string &name)
void assignSetContent(const CModelParameterSet &src, const bool &createMissing)
virtual bool updateModel()
CModel * getModel() const
static StandardButton question(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void CQParameterOverviewWidget::slotBtnRevert ( )
protectedvirtualslot

Definition at line 241 of file CQParameterOverviewWidget.cpp.

References enterProtected().

242 {
243  mpBtnRevert->setFocus();
244  enterProtected();
245 }
void CQParameterOverviewWidget::slotBtnSaveAs ( )
protectedvirtualslot

Definition at line 445 of file CQParameterOverviewWidget.cpp.

References ListViews::ADD, CCopasiVectorN< CType >::add(), CModelParameterSet::assignSetContent(), CCopasiVector< T >::begin(), ListViews::CHANGE, CCopasiVector< T >::end(), FROM_UTF8, CModelParameterSet::getKey(), CModelParameterSet::getModel(), CModel::getModelParameterSets(), CQNameSelectionDialog::getSelection(), ListViews::MODELPARAMETERSET, mpParameterSet, CopasiWidget::protectedNotify(), CCopasiObject::setObjectName(), CQNameSelectionDialog::setSelectionList(), slotBtnCommit(), and TO_UTF8.

446 {
447  // commit all changes
448  slotBtnCommit();
449 
450  if (mpParameterSet == NULL)
451  {
452  return;
453  }
454 
455  CModel * pModel = mpParameterSet->getModel();
456 
457  if (pModel == NULL)
458  {
459  return;
460  }
461 
462  // Save the parameter set to a new or existing set
463  CQNameSelectionDialog Dialog(this);
464 
466 
469  QStringList SelectionList;
470 
471  for (; it != end; ++it)
472  {
473  SelectionList.append(FROM_UTF8((*it)->getName()));
474  }
475 
476  Dialog.setSelectionList(SelectionList);
477 
478  if (Dialog.exec() == QDialog::Rejected)
479  {
480  return;
481  }
482 
483  QString Name = Dialog.getSelection();
484 
485  if (Name == "")
486  {
487  return;
488  }
489 
490  if (SelectionList.indexOf(Name) == -1)
491  {
492  CModelParameterSet * pNew = new CModelParameterSet(*mpParameterSet, pModel, false);
493  pNew->setObjectName(TO_UTF8(Name));
494  Sets.add(pNew, true);
495 
496  // Notify the GUI of the insert
498  }
499  else
500  {
501  CModelParameterSet * pExisting = Sets[TO_UTF8(Name)];
502  pExisting->assignSetContent(*mpParameterSet, false);
503 
504  // Notify the GUI of the insert
506  }
507 
508  return;
509 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
iterator begin()
iterator end()
virtual bool add(const CType &src)
virtual const std::string & getKey() const
const CCopasiVectorN< CModelParameterSet > & getModelParameterSets() const
Definition: CModel.cpp:1066
virtual bool protectedNotify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
Definition: CModel.h:50
bool setObjectName(const std::string &name)
void assignSetContent(const CModelParameterSet &src, const bool &createMissing)
CModel * getModel() const
void CQParameterOverviewWidget::slotBtnSaveToFile ( )
protectedvirtualslot

Definition at line 394 of file CQParameterOverviewWidget.cpp.

References C_INT32, checkSelection(), CLocaleString::fromUtf8(), CopasiFileDialog::getSaveFileName(), CopasiWidget::mFramework, mpParameterSet, CModelParameterSet::saveToStream(), slotBtnCommit(), and TO_UTF8.

395 {
396  // Commit all changes
397  slotBtnCommit();
398 
399  C_INT32 Answer = QMessageBox::No;
400  QString fileName;
401 
402  while (Answer == QMessageBox::No)
403  {
404  fileName =
405  CopasiFileDialog::getSaveFileName(this, "Save File Dialog",
406  "untitled.tsv", "Tab Separated Files (*.tsv);;Comma Separated Files (*.csv);;TEXT Files (*.txt)", "Save as");
407 
408  if (fileName.isEmpty()) return;
409 
410  // Checks whether the file exists
411  Answer = checkSelection(fileName);
412 
413  if (Answer == QMessageBox::Cancel) return;
414  }
415 
416  std::ofstream file(CLocaleString::fromUtf8(TO_UTF8(fileName)).c_str());
417 
418  if (file.fail()) return;
419 
420  std::string mode;
421  std::string separator;
422 
423  if (fileName.endsWith(".txt"))
424  {
425  mode = "report";
426  separator = "\t";
427  }
428  else if (fileName.endsWith(".csv"))
429  {
430  mode = "table";
431  separator = ",";
432  }
433  else
434  {
435  mode = "table";
436  separator = "\t";
437  }
438 
439  mpParameterSet->saveToStream(file, static_cast< CModelParameter::Framework >(mFramework), mode, separator);
440 
441  file.close();
442 }
#define C_INT32
Definition: copasi.h:90
bool saveToStream(std::ostream &os, const CModelParameter::Framework &framework, const std::string &mode, const std::string &separator)
C_INT32 checkSelection(const QString &file)
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
static CLocaleString fromUtf8(const std::string &utf8)
static QString getSaveFileName(QWidget *parent=0, const char *name=0, const QString &startWith=QString::null, const QString &filter=QString::null, const QString &caption=QString::null, QString *pSelectedFilter=NULL, QFileDialog::Options options=0)
void CQParameterOverviewWidget::slotCloseEditor ( const QModelIndex &  index)
protectedslot

Definition at line 525 of file CQParameterOverviewWidget.cpp.

Referenced by CQParameterOverviewWidget().

526 {
527  QModelIndex Tmp = index;
528  const QAbstractItemModel *pModel = Tmp.model();
529 
530  while (pModel->inherits("QSortFilterProxyModel"))
531  {
532  Tmp = static_cast< const QSortFilterProxyModel *>(pModel)->mapToSource(index);
533  pModel = Tmp.model();
534  }
535 
536  mpTreeView->closePersistentEditor(Tmp);
537 }
void CQParameterOverviewWidget::slotOpenEditor ( const QModelIndex &  index)
protectedslot

Definition at line 511 of file CQParameterOverviewWidget.cpp.

References mpParameterSetSortDM.

Referenced by CQParameterOverviewWidget().

512 {
513  QModelIndex Tmp = index;
514  const QAbstractItemModel *pModel = Tmp.model();
515 
516  while (pModel->inherits("QSortFilterProxyModel"))
517  {
518  Tmp = static_cast< const QSortFilterProxyModel *>(pModel)->mapToSource(index);
519  pModel = Tmp.model();
520  }
521 
522  mpTreeView->openPersistentEditor(mpParameterSetSortDM->mapFromSource(Tmp));
523 }
QSortFilterProxyModel * mpParameterSetSortDM
void CQParameterOverviewWidget::slotResolve ( const QModelIndex &  index)
protectedslot

Definition at line 539 of file CQParameterOverviewWidget.cpp.

References buildSelectionList(), CModelParameterSet::compareWithModel(), CopasiWidget::mFramework, mpParameterSetCopy, mpParameterSetDM, CQParameterOverviewDM::nodeFromIndex(), CModelParameter::refreshFromModel(), and CQParameterOverviewDM::setFramework().

Referenced by CQParameterOverviewWidget().

540 {
541  CModelParameter * pModelParameter = mpParameterSetDM->nodeFromIndex(index);
542 
543  if (pModelParameter == NULL)
544  {
545  return;
546  }
547 
548  pModelParameter->refreshFromModel(true);
549 
550  mpParameterSetCopy->compareWithModel(static_cast< CModelParameter::Framework >(mFramework));
551 
553 
555 
556  mpTreeView->expandAll();
557  mpTreeView->resizeColumnToContents(3);
558 }
bool compareWithModel(const CModelParameter::Framework &framework)
CQParameterOverviewDM * mpParameterSetDM
static CModelParameter * nodeFromIndex(const QModelIndex &index)
virtual bool refreshFromModel(const bool &modifyExistence)
void setFramework(const int &framework)
CModelParameterSet * mpParameterSetCopy
bool CQParameterOverviewWidget::update ( ListViews::ObjectType  objectType,
ListViews::Action  action,
const std::string &  key 
)
virtual

Reimplemented from CopasiWidget.

Definition at line 63 of file CQParameterOverviewWidget.cpp.

References ListViews::ADD, ListViews::CHANGE, ListViews::DELETE, enterProtected(), CopasiWidget::mIgnoreUpdates, CopasiWidget::mKey, ListViews::MODEL, ListViews::MODELPARAMETERSET, CopasiWidget::mpObject, ListViews::PARAMETEROVERVIEW, and ListViews::STATE.

64 {
65  if (mIgnoreUpdates)
66  {
67  return true;
68  }
69 
70  switch (objectType)
71  {
72  case ListViews::STATE:
74  break;
75 
76  case ListViews::MODEL:
77 
78  if (action == ListViews::ADD ||
79  action == ListViews::DELETE)
80  {
81  mKey = "";
82  mpObject = NULL;
83 
85  }
86 
87  break;
88 
91 
92  if (mKey == key)
93  {
94  switch (action)
95  {
96  case ListViews::DELETE:
97  mKey = "";
98  mpObject = NULL;
99 
100  enterProtected();
101  break;
102 
103  case ListViews::CHANGE:
104  enterProtected();
105  break;
106 
107  default:
108  break;
109  }
110  }
111 
112  break;
113 
114  default:
115  break;
116  }
117 
118  return true;
119 }
objectType
CCopasiObject * mpObject
Definition: copasiWidget.h:64
bool mIgnoreUpdates
Definition: copasiWidget.h:67
std::string mKey
Definition: copasiWidget.h:63

Member Data Documentation

QStringList CQParameterOverviewWidget::mGlobalQuantities
private
CModelParameterSet* CQParameterOverviewWidget::mpParameterSet
private
CModelParameterSet* CQParameterOverviewWidget::mpParameterSetCopy
private
CQParameterOverviewDM* CQParameterOverviewWidget::mpParameterSetDM
private
QSortFilterProxyModel* CQParameterOverviewWidget::mpParameterSetSortDM
private

Definition at line 53 of file CQParameterOverviewWidget.h.

Referenced by CQParameterOverviewWidget(), and slotOpenEditor().


The documentation for this class was generated from the following files: