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

#include <CQEFMReactionDM.h>

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

Public Member Functions

virtual int columnCount (const QModelIndex &parent=QModelIndex()) const
 
 CQEFMReactionDM (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
 
std::vector< const CReaction * >
::const_iterator 
mBeginReactions
 
size_t mModesSize
 
const CEFMTaskmpTask
 
size_t mReactionsSize
 

Additional Inherited Members

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

Detailed Description

Definition at line 30 of file CQEFMReactionDM.h.

Constructor & Destructor Documentation

CQEFMReactionDM::CQEFMReactionDM ( QObject *  parent = 0)

Definition at line 27 of file CQEFMReactionDM.cpp.

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

Member Function Documentation

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

Definition at line 44 of file CQEFMReactionDM.cpp.

References mpTask, and mReactionsSize.

45 {
46  if (mpTask == NULL)
47  return 0;
48 
49  return (int)(mReactionsSize + 1); // For flux mode number
50 }
const CEFMTask * mpTask
QVariant CQEFMReactionDM::data ( const QModelIndex &  index,
int  role 
) const
virtual

Implements CQBaseDataModel.

Definition at line 60 of file CQEFMReactionDM.cpp.

References COL_ROW_NUMBER, mBeginModes, and rowCount().

61 {
62  if (!index.isValid())
63  return QVariant();
64 
65  if (index.row() >= rowCount())
66  return QVariant();
67 
68  if (role == Qt::DisplayRole || role == Qt::EditRole)
69  {
70  //std::vector< CFluxMode >::const_iterator itMode = mBeginModes + index.row();
71 
72  switch (index.column())
73  {
74  case COL_ROW_NUMBER:
75  return QVariant(index.row() + 1);
76  break;
77 
78  default:
79  return QVariant((mBeginModes + index.row())->getMultiplier(index.column() - 1));
80  }
81  }
82 
83  return QVariant();
84 }
std::vector< CFluxMode >::const_iterator mBeginModes
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
#define COL_ROW_NUMBER
Qt::ItemFlags CQEFMReactionDM::flags ( const QModelIndex &  index) const
virtual

Reimplemented from CQBaseDataModel.

Definition at line 52 of file CQEFMReactionDM.cpp.

53 {
54  if (!index.isValid())
55  return Qt::ItemIsEnabled;
56 
57  return QAbstractItemModel::flags(index) & ~Qt::ItemIsEditable;
58 }
QVariant CQEFMReactionDM::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
virtual

Implements CQBaseDataModel.

Definition at line 86 of file CQEFMReactionDM.cpp.

References COL_ROW_NUMBER, FROM_UTF8, and mBeginReactions.

88 {
89  if (role != Qt::DisplayRole)
90  return QVariant();
91 
92  if (orientation == Qt::Horizontal)
93  {
94  switch (section)
95  {
96  case COL_ROW_NUMBER:
97  return QVariant(QString("#"));
98  break;
99 
100  default:
101  return QVariant(QString(FROM_UTF8((*(mBeginReactions + section - 1))->getObjectName())));
102  break;
103  }
104  }
105 
106  //Vertical header
107  return QString("%1").arg(section + 1);
108 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
std::vector< const CReaction * >::const_iterator mBeginReactions
#define COL_ROW_NUMBER
bool CQEFMReactionDM::insertRows ( int  position,
int  rows,
const QModelIndex &  index = QModelIndex() 
)
protectedvirtual

Implements CQBaseDataModel.

Definition at line 135 of file CQEFMReactionDM.cpp.

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

Reimplemented from CQBaseDataModel.

Definition at line 147 of file CQEFMReactionDM.cpp.

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

Implements CQBaseDataModel.

Definition at line 141 of file CQEFMReactionDM.cpp.

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

Definition at line 36 of file CQEFMReactionDM.cpp.

References mModesSize, and mpTask.

Referenced by data().

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

Implements CQBaseDataModel.

Definition at line 129 of file CQEFMReactionDM.cpp.

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

Definition at line 110 of file CQEFMReactionDM.cpp.

References CEFMTask::getFluxModes(), CCopasiTask::getProblem(), mBeginModes, mBeginReactions, mModesSize, mpTask, mReactionsSize, pTask, and CCopasiParameterGroup::size().

Referenced by CQEFMResultWidget::loadResult().

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

Member Data Documentation

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

Definition at line 57 of file CQEFMReactionDM.h.

Referenced by data(), and setTask().

std::vector< const CReaction * >::const_iterator CQEFMReactionDM::mBeginReactions
private

Definition at line 60 of file CQEFMReactionDM.h.

Referenced by headerData(), and setTask().

size_t CQEFMReactionDM::mModesSize
private

Definition at line 58 of file CQEFMReactionDM.h.

Referenced by rowCount(), and setTask().

const CEFMTask* CQEFMReactionDM::mpTask
private

Definition at line 55 of file CQEFMReactionDM.h.

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

size_t CQEFMReactionDM::mReactionsSize
private

Definition at line 61 of file CQEFMReactionDM.h.

Referenced by columnCount(), and setTask().


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