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

#include <CQFluxModeDM.h>

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

Public Member Functions

virtual int columnCount (const QModelIndex &parent=QModelIndex()) const
 
 CQFluxModeDM (QObject *parent=0)
 
QVariant data (const QModelIndex &index, int role) const
 
Qt::ItemFlags flags (const QModelIndex &index) const
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 
virtual bool isDefaultRow (const QModelIndex &i) const
 
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
 
void setTask (const CEFMTask *pTask)
 
- Public Member Functions inherited from CQBaseDataModel
virtual bool clear ()
 
 CQBaseDataModel (QObject *parent=0)
 
QString createNewName (const QString name, const int nameCol)
 
bool insertRow ()
 
bool removeRow (int position)
 

Protected Member Functions

virtual bool insertRows (int position, int rows, const QModelIndex &index=QModelIndex())
 
virtual bool removeRows (int position, int rows, const QModelIndex &index=QModelIndex())
 

Private Attributes

std::vector< CFluxMode >
::const_iterator 
mBeginModes
 
size_t mModesSize
 
const CEFMTaskmpTask
 

Additional Inherited Members

- Signals inherited from CQBaseDataModel
void notifyGUI (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
 

Detailed Description

Definition at line 34 of file CQFluxModeDM.h.

Constructor & Destructor Documentation

CQFluxModeDM::CQFluxModeDM ( QObject *  parent = 0)

Definition at line 25 of file CQFluxModeDM.cpp.

25  :
26  CQBaseDataModel(parent),
27  mpTask(NULL),
28  mBeginModes(),
29  mModesSize(0)
30 {}
size_t mModesSize
Definition: CQFluxModeDM.h:61
const CEFMTask * mpTask
Definition: CQFluxModeDM.h:59
CQBaseDataModel(QObject *parent=0)
std::vector< CFluxMode >::const_iterator mBeginModes
Definition: CQFluxModeDM.h:60

Member Function Documentation

int CQFluxModeDM::columnCount ( const QModelIndex &  parent = QModelIndex()) const
virtual

Definition at line 40 of file CQFluxModeDM.cpp.

References FluxModeDM_COLUMNS.

41 {
42  return FluxModeDM_COLUMNS;
43 }
#define FluxModeDM_COLUMNS
Definition: CQFluxModeDM.h:32
QVariant CQFluxModeDM::data ( const QModelIndex &  index,
int  role 
) const
virtual

Implements CQBaseDataModel.

Definition at line 53 of file CQFluxModeDM.cpp.

References COL_REACTION_EQUATION, COL_REACTION_NAME, COL_REVERSIBILITY, COL_ROW_NUMBER, FROM_UTF8, CEFMTask::getFluxModeDescription(), CEFMTask::getReactionEquation(), mBeginModes, mpTask, and rowCount().

54 {
55  if (!index.isValid())
56  return QVariant();
57 
58  if (index.row() >= rowCount())
59  return QVariant();
60 
61  if (role == Qt::DisplayRole || role == Qt::EditRole)
62  {
63  std::vector< CFluxMode >::const_iterator itMode = mBeginModes + index.row();
64 
65  switch (index.column())
66  {
67  case COL_ROW_NUMBER:
68  return QVariant(index.row() + 1);
69  break;
70 
71  case COL_REVERSIBILITY:
72 
73  if (itMode->isReversible() == true)
74  {
75  return QVariant(QString("Reversible"));
76  }
77  else
78  {
79  return QVariant(QString("Irreversible"));
80  }
81 
82  break;
83 
84  case COL_REACTION_NAME:
85  return QVariant(QString(FROM_UTF8(mpTask->getFluxModeDescription(*itMode))));
86  break;
87 
89  {
90  std::string reactionEq = "";
91  std::string separator = "";
92 
93  CFluxMode::const_iterator itReaction = itMode->begin();
94  CFluxMode::const_iterator endReaction = itMode->end();
95 
96  for (; itReaction != endReaction; ++itReaction)
97  {
98  reactionEq += separator;
99  reactionEq += mpTask->getReactionEquation(itReaction);
100  separator = "\n";
101  }
102 
103  return QVariant(QString(FROM_UTF8(reactionEq)));
104  }
105  break;
106  }
107  }
108 
109  return QVariant();
110 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
std::string getReactionEquation(const std::map< size_t, C_FLOAT64 >::const_iterator &itReaction) const
Definition: CEFMTask.cpp:188
std::string getFluxModeDescription(const CFluxMode &fluxMode) const
Definition: CEFMTask.cpp:132
#define COL_REVERSIBILITY
Definition: CQFluxModeDM.h:29
const CEFMTask * mpTask
Definition: CQFluxModeDM.h:59
#define COL_REACTION_EQUATION
Definition: CQFluxModeDM.h:31
#define COL_REACTION_NAME
Definition: CQFluxModeDM.h:30
std::map< size_t, C_FLOAT64 >::const_iterator const_iterator
Definition: CFluxMode.h:43
std::vector< CFluxMode >::const_iterator mBeginModes
Definition: CQFluxModeDM.h:60
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
#define COL_ROW_NUMBER
Qt::ItemFlags CQFluxModeDM::flags ( const QModelIndex &  index) const
virtual

Reimplemented from CQBaseDataModel.

Definition at line 45 of file CQFluxModeDM.cpp.

46 {
47  if (!index.isValid())
48  return Qt::ItemIsEnabled;
49 
50  return QAbstractItemModel::flags(index) & ~Qt::ItemIsEditable;
51 }
QVariant CQFluxModeDM::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
virtual

Implements CQBaseDataModel.

Definition at line 112 of file CQFluxModeDM.cpp.

References COL_REACTION_EQUATION, COL_REACTION_NAME, COL_REVERSIBILITY, and COL_ROW_NUMBER.

114 {
115  if (role != Qt::DisplayRole)
116  return QVariant();
117 
118  if (orientation == Qt::Horizontal)
119  {
120  switch (section)
121  {
122  case COL_ROW_NUMBER:
123  return QVariant(QString("#"));
124  break;
125 
126  case COL_REVERSIBILITY:
127  return QVariant(QString("Reversibility"));
128  break;
129 
130  case COL_REACTION_NAME:
131  return QVariant(QString("Reaction Name"));
132  break;
133 
135  return QVariant(QString("Reaction Equation"));
136  break;
137 
138  default:
139  return QVariant();
140  break;
141  }
142  }
143 
144  //Vertical header
145  return QString("%1").arg(section + 1);
146 }
#define COL_REVERSIBILITY
Definition: CQFluxModeDM.h:29
#define COL_REACTION_EQUATION
Definition: CQFluxModeDM.h:31
#define COL_REACTION_NAME
Definition: CQFluxModeDM.h:30
#define COL_ROW_NUMBER
bool CQFluxModeDM::insertRows ( int  position,
int  rows,
const QModelIndex &  index = QModelIndex() 
)
protectedvirtual

Implements CQBaseDataModel.

Definition at line 170 of file CQFluxModeDM.cpp.

171 {
172  return false;
173 }
bool CQFluxModeDM::isDefaultRow ( const QModelIndex &  i) const
virtual

Reimplemented from CQBaseDataModel.

Definition at line 182 of file CQFluxModeDM.cpp.

183 {
184  return false;
185 }
bool CQFluxModeDM::removeRows ( int  position,
int  rows,
const QModelIndex &  index = QModelIndex() 
)
protectedvirtual

Implements CQBaseDataModel.

Definition at line 176 of file CQFluxModeDM.cpp.

177 {
178  return false;
179 }
int CQFluxModeDM::rowCount ( const QModelIndex &  parent = QModelIndex()) const
virtual

Definition at line 32 of file CQFluxModeDM.cpp.

References mModesSize, and mpTask.

Referenced by data().

33 {
34  if (mpTask == NULL)
35  return 0;
36 
37  return (int) mModesSize;
38 }
size_t mModesSize
Definition: CQFluxModeDM.h:61
const CEFMTask * mpTask
Definition: CQFluxModeDM.h:59
bool CQFluxModeDM::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
virtual

Implements CQBaseDataModel.

Definition at line 163 of file CQFluxModeDM.cpp.

165 {
166  return false;
167 }
void CQFluxModeDM::setTask ( const CEFMTask pTask)

Definition at line 148 of file CQFluxModeDM.cpp.

References CEFMTask::getFluxModes(), mBeginModes, mModesSize, mpTask, and pTask.

Referenced by CQEFMListWidget::loadResult().

149 {
150  mpTask = pTask;
151 
152  if (mpTask != NULL)
153  {
154  mBeginModes = mpTask->getFluxModes().begin();
155  mModesSize = mpTask->getFluxModes().size();
156  }
157  else
158  {
159  mModesSize = 0;
160  }
161 }
size_t mModesSize
Definition: CQFluxModeDM.h:61
const std::vector< CFluxMode > & getFluxModes() const
Definition: CEFMTask.cpp:183
CTSSATask * pTask
const CEFMTask * mpTask
Definition: CQFluxModeDM.h:59
std::vector< CFluxMode >::const_iterator mBeginModes
Definition: CQFluxModeDM.h:60

Member Data Documentation

std::vector< CFluxMode >::const_iterator CQFluxModeDM::mBeginModes
private

Definition at line 60 of file CQFluxModeDM.h.

Referenced by data(), and setTask().

size_t CQFluxModeDM::mModesSize
private

Definition at line 61 of file CQFluxModeDM.h.

Referenced by rowCount(), and setTask().

const CEFMTask* CQFluxModeDM::mpTask
private

Definition at line 59 of file CQFluxModeDM.h.

Referenced by data(), rowCount(), and setTask().


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