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

#include <CQTimeSeriesDM.h>

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

Public Member Functions

virtual int columnCount (const QModelIndex &parent=QModelIndex()) const
 
 CQTimeSeriesDM (QObject *parent=0)
 
virtual QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 
virtual Qt::ItemFlags flags (const QModelIndex &index) const
 
virtual 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
 
virtual bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
 
void setFramework (int framework)
 
void setTimeSeries (const CTimeSeries *pTimeSeries)
 
virtual ~CQTimeSeriesDM ()
 
- 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

int mFramework
 
const CTimeSeriesmpTimeSeries
 

Additional Inherited Members

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

Detailed Description

Definition at line 21 of file CQTimeSeriesDM.h.

Constructor & Destructor Documentation

CQTimeSeriesDM::CQTimeSeriesDM ( QObject *  parent = 0)

Definition at line 19 of file CQTimeSeriesDM.cpp.

19  :
20  CQBaseDataModel(parent),
21  mpTimeSeries(NULL),
22  mFramework(0)
23 {}
CQBaseDataModel(QObject *parent=0)
const CTimeSeries * mpTimeSeries
CQTimeSeriesDM::~CQTimeSeriesDM ( )
virtual

Definition at line 25 of file CQTimeSeriesDM.cpp.

26 {}

Member Function Documentation

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

Definition at line 37 of file CQTimeSeriesDM.cpp.

References CTimeSeries::getNumVariables(), and mpTimeSeries.

Referenced by data(), headerData(), and setFramework().

38 {
39  if (mpTimeSeries == NULL) return 0;
40 
41  return (int) mpTimeSeries->getNumVariables();
42 }
const size_t & getNumVariables() const
const CTimeSeries * mpTimeSeries
QVariant CQTimeSeriesDM::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
virtual

Implements CQBaseDataModel.

Definition at line 51 of file CQTimeSeriesDM.cpp.

References columnCount(), CTimeSeries::getConcentrationData(), CTimeSeries::getData(), mFramework, mpTimeSeries, and rowCount().

52 {
53  if (mpTimeSeries == NULL || role != Qt::DisplayRole) return QVariant();
54 
55  if (!index.isValid() ||
56  index.row() < 0 || rowCount() <= index.row() ||
57  index.column() < 0 || columnCount() <= index.column()) return QVariant();
58 
59  switch (mFramework)
60  {
61  case 0:
62  return QString::number(mpTimeSeries->getConcentrationData(index.row(), index.column()));
63 
64  case 1:
65  return QString::number(mpTimeSeries->getData(index.row(), index.column()));
66  }
67 
68  return QVariant();
69 }
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
C_FLOAT64 getConcentrationData(const size_t &step, const size_t &variable) const
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
const C_FLOAT64 & getData(const size_t &step, const size_t &variable) const
const CTimeSeries * mpTimeSeries
Qt::ItemFlags CQTimeSeriesDM::flags ( const QModelIndex &  index) const
virtual

Reimplemented from CQBaseDataModel.

Definition at line 45 of file CQTimeSeriesDM.cpp.

46 {
47  return QAbstractItemModel::flags(index) & ~Qt::ItemIsEditable;
48 }
QVariant CQTimeSeriesDM::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
virtual

Implements CQBaseDataModel.

Definition at line 72 of file CQTimeSeriesDM.cpp.

References columnCount(), FROM_UTF8, CTimeSeries::getTitle(), mpTimeSeries, and rowCount().

74 {
75  if (mpTimeSeries == NULL || role != Qt::DisplayRole) return QVariant();
76 
77  switch (orientation)
78  {
79  case Qt::Horizontal:
80 
81  if (section < 0 || columnCount() <= section) return QVariant();
82 
83  return QString(FROM_UTF8(mpTimeSeries->getTitle(section)));
84 
85  case Qt::Vertical:
86 
87  if (section < 0 || rowCount() <= section) return QVariant();
88 
89  return QString("%1").arg(section + 1);
90  }
91 
92  return QVariant();
93 }
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
const std::string & getTitle(const size_t &variable) const
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
const CTimeSeries * mpTimeSeries
bool CQTimeSeriesDM::insertRows ( int  position,
int  rows,
const QModelIndex &  index = QModelIndex() 
)
protectedvirtual

Implements CQBaseDataModel.

Definition at line 115 of file CQTimeSeriesDM.cpp.

116 {
117  return false;
118 }
bool CQTimeSeriesDM::isDefaultRow ( const QModelIndex &  i) const
virtual

Reimplemented from CQBaseDataModel.

Definition at line 127 of file CQTimeSeriesDM.cpp.

128 {
129  return false;
130 }
bool CQTimeSeriesDM::removeRows ( int  position,
int  rows,
const QModelIndex &  index = QModelIndex() 
)
protectedvirtual

Implements CQBaseDataModel.

Definition at line 121 of file CQTimeSeriesDM.cpp.

122 {
123  return false;
124 }
int CQTimeSeriesDM::rowCount ( const QModelIndex &  parent = QModelIndex()) const
virtual

Definition at line 29 of file CQTimeSeriesDM.cpp.

References CTimeSeries::getRecordedSteps(), and mpTimeSeries.

Referenced by data(), headerData(), CQTimeSeriesWidget::loadResult(), and setFramework().

30 {
31  if (mpTimeSeries == NULL) return 0;
32 
33  return (int) mpTimeSeries->getRecordedSteps();
34 }
const size_t & getRecordedSteps() const
const CTimeSeries * mpTimeSeries
bool CQTimeSeriesDM::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
virtual

Implements CQBaseDataModel.

Definition at line 109 of file CQTimeSeriesDM.cpp.

110 {
111  return false;
112 }
void CQTimeSeriesDM::setFramework ( int  framework)

Definition at line 101 of file CQTimeSeriesDM.cpp.

References columnCount(), mFramework, and rowCount().

Referenced by CQTimeSeriesWidget::setFramework().

102 {
103  if (mFramework == framework) return;
104 
105  mFramework = framework;
106  emit dataChanged(index(0, 0), index(rowCount(), columnCount()));
107 }
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
void CQTimeSeriesDM::setTimeSeries ( const CTimeSeries pTimeSeries)

Definition at line 95 of file CQTimeSeriesDM.cpp.

References mpTimeSeries.

Referenced by CQTimeSeriesWidget::loadResult().

96 {
97  mpTimeSeries = pTimeSeries;
98  reset();
99 }
const CTimeSeries * mpTimeSeries

Member Data Documentation

int CQTimeSeriesDM::mFramework
private

Definition at line 53 of file CQTimeSeriesDM.h.

Referenced by data(), and setFramework().

const CTimeSeries* CQTimeSeriesDM::mpTimeSeries
private

Definition at line 52 of file CQTimeSeriesDM.h.

Referenced by columnCount(), data(), headerData(), rowCount(), and setTimeSeries().


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