COPASI API  4.16.103
CScanWidgetRepeat.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/UI/CScanWidgetRepeat.cpp,v $
3 // $Revision: 1.9 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2011/12/22 19:51:57 $
7 // End CVS Header
8 
9 // Copyright (C) 2011 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
16 // and The University of Manchester.
17 // All rights reserved.
18 
19 #include <QtGui/QValidator>
20 
21 #include "copasi.h"
22 
23 #include "CScanWidgetRepeat.h"
24 #include "qtUtilities.h"
25 #include "CCopasiSelectionDialog.h"
26 
28 
29 /*
30  * Constructs a CScanWidgetRepeat as a child of 'parent', with the
31  * name 'name' and widget flags set to 'f'.
32  */
34  QWidget(parent),
35  CScanItemData(CScanProblem::SCAN_REPEAT)
36 {
37  setupUi(this);
38  init();
39 }
40 
42  QWidget(parent),
43  CScanItemData(src)
44 {
45  setupUi(this);
46  init();
47  load(mpData);
48 }
49 
50 /*
51  * Destroys the object and frees any allocated resources
52  */
54 {
55  // no need to delete child widgets, Qt does it all for us
56 }
57 
59 {
60  lineEditNumber->setValidator(new QIntValidator(lineEditNumber));
61 }
62 
63 // virtual
65 {
66  if (pItem == NULL) return;
67 
68  *mpData = *pItem;
69 
70  C_INT32 * tmp;
71 
72  if (!(tmp = mpData->getValue("Type").pINT))
73  return;
74 
76  return;
77 
78  if (!(tmp = mpData->getValue("Number of steps").pINT))
79  return;
80 
81  lineEditNumber->setText(QString::number(* tmp));
82 
83  return;
84 }
85 
86 // virtual
88 {
89  mpData->setValue("Number of steps", lineEditNumber->text().toUInt());
90 
91  if (pItem != NULL)
92  {
93  if (*mpData == *pItem) return false;
94 
95  *pItem = *mpData;
96  return true;
97  }
98 
99  return false;
100 }
CScanWidgetRepeat(QWidget *parent=0)
virtual void load(const CCopasiParameterGroup *pItem)
#define C_INT32
Definition: copasi.h:90
CCopasiParameterGroup * mpData
Definition: CScanItemData.h:42
bool setValue(const std::string &name, const CType &value)
virtual bool save(CCopasiParameterGroup *pItem) const
const CCopasiParameter::Value & getValue(const std::string &name) const