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

#include <CScanWidgetScan.h>

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

Public Member Functions

 CScanWidgetScan (QWidget *parent=0)
 
 CScanWidgetScan (const CScanWidgetScan &src, QWidget *parent=0)
 
void initFromObject (const CCopasiObject *obj)
 
virtual void load (const CCopasiParameterGroup *pItem)
 
virtual bool save (CCopasiParameterGroup *pItem) const
 
virtual ~CScanWidgetScan ()
 
- Public Member Functions inherited from CScanItemData
 CScanItemData (const CScanItemData &src)
 
const CScanProblem::TypegetType () const
 
virtual ~CScanItemData ()
 

Protected Slots

virtual void slotChooseObject ()
 

Protected Attributes

const CCopasiObjectmpObject
 
- Protected Attributes inherited from CScanItemData
CCopasiParameterGroupmpData
 
CScanProblem::Type mType
 

Private Member Functions

void init ()
 

Additional Inherited Members

- Protected Member Functions inherited from CScanItemData
 CScanItemData (const CScanProblem::Type &type)
 

Detailed Description

Definition at line 30 of file CScanWidgetScan.h.

Constructor & Destructor Documentation

CScanWidgetScan::CScanWidgetScan ( QWidget *  parent = 0)

Definition at line 37 of file CScanWidgetScan.cpp.

References CQIconResource::copasi, CQIconResource::icon(), and init().

37  :
38  QWidget(parent),
40 {
41  setupUi(this);
42 
43  buttonObject->setIcon(CQIconResource::icon(CQIconResource::copasi));
44 
45  init();
46 }
static const QIcon & icon(const IconID &id)
CScanWidgetScan::CScanWidgetScan ( const CScanWidgetScan src,
QWidget *  parent = 0 
)

Definition at line 48 of file CScanWidgetScan.cpp.

References CQIconResource::copasi, CQIconResource::icon(), init(), load(), and CScanItemData::mpData.

48  :
49  QWidget(parent),
50  CScanItemData(src)
51 {
52  setupUi(this);
53 
54  buttonObject->setIcon(CQIconResource::icon(CQIconResource::copasi));
55 
56  init();
57  load(mpData);
58 }
static const QIcon & icon(const IconID &id)
CCopasiParameterGroup * mpData
Definition: CScanItemData.h:42
virtual void load(const CCopasiParameterGroup *pItem)
CScanWidgetScan::~CScanWidgetScan ( )
virtual

Definition at line 63 of file CScanWidgetScan.cpp.

64 {
65  // no need to delete child widgets, Qt does it all for us
66 }

Member Function Documentation

void CScanWidgetScan::init ( )
private

Definition at line 68 of file CScanWidgetScan.cpp.

References mpObject.

Referenced by CScanWidgetScan().

69 {
70  lineEditObject->setReadOnly(true);
71 
72  lineEditNumber->setValidator(new QIntValidator(lineEditNumber));
73  lineEditMin->setValidator(new QDoubleValidator(lineEditMin));
74  lineEditMax->setValidator(new QDoubleValidator(lineEditMax));
75 
76  mpObject = NULL;
77 }
const CCopasiObject * mpObject
void CScanWidgetScan::initFromObject ( const CCopasiObject obj)

Definition at line 91 of file CScanWidgetScan.cpp.

References C_FLOAT64, FROM_UTF8, CCopasiObject::getObjectDisplayName(), CCopasiObject::getValuePointer(), CCopasiObject::isValueDbl(), and mpObject.

Referenced by ScanWidget::slotAddItem(), and slotChooseObject().

92 {
93  mpObject = obj;
94 
95  if (obj)
96  {
97  lineEditObject->setText(FROM_UTF8(obj->getObjectDisplayName()));
98 
99  if (obj->isValueDbl())
100  {
101  C_FLOAT64 value = *(C_FLOAT64*)obj->getValuePointer();
102  lineEditNumber->setText("10");
103  lineEditMin->setText(QString::number(value*0.5));
104  lineEditMax->setText(QString::number(value*2));
105  }
106  }
107  else
108  {
109  lineEditObject->setText("");
110  lineEditNumber->setText("");
111  lineEditMin->setText("");
112  lineEditMax->setText("");
113  }
114 }
virtual std::string getObjectDisplayName(bool regular=true, bool richtext=false) const
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
const CCopasiObject * mpObject
#define C_FLOAT64
Definition: copasi.h:92
bool isValueDbl() const
virtual void * getValuePointer() const
void CScanWidgetScan::load ( const CCopasiParameterGroup pItem)
virtual

Implements CScanItemData.

Definition at line 117 of file CScanWidgetScan.cpp.

References C_FLOAT64, C_INT32, FROM_UTF8, CCopasiRootContainer::getDatamodelList(), CCopasiDataModel::getDataObject(), CCopasiObject::getObjectDisplayName(), CCopasiParameterGroup::getValue(), CScanItemData::mpData, mpObject, CCopasiParameter::Value::pVOID, and CScanProblem::SCAN_LINEAR.

Referenced by CScanWidgetScan(), and ScanWidget::loadTask().

118 {
119  if (pItem == NULL) return;
120 
121  *mpData = *pItem;
122 
123  void * tmp;
124 
125  if (!(tmp = mpData->getValue("Type").pVOID)) return;
126 
128 
129  if (type != CScanProblem::SCAN_LINEAR)
130  return;
131 
132  if (!(tmp = mpData->getValue("Number of steps").pVOID)) return;
133 
134  lineEditNumber->setText(QString::number(*(C_INT32*)tmp));
135 
136  if (!(tmp = mpData->getValue("Object").pVOID)) return;
137 
138  std::string tmpString = *(std::string*)tmp;
139 
140  if (tmpString == "")
141  mpObject = NULL;
142  else
143  {
144  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
146  assert(pDataModel != NULL);
147  mpObject = pDataModel->getDataObject(tmpString);
148  }
149 
150  if (mpObject)
151  lineEditObject->setText(FROM_UTF8(mpObject->getObjectDisplayName()));
152  else
153  lineEditObject->setText("");
154 
155  if (!(tmp = mpData->getValue("Minimum").pVOID)) return;
156 
157  lineEditMin->setText(QString::number(*(C_FLOAT64*)tmp));
158 
159  if (!(tmp = mpData->getValue("Maximum").pVOID)) return;
160 
161  lineEditMax->setText(QString::number(*(C_FLOAT64*)tmp));
162 
163  if (!(tmp = mpData->getValue("log").pVOID)) return;
164 
165  checkBoxLog->setChecked(*(bool*)tmp);
166 
167  return;
168 }
CCopasiObject * getDataObject(const CCopasiObjectName &CN) const
virtual std::string getObjectDisplayName(bool regular=true, bool richtext=false) const
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
const CCopasiObject * mpObject
#define C_INT32
Definition: copasi.h:90
CCopasiParameterGroup * mpData
Definition: CScanItemData.h:42
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
#define C_FLOAT64
Definition: copasi.h:92
const CCopasiParameter::Value & getValue(const std::string &name) const
bool CScanWidgetScan::save ( CCopasiParameterGroup pItem) const
virtual

Implements CScanItemData.

Definition at line 171 of file CScanWidgetScan.cpp.

References CCopasiObject::getCN(), CScanItemData::mpData, mpObject, and CCopasiParameterGroup::setValue().

172 {
173  mpData->setValue("Number of steps", lineEditNumber->text().toUInt());
174  mpData->setValue("Minimum", lineEditMin->text().toDouble());
175  mpData->setValue("Maximum", lineEditMax->text().toDouble());
176  mpData->setValue("log", checkBoxLog->isChecked());
177 
178  if (mpObject != NULL)
179  {
180  mpData->setValue("Object", mpObject->getCN());
181  }
182  else
183  {
184  mpData->setValue("Object", std::string(""));
185  }
186 
187  if (pItem != NULL)
188  {
189  if (*mpData == *pItem) return false;
190 
191  *pItem = *mpData;
192  return true;
193  }
194 
195  return false;
196 }
virtual CCopasiObjectName getCN() const
const CCopasiObject * mpObject
CCopasiParameterGroup * mpData
Definition: CScanItemData.h:42
bool setValue(const std::string &name, const CType &value)
void CScanWidgetScan::slotChooseObject ( )
protectedvirtualslot

Definition at line 79 of file CScanWidgetScan.cpp.

References CCopasiSelectionDialog::getObjectSingle(), initFromObject(), CQSimpleSelectionTree::InitialTime, mpObject, and CQSimpleSelectionTree::Parameters.

80 {
81  const CCopasiObject * pObject =
85  mpObject);
86 
87  if (mpObject != pObject) // Object selection changed.
88  initFromObject(pObject);
89 }
const CCopasiObject * mpObject
static const CCopasiObject * getObjectSingle(QWidget *pParent, const CQSimpleSelectionTree::ObjectClasses &classes, const CCopasiObject *pCurrentObject=NULL)
void initFromObject(const CCopasiObject *obj)

Member Data Documentation

const CCopasiObject* CScanWidgetScan::mpObject
protected

Definition at line 49 of file CScanWidgetScan.h.

Referenced by init(), initFromObject(), load(), save(), and slotChooseObject().


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