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

#include <CQEFMNetReactionDM.h>

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

Public Member Functions

virtual int columnCount (const QModelIndex &parent=QModelIndex()) const
 
 CQEFMNetReactionDM (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 CQEFMNetReactionDM.h.

Constructor & Destructor Documentation

CQEFMNetReactionDM::CQEFMNetReactionDM ( QObject *  parent = 0)

Definition at line 28 of file CQEFMNetReactionDM.cpp.

28  :
29  CQBaseDataModel(parent),
30  mpTask(NULL),
31  mBeginModes(),
32  mModesSize(0)
33 {}
std::vector< CFluxMode >::const_iterator mBeginModes
CQBaseDataModel(QObject *parent=0)
const CEFMTask * mpTask

Member Function Documentation

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

Definition at line 43 of file CQEFMNetReactionDM.cpp.

References NetReactionDM_COLUMNS.

44 {
45  return NetReactionDM_COLUMNS;
46 }
#define NetReactionDM_COLUMNS
QVariant CQEFMNetReactionDM::data ( const QModelIndex &  index,
int  role 
) const
virtual

Implements CQBaseDataModel.

Definition at line 56 of file CQEFMNetReactionDM.cpp.

References COL_MODIFIER, COL_REACTION, COL_ROW_NUMBER, FROM_UTF8, CEFMTask::getInternalSpecies(), CEFMTask::getNetReaction(), mBeginModes, mpTask, and rowCount().

57 {
58  if (!index.isValid())
59  return QVariant();
60 
61  if (index.row() >= rowCount())
62  return QVariant();
63 
64  if (role == Qt::DisplayRole || role == Qt::EditRole)
65  {
66  std::vector< CFluxMode >::const_iterator itMode = mBeginModes + index.row();
67 
68  switch (index.column())
69  {
70  case COL_ROW_NUMBER:
71  return QVariant(index.row() + 1);
72  break;
73 
74  case COL_REACTION:
75  return QVariant(QString(FROM_UTF8(mpTask->getNetReaction(*itMode))));
76  break;
77 
78  case COL_MODIFIER:
79  return QVariant(QString(FROM_UTF8(mpTask->getInternalSpecies(*itMode))));
80  break;
81  }
82  }
83 
84  return QVariant();
85 }
std::string getNetReaction(const CFluxMode &fluxMode) const
Definition: CEFMTask.cpp:274
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
std::vector< CFluxMode >::const_iterator mBeginModes
std::string getInternalSpecies(const CFluxMode &fluxMode) const
Definition: CEFMTask.cpp:334
#define COL_REACTION
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
const CEFMTask * mpTask
#define COL_MODIFIER
#define COL_ROW_NUMBER
Qt::ItemFlags CQEFMNetReactionDM::flags ( const QModelIndex &  index) const
virtual

Reimplemented from CQBaseDataModel.

Definition at line 48 of file CQEFMNetReactionDM.cpp.

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

Implements CQBaseDataModel.

Definition at line 87 of file CQEFMNetReactionDM.cpp.

References COL_MODIFIER, COL_REACTION, and COL_ROW_NUMBER.

89 {
90  if (role != Qt::DisplayRole)
91  return QVariant();
92 
93  if (orientation == Qt::Horizontal)
94  {
95  switch (section)
96  {
97  case COL_ROW_NUMBER:
98  return QVariant(QString("#"));
99  break;
100 
101  case COL_REACTION:
102  return QVariant(QString("Net Reaction"));
103  break;
104 
105  case COL_MODIFIER:
106  return QVariant(QString("Internal Species"));
107  break;
108  }
109  }
110 
111  return QString("%1").arg(section + 1);
112 }
#define COL_REACTION
#define COL_MODIFIER
#define COL_ROW_NUMBER
bool CQEFMNetReactionDM::insertRows ( int  position,
int  rows,
const QModelIndex &  index = QModelIndex() 
)
protectedvirtual

Implements CQBaseDataModel.

Definition at line 135 of file CQEFMNetReactionDM.cpp.

136 {
137  return false;
138 }
bool CQEFMNetReactionDM::isDefaultRow ( const QModelIndex &  i) const
virtual

Reimplemented from CQBaseDataModel.

Definition at line 147 of file CQEFMNetReactionDM.cpp.

148 {
149  return false;
150 }
bool CQEFMNetReactionDM::removeRows ( int  position,
int  rows,
const QModelIndex &  index = QModelIndex() 
)
protectedvirtual

Implements CQBaseDataModel.

Definition at line 141 of file CQEFMNetReactionDM.cpp.

142 {
143  return false;
144 }
int CQEFMNetReactionDM::rowCount ( const QModelIndex &  parent = QModelIndex()) const
virtual

Definition at line 35 of file CQEFMNetReactionDM.cpp.

References mModesSize, and mpTask.

Referenced by data().

36 {
37  if (mpTask == NULL)
38  return 0;
39 
40  return (int) mModesSize;
41 }
const CEFMTask * mpTask
bool CQEFMNetReactionDM::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
virtual

Implements CQBaseDataModel.

Definition at line 129 of file CQEFMNetReactionDM.cpp.

130 {
131  return false;
132 }
void CQEFMNetReactionDM::setTask ( const CEFMTask pTask)

Definition at line 114 of file CQEFMNetReactionDM.cpp.

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

Referenced by CQEFMResultWidget::loadResult().

115 {
116  mpTask = pTask;
117 
118  if (mpTask != NULL)
119  {
120  mBeginModes = mpTask->getFluxModes().begin();
121  mModesSize = mpTask->getFluxModes().size();
122  }
123  else
124  {
125  mModesSize = 0;
126  }
127 }
const std::vector< CFluxMode > & getFluxModes() const
Definition: CEFMTask.cpp:183
std::vector< CFluxMode >::const_iterator mBeginModes
CTSSATask * pTask
const CEFMTask * mpTask

Member Data Documentation

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

Definition at line 61 of file CQEFMNetReactionDM.h.

Referenced by data(), and setTask().

size_t CQEFMNetReactionDM::mModesSize
private

Definition at line 62 of file CQEFMNetReactionDM.h.

Referenced by rowCount(), and setTask().

const CEFMTask* CQEFMNetReactionDM::mpTask
private

Definition at line 59 of file CQEFMNetReactionDM.h.

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


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