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

#include <CQEventWidget1.h>

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

Public Member Functions

 CQEventWidget1 (QWidget *parent=0, const char *name=0)
 
virtual bool leave ()
 
virtual bool update (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key)
 
 ~CQEventWidget1 ()
 
- 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 ()
 
virtual void setFramework (int framework)
 
void setIgnoreUpdates (bool v)
 

Protected Member Functions

virtual bool enterProtected ()
 

Private Slots

void slotActualizeAssignmentExpression (int index)
 Slot to actualize the assignment expression widget of event assignment according to the target. More...
 
void slotAddTarget ()
 
void slotBtnCopy ()
 
void slotBtnDelete ()
 
void slotBtnNew ()
 Slot to create a new event; activated whenever the New button is clicked. More...
 
void slotChooseDelay (int choice)
 
void slotDeleteTarget ()
 
void slotSelectObject ()
 Slot to select an object from the existing ones -only- for target. More...
 

Private Member Functions

void init ()
 
bool loadFromEvent ()
 
void saveToEvent ()
 
void showDelayExpression (bool display)
 

Private Attributes

std::string mAssignmentKey
 
CCopasiVector< CEventAssignmentmAssignments
 
bool mChanged
 
size_t mCurrentTarget
 
QString mEAName
 
bool mExpressionDelayValid
 
bool mExpressionEAValid
 
bool mExpressionTriggerValid
 
std::string mKeyToCopy
 
CEventmpEvent
 

Additional Inherited Members

- Protected Slots inherited from CopasiWidget
virtual bool protectedNotify (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
 
- Protected Attributes inherited from CopasiWidget
int mFramework
 
bool mIgnoreUpdates
 
std::string mKey
 
CCopasiDataModelmpDataModel
 
ListViewsmpListView
 
CCopasiObjectmpObject
 

Detailed Description

Definition at line 29 of file CQEventWidget1.h.

Constructor & Destructor Documentation

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

Definition at line 38 of file CQEventWidget1.cpp.

References init().

38  :
39  CopasiWidget(parent, name),
40  mKeyToCopy("")
41 {
42  setupUi(this);
43 
44  init();
45 }
std::string mKeyToCopy
CopasiWidget(QWidget *parent=0, const char *name=0, Qt::WFlags f=0)
CQEventWidget1::~CQEventWidget1 ( )

Definition at line 50 of file CQEventWidget1.cpp.

51 {
52  // no need to delete child widgets, Qt does it all for us
53 }

Member Function Documentation

bool CQEventWidget1::enterProtected ( )
protectedvirtual

Function to interact with an object of class CEvent

Reimplemented from CopasiWidget.

Definition at line 415 of file CQEventWidget1.cpp.

References C_INVALID_INDEX, CKeyFactory::get(), CCopasiRootContainer::getKeyFactory(), loadFromEvent(), mCurrentTarget, mKeyToCopy, mpEvent, CopasiWidget::mpListView, CopasiWidget::mpObject, and ListViews::switchToOtherWidget().

416 {
417  bool success = true;
418 
419  if (mKeyToCopy != "")
420  {
422  mKeyToCopy = "";
423  }
424  else
425  {
426  mpEvent = dynamic_cast<CEvent*>(mpObject);
427  }
428 
430 
431  if (mpEvent)
432  {
433  success = loadFromEvent();
434  }
435 
436  mpEvent = dynamic_cast<CEvent*>(mpObject);
437 
438  if (!success)
439  {
440  mpListView->switchToOtherWidget(114, ""); //TODO
441  }
442 
443  return success;
444 }
Definition: CEvent.h:152
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
std::string mKeyToCopy
CCopasiObject * get(const std::string &key)
CCopasiObject * mpObject
Definition: copasiWidget.h:64
#define C_INVALID_INDEX
Definition: copasi.h:222
CEvent * mpEvent
size_t mCurrentTarget
ListViews * mpListView
Definition: copasiWidget.h:62
static CKeyFactory * getKeyFactory()
void CQEventWidget1::init ( )
private

Definition at line 105 of file CQEventWidget1.cpp.

References CQIconResource::copasi, CQIconResource::editAdd, CQIconResource::editDelete, CQIconResource::icon(), mExpressionDelayValid, mExpressionEAValid, mExpressionTriggerValid, showDelayExpression(), slotActualizeAssignmentExpression(), slotChooseDelay(), and CQExpressionWidget::TransientExpression.

Referenced by CQEventWidget1().

106 {
107  showDelayExpression(false);
108 
109  // SIGNAL-SLOT connections
110  connect(mpComboBoxDelay, SIGNAL(currentIndexChanged(int)), this, SLOT(slotChooseDelay(int)));
111  connect(mpLBTarget, SIGNAL(currentRowChanged(int)), this, SLOT(slotActualizeAssignmentExpression(int)));
112 
113 // mpExpressionTrigger->mpExpressionWidget->setBoolean(true);
114  mpExpressionTrigger->mpExpressionWidget->setBoolean(true);
115  mExpressionDelayValid = true;
116  mpExpressionDelay->mpExpressionWidget->setExpressionType(CQExpressionWidget::TransientExpression);
117 
118  mExpressionTriggerValid = false;
119  // mpExpressionTrigger->mpExpressionWidget->setExpressionType(CQSimpleSelectionTree::TRANSIENT_EXPRESSION);
120 
121  mExpressionEAValid = false;
122  mpExpressionEA->mpExpressionWidget->setExpressionType(CQExpressionWidget::TransientExpression);
123 
124  // ----- correlated to GUI layout of the event assignment ----
125 
126  // hide the label and widget with respect to expression
127  mpLabelEA->setEnabled(false);
128  mpExpressionEA->setEnabled(false);
129 
130  // Set the icons for the buttons
131  mpBtnSelectObject->setIcon(CQIconResource::icon(CQIconResource::copasi));
132  mpBtnAddTarget->setIcon(CQIconResource::icon(CQIconResource::editAdd));
133  mpBtnDeleteTarget->setIcon(CQIconResource::icon(CQIconResource::editDelete));
134 }
bool mExpressionDelayValid
bool mExpressionTriggerValid
void slotChooseDelay(int choice)
void slotActualizeAssignmentExpression(int index)
Slot to actualize the assignment expression widget of event assignment according to the target...
static const QIcon & icon(const IconID &id)
void showDelayExpression(bool display)
bool CQEventWidget1::leave ( )
virtual

The slot to be done before leaving the active event widget

Reimplemented from CopasiWidget.

Definition at line 447 of file CQEventWidget1.cpp.

References saveToEvent().

448 {
449  saveToEvent();
450 
451  return true;
452 }
bool CQEventWidget1::loadFromEvent ( )
private

Load all values with respect to a chosen saved event

Definition at line 178 of file CQEventWidget1.cpp.

References CCopasiVector< T >::add(), CCopasiVector< T >::begin(), C_INVALID_INDEX, CCopasiVector< T >::clear(), CCopasiVector< T >::end(), FROM_UTF8, CKeyFactory::get(), CEvent::getAssignments(), CEvent::getDelayAssignment(), CEvent::getDelayExpression(), CCopasiRootContainer::getKeyFactory(), CCopasiObject::getObjectAncestor(), CCopasiObject::getObjectDisplayName(), CEvent::getTriggerExpression(), mAssignments, mChanged, mCurrentTarget, mpEvent, CModelEntity::setExpression(), and CCopasiVector< T >::size().

Referenced by enterProtected().

179 {
180  if (mpEvent == NULL) return false;
181 
182  const CModel * pModel =
183  dynamic_cast< const CModel * >(mpEvent->getObjectAncestor("Model"));
184 
185  if (pModel == NULL) return false;
186 
187  // *** Expression of Trigger
188  mpExpressionTrigger->mpExpressionWidget->setExpression(mpEvent->getTriggerExpression());
189  mpExpressionTrigger->updateWidget(); // bring into view mode
190 
191  // *** Expression of Delay
192  mpExpressionDelay->mpExpressionWidget->setExpression(mpEvent->getDelayExpression());
193  mpExpressionDelay->updateWidget(); // bring into view mode
194 
195  if (mpEvent->getDelayExpression() == "")
196  {
197  mpComboBoxDelay->setCurrentIndex(0); // Set Delay to "None"
198  }
199  else if (mpEvent->getDelayAssignment())
200  {
201  mpComboBoxDelay->setCurrentIndex(2); // Assignment only
202  }
203  else
204  {
205  mpComboBoxDelay->setCurrentIndex(1); // Calculation and Assignment
206  }
207 
208  // copy assignment from event
211 
213  QStringList Targets;
214 
215  int ijk = 0;
216 
217  for (; it != end; ++it, ijk++)
218  {
219  const CModelEntity * pEntity =
220  dynamic_cast< CModelEntity * >(CCopasiRootContainer::getKeyFactory()->get((*it)->getTargetKey()));
221 
222  if (pEntity != NULL)
223  {
224  Targets.append(FROM_UTF8(pEntity->getObjectDisplayName()));
225  mAssignments.add(**it);
226 
227 #ifdef XXXX // Add type dependent information
228 
229  if (sObjectName == "Compartment")
230  {
231  sName = FROM_UTF8(CCopasiRootContainer::getKeyFactory()->get(it->first)->getObjectDisplayName() + ".Volume");
232  }
233 
234  if (sObjectName == "Metabolite")
235  {
236  sName = FROM_UTF8("[" + CCopasiRootContainer::getKeyFactory()->get(it->first)->getObjectDisplayName() + "]");
237  }
238 
239  if (sObjectName.contains("ModelValue"))
240  {
241  sName = FROM_UTF8(CCopasiRootContainer::getKeyFactory()->get(it->first)->getObjectDisplayName());
242  }
243 
244 #endif // XXXX
245  }
246  }
247 
248  // fill the list box and the expression widget with correct assignments
249  mpLBTarget->clear();
250  mpLBTarget->insertItems(0, Targets);
251 
252  size_t NewTarget = mCurrentTarget;
253 
255  mAssignments.size() > 0)
256  {
257  NewTarget = 0;
258  }
259 
260  mpLBTarget->setCurrentRow((int) NewTarget);
261 
262  mChanged = false;
263 
264  return true;
265 }
CCopasiContainer * getObjectAncestor(const std::string &type) const
const CCopasiVectorN< CEventAssignment > & getAssignments() const
Definition: CEvent.cpp:678
virtual std::string getObjectDisplayName(bool regular=true, bool richtext=false) const
const bool & getDelayAssignment() const
Definition: CEvent.cpp:419
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
virtual size_t size() const
CCopasiObject * get(const std::string &key)
iterator begin()
#define C_INVALID_INDEX
Definition: copasi.h:222
std::string getTriggerExpression() const
Definition: CEvent.cpp:524
CEvent * mpEvent
size_t mCurrentTarget
iterator end()
virtual bool add(const CType &src)
std::string getDelayExpression() const
Definition: CEvent.cpp:591
static CKeyFactory * getKeyFactory()
virtual void clear()
Definition: CModel.h:50
bool setExpression(const std::string &expression)
CCopasiVector< CEventAssignment > mAssignments
void CQEventWidget1::saveToEvent ( )
private

The slot to save all current values of the active event widget

Definition at line 268 of file CQEventWidget1.cpp.

References CCopasiVectorN< CType >::add(), CCopasiVector< T >::begin(), C_INVALID_INDEX, ListViews::CHANGE, CCopasiVector< T >::end(), ListViews::EVENT, CEvent::getAssignments(), CCopasiRootContainer::getDatamodelList(), CEvent::getDelayAssignment(), CEvent::getDelayExpression(), CCopasiVectorN< CType >::getIndex(), CCopasiObject::getObjectAncestor(), CEvent::getTriggerExpression(), mAssignments, mChanged, mCurrentTarget, CopasiWidget::mKey, mpEvent, CopasiWidget::protectedNotify(), CCopasiVectorN< CType >::remove(), CEvent::setDelayAssignment(), CEvent::setDelayExpression(), CEvent::setTriggerExpression(), and CCopasiVector< T >::size().

Referenced by leave(), and slotBtnNew().

269 {
270  if (mpEvent == NULL) return;
271 
272  const CModel * pModel =
273  dynamic_cast< const CModel * >(mpEvent->getObjectAncestor("Model"));
274 
275  if (pModel == NULL) return;
276 
277  if (mpEvent->getTriggerExpression() != mpExpressionTrigger->mpExpressionWidget->getExpression())
278  {
279  mpEvent->setTriggerExpression(mpExpressionTrigger->mpExpressionWidget->getExpression());
280  mChanged = true;
281  }
282 
283  switch (mpComboBoxDelay->currentIndex())
284  {
285  case 0:
287 
288  if (mpEvent->getDelayAssignment() != false)
289  {
290  mpEvent->setDelayAssignment(false);
291  mChanged = true;
292  }
293 
294  break;
295 
296  case 1:
297 
298  if (mpEvent->getDelayExpression() != mpExpressionDelay->mpExpressionWidget->getExpression())
299  {
300  mpEvent->setDelayExpression(mpExpressionDelay->mpExpressionWidget->getExpression());
301  mChanged = true;
302  }
303 
304  if (mpEvent->getDelayAssignment() != false)
305  {
306  mpEvent->setDelayAssignment(false);
307  mChanged = true;
308  }
309 
310  break;
311 
312  case 2:
313 
314  if (mpEvent->getDelayExpression() != mpExpressionDelay->mpExpressionWidget->getExpression())
315  {
316  mpEvent->setDelayExpression(mpExpressionDelay->mpExpressionWidget->getExpression());
317  mChanged = true;
318  }
319 
320  if (mpEvent->getDelayAssignment() != true)
321  {
323  mChanged = true;
324  }
325 
326  break;
327  }
328 
329  // Save the event assignments
330  // First we make sure that the current assignment is saved
332  {
333  mAssignments[mCurrentTarget]->setExpression(mpExpressionEA->mpExpressionWidget->getExpression());
334  }
335 
338 
340  size_t Found;
341 
342  // We first update all assignments.
343  for (; it != end; ++it)
344  {
345  Found = OldAssignments.getIndex((*it)->getTargetKey());
346 
347  if (Found == C_INVALID_INDEX)
348  {
349  OldAssignments.add(**it);
350  mChanged = true;
351  }
352  else if (OldAssignments[Found]->getExpression() != (*it)->getExpression())
353  {
354  OldAssignments[Found]->setExpression((*it)->getExpression());
355  mChanged = true;
356  }
357  }
358 
359  // Find the deleted assignments and mark them.
362 
363  size_t DeleteCount = 0;
364 
365  if (OldAssignments.size() > mAssignments.size())
366  {
367  DeleteCount = OldAssignments.size() - mAssignments.size();
368  }
369 
370  std::vector< std::string > ToBeDeleted;
371 
372  for (; itOld != endOld && DeleteCount > 0; ++itOld)
373  {
374  const std::string & key = (*itOld)->getTargetKey();
375 
376  for (it = mAssignments.begin(); it != end; ++it)
377  {
378  if (key == (*it)->getTargetKey()) break;
379  }
380 
381  if (it == end)
382  {
383  ToBeDeleted.push_back(key);
384  DeleteCount--;
385  mChanged = true;
386  }
387  }
388 
389  // Delete the assignments marked to be deleted.
390  std::vector< std::string >::const_iterator itDelete = ToBeDeleted.begin();
391  std::vector< std::string >::const_iterator endDelete = ToBeDeleted.end();
392 
393  for (; itDelete != endDelete; ++itDelete)
394  {
395  OldAssignments.remove(*itDelete);
396  }
397 
398  if (mChanged)
399  {
400  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
401  (*CCopasiRootContainer::getDatamodelList())[0]->changed();
403  }
404 
405  mChanged = false;
406 }
CCopasiContainer * getObjectAncestor(const std::string &type) const
const CCopasiVectorN< CEventAssignment > & getAssignments() const
Definition: CEvent.cpp:678
const bool & getDelayAssignment() const
Definition: CEvent.cpp:419
virtual size_t size() const
iterator begin()
#define C_INVALID_INDEX
Definition: copasi.h:222
std::string getTriggerExpression() const
Definition: CEvent.cpp:524
virtual size_t getIndex(const std::string &name) const
CEvent * mpEvent
size_t mCurrentTarget
iterator end()
virtual bool add(const CType &src)
bool setTriggerExpression(const std::string &expression)
Definition: CEvent.cpp:474
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
void setDelayAssignment(const bool &delayCalculation)
Definition: CEvent.cpp:408
virtual bool protectedNotify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
std::string getDelayExpression() const
Definition: CEvent.cpp:591
virtual void remove(const std::string &name)
bool setDelayExpression(const std::string &expression)
Definition: CEvent.cpp:544
Definition: CModel.h:50
std::string mKey
Definition: copasiWidget.h:63
CCopasiVector< CEventAssignment > mAssignments
void CQEventWidget1::showDelayExpression ( bool  show)
private

Function to apply the Delay Expression Widget

Definition at line 519 of file CQEventWidget1.cpp.

Referenced by init(), and slotChooseDelay().

520 {
521  if (show)
522  {
523  mpLabelDelayExpression->show();
524  mpExpressionDelay->show();
525  }
526  else
527  {
528  mpLabelDelayExpression->hide();
529  mpExpressionDelay->hide();
530  }
531 }
void CQEventWidget1::slotActualizeAssignmentExpression ( int  index)
privateslot

Slot to actualize the assignment expression widget of event assignment according to the target.

Definition at line 480 of file CQEventWidget1.cpp.

References C_INVALID_INDEX, mAssignments, mCurrentTarget, and CCopasiVector< T >::size().

Referenced by init().

481 {
482  size_t NewTarget = (size_t) index;
483 
484  if (NewTarget != C_INVALID_INDEX &&
485  NewTarget >= mAssignments.size())
486  {
487  NewTarget = mAssignments.size() - 1;
488  }
489 
490  // Save the current assignment
491  if (NewTarget != mCurrentTarget &&
493  {
494  mAssignments[mCurrentTarget]->setExpression(mpExpressionEA->mpExpressionWidget->getExpression());
495  }
496 
497  mCurrentTarget = NewTarget;
498 
499  if (mCurrentTarget == C_INVALID_INDEX) // no target anymore
500  {
501  // hide the label and widget with respect to expression
502  mpLabelEA->setEnabled(false);
503  mpExpressionEA->setEnabled(false);
504 
505  return;
506  }
507  else
508  {
509  // show the label and widget with respect to expression
510  mpLabelEA->setEnabled(true);
511  mpExpressionEA->setEnabled(true);
512 
513  mpExpressionEA->mpExpressionWidget->setExpression(mAssignments[mCurrentTarget]->getExpression());
514  mpExpressionEA->updateWidget();
515  }
516 }
virtual size_t size() const
#define C_INVALID_INDEX
Definition: copasi.h:222
size_t mCurrentTarget
CCopasiVector< CEventAssignment > mAssignments
void CQEventWidget1::slotAddTarget ( )
privateslot

Slot to add a new target without object target nor its expression Impact only on the appearance.

Definition at line 139 of file CQEventWidget1.cpp.

References CCopasiVector< T >::add(), CQSimpleSelectionTree::EventTarget, FROM_UTF8, CModelEntity::getKey(), CCopasiObject::getObjectDisplayName(), CCopasiObject::getObjectParent(), CCopasiSelectionDialog::getObjectSingle(), mAssignments, and CCopasiVector< T >::size().

Referenced by slotSelectObject().

140 {
143 
144  const CCopasiObject * pObject =
146 
147  if (pObject == NULL) return;
148 
149  const CModelEntity * pME = dynamic_cast< const CModelEntity * >(pObject->getObjectParent());
150 
151  if (pME == NULL) return;
152 
153  mAssignments.add(new CEventAssignment(pME->getKey()), true);
154  mpLBTarget->addItem(FROM_UTF8(pME->getObjectDisplayName()));
155 
156  mpLBTarget->setCurrentRow((int)(mAssignments.size() - 1));
157 }
virtual std::string getObjectDisplayName(bool regular=true, bool richtext=false) const
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
virtual size_t size() const
virtual const std::string & getKey() const
virtual bool add(const CType &src)
CCopasiVector< CEventAssignment > mAssignments
static const CCopasiObject * getObjectSingle(QWidget *pParent, const CQSimpleSelectionTree::ObjectClasses &classes, const CCopasiObject *pCurrentObject=NULL)
CCopasiContainer * getObjectParent() const
void CQEventWidget1::slotBtnCopy ( )
privateslot

Definition at line 99 of file CQEventWidget1.cpp.

References CopasiWidget::mKey, and mKeyToCopy.

100 {
101  mKeyToCopy = mKey;
102 }
std::string mKeyToCopy
std::string mKey
Definition: copasiWidget.h:63
void CQEventWidget1::slotBtnDelete ( )
privateslot

Slot to delete the active event widget

Definition at line 56 of file CQEventWidget1.cpp.

References ListViews::DELETE, ListViews::EVENT, CCopasiRootContainer::getDatamodelList(), CCopasiDataModel::getModel(), CopasiWidget::mKey, mpEvent, CopasiWidget::protectedNotify(), and CModel::removeEvent().

57 {
58  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
60 
61  CModel * pModel = pDataModel->getModel();
62 
63  if (pModel == NULL)
64  return;
65 
66  pDataModel->getModel()->removeEvent(mKey);
67 
68  mpEvent = NULL;
69 
71 }
CEvent * mpEvent
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
virtual bool protectedNotify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
Definition: CModel.h:50
std::string mKey
Definition: copasiWidget.h:63
bool removeEvent(const size_t index, const bool &recursive=true)
Definition: CModel.cpp:2945
void CQEventWidget1::slotBtnNew ( )
privateslot

Slot to create a new event; activated whenever the New button is clicked.

Definition at line 74 of file CQEventWidget1.cpp.

References ListViews::ADD, C_INVALID_INDEX, ListViews::EVENT, CCopasiRootContainer::getDatamodelList(), CopasiWidget::mpListView, CopasiWidget::protectedNotify(), saveToEvent(), ListViews::switchToOtherWidget(), and TO_UTF8.

75 {
76  // save the current setting values
77  saveToEvent();
78 
79  // standard name
80  std::string name = "event_1";
81 
82  // if the standard name already exists then creating the new event will fail
83  // thus, a growing index will automatically be added to the standard name
84  int i = 1;
85  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
86 
87  while (!(*CCopasiRootContainer::getDatamodelList())[0]->getModel()->createEvent(name))
88  {
89  i++;
90  name = "event_";
91  name += TO_UTF8(QString::number(i));
92  }
93 
94  std::string key = (*CCopasiRootContainer::getDatamodelList())[0]->getModel()->getEvents()[name]->getKey();
97 }
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
#define C_INVALID_INDEX
Definition: copasi.h:222
ListViews * mpListView
Definition: copasiWidget.h:62
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
virtual bool protectedNotify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
void CQEventWidget1::slotChooseDelay ( int  choice)
privateslot

Definition at line 534 of file CQEventWidget1.cpp.

References showDelayExpression().

Referenced by init().

535 {
536  if (choice != 0) // Not "None"
537  {
538  showDelayExpression(true);
539  }
540  else
541  {
542  showDelayExpression(false);
543  }
544 }
void showDelayExpression(bool display)
void CQEventWidget1::slotDeleteTarget ( )
privateslot

Slot to remove the active target from the appearance Impact only on the appearance.

Definition at line 162 of file CQEventWidget1.cpp.

References mAssignments, mCurrentTarget, pdelete, CCopasiVector< T >::remove(), and CCopasiVector< T >::size().

163 {
164  if (mCurrentTarget > mAssignments.size() - 1 ||
165  mAssignments.size() == 0) return;
166 
167  size_t ToBeDeleted = mCurrentTarget;
168 
169  QListWidgetItem * pItem = mpLBTarget->takeItem((int) ToBeDeleted);
170  pdelete(pItem);
171 
172  mAssignments.remove(ToBeDeleted);
173 
174  mCurrentTarget = mpLBTarget->currentIndex().row();
175 }
#define pdelete(p)
Definition: copasi.h:215
virtual size_t size() const
size_t mCurrentTarget
virtual void remove(const size_t &index)
CCopasiVector< CEventAssignment > mAssignments
void CQEventWidget1::slotSelectObject ( )
privateslot

Slot to select an object from the existing ones -only- for target.

Definition at line 455 of file CQEventWidget1.cpp.

References C_INVALID_INDEX, CQSimpleSelectionTree::EventTarget, FROM_UTF8, CModelEntity::getKey(), CCopasiObject::getObjectDisplayName(), CCopasiObject::getObjectParent(), CCopasiSelectionDialog::getObjectSingle(), mAssignments, mCurrentTarget, and slotAddTarget().

456 {
458  return slotAddTarget();
459 
462 
463  const CCopasiObject * pObject =
465 
466  if (pObject == NULL) return;
467 
468  const CModelEntity * pME = dynamic_cast< const CModelEntity * >(pObject->getObjectParent());
469 
470  if (pME == NULL) return;
471 
472  if (mAssignments[mCurrentTarget]->setTargetKey(pME->getKey()))
473  {
474  // If the target key change was successful we need to update the label.
475  mpLBTarget->item((int) mCurrentTarget)->setText(FROM_UTF8(pME->getObjectDisplayName()));
476  }
477 }
virtual std::string getObjectDisplayName(bool regular=true, bool richtext=false) const
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
#define C_INVALID_INDEX
Definition: copasi.h:222
size_t mCurrentTarget
virtual const std::string & getKey() const
CCopasiVector< CEventAssignment > mAssignments
static const CCopasiObject * getObjectSingle(QWidget *pParent, const CQSimpleSelectionTree::ObjectClasses &classes, const CCopasiObject *pCurrentObject=NULL)
CCopasiContainer * getObjectParent() const
bool CQEventWidget1::update ( ListViews::ObjectType  objectType,
ListViews::Action  action,
const std::string &  key 
)
virtual

The slot to update the active event widget

Reimplemented from CopasiWidget.

Definition at line 409 of file CQEventWidget1.cpp.

410 {
411  return true;
412 }

Member Data Documentation

std::string CQEventWidget1::mAssignmentKey
private

Definition at line 52 of file CQEventWidget1.h.

CCopasiVector< CEventAssignment > CQEventWidget1::mAssignments
private
bool CQEventWidget1::mChanged
private

Definition at line 50 of file CQEventWidget1.h.

Referenced by loadFromEvent(), and saveToEvent().

size_t CQEventWidget1::mCurrentTarget
private
QString CQEventWidget1::mEAName
private

Definition at line 49 of file CQEventWidget1.h.

bool CQEventWidget1::mExpressionDelayValid
private

Definition at line 47 of file CQEventWidget1.h.

Referenced by init().

bool CQEventWidget1::mExpressionEAValid
private

Definition at line 48 of file CQEventWidget1.h.

Referenced by init().

bool CQEventWidget1::mExpressionTriggerValid
private

Definition at line 46 of file CQEventWidget1.h.

Referenced by init().

std::string CQEventWidget1::mKeyToCopy
private

Definition at line 60 of file CQEventWidget1.h.

Referenced by enterProtected(), and slotBtnCopy().

CEvent* CQEventWidget1::mpEvent
private

Definition at line 51 of file CQEventWidget1.h.

Referenced by enterProtected(), loadFromEvent(), saveToEvent(), and slotBtnDelete().


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