COPASI API  4.16.103
NodeSizePanel.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Qt headers
7 #include <QtCore/QString>
8 #include <QtGui/QWidget>
9 
10 // global headers
11 #include <assert.h>
12 
13 // global copasi headers
14 #include "copasi/copasi.h"
15 
16 // local copasi headers
17 #include "NodeSizePanel.h"
18 #include "CQLayoutMainWindow.h"
19 
21 {
22  CQLayoutMainWindow * tmp = dynamic_cast<CQLayoutMainWindow *>(parentWidget());
23  assert(tmp);
24  QString s1 = lineEdit1->text();
25  bool ok1;
26  C_INT32 val1 = s1.toInt(&ok1, 10);
27  QString s2 = lineEdit2->text();
28  bool ok2;
29  C_INT32 val2 = s2.toInt(&ok2, 10);
30 
31  if ((tmp) && (ok1) && (ok2) && (val1 < val2))
32  tmp->setMinAndMaxValue(val1, val2);
33 
34  close();
35 }
36 
38 {
39  close();
40 }
41 
43 {
44  CQLayoutMainWindow * tmp = dynamic_cast<CQLayoutMainWindow *>(parentWidget());
45  assert(tmp);
46  QString s = lineEdit1->text();
47  bool ok;
48  C_INT32 val = s.toInt(&ok, 10);
49 
50  if ((tmp) && (ok))
51  tmp->setMinValue(val);
52 }
53 
55 {
56  CQLayoutMainWindow * tmp = dynamic_cast<CQLayoutMainWindow *>(parentWidget());
57  assert(tmp);
58  QString s = lineEdit1->text();
59  bool ok;
60  C_INT32 val = s.toInt(&ok, 10);
61 
62  if ((tmp) && (ok))
63  tmp->setMaxValue(val);
64 }
65 
66 NodeSizePanel::NodeSizePanel(QWidget* parent , bool modal , Qt::WindowFlags fl):
67  QDialog(parent, fl)
68 {
69  setupUi(this);
70  this->setModal(modal);
71  CQLayoutMainWindow * tmp = dynamic_cast<CQLayoutMainWindow *>(parentWidget());
72  assert(tmp);
73 
74  if (tmp)
75  {
76  C_INT32 minV = (C_INT32)(tmp->getMinNodeSize());
77  C_INT32 maxV = (C_INT32)(tmp->getMaxNodeSize());
78  lineEdit1->setText(QString::number(minV));
79  lineEdit2->setText(QString::number(maxV));
80  }
81 }
void setMinAndMaxValues()
NodeSizePanel(QWidget *parent=0, bool modal=false, Qt::WindowFlags fl=0)
#define C_INT32
Definition: copasi.h:90
void setMinValue(C_INT32 minNdSize)
void setMaxValue(C_INT32 maxNdSize)
bool fl(const C_FLOAT64 &d1, const C_FLOAT64 &d2)
void setMinAndMaxValue(C_INT32 minNdSize, C_INT32 maxNdSize)