COPASI API  4.16.103
Signals | Public Member Functions | Protected Member Functions | List of all members
CQBaseDataModel Class Referenceabstract

#include <CQBaseDataModel.h>

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

Signals

void notifyGUI (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
 

Public Member Functions

virtual bool clear ()
 
 CQBaseDataModel (QObject *parent=0)
 
QString createNewName (const QString name, const int nameCol)
 
virtual QVariant data (const QModelIndex &index, int role) const =0
 
virtual Qt::ItemFlags flags (const QModelIndex &index) const
 
virtual QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const =0
 
bool insertRow ()
 
virtual bool isDefaultRow (const QModelIndex &i) const
 
bool removeRow (int position)
 
virtual bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)=0
 

Protected Member Functions

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

Detailed Description

Definition at line 28 of file CQBaseDataModel.h.

Constructor & Destructor Documentation

CQBaseDataModel::CQBaseDataModel ( QObject *  parent = 0)

Definition at line 22 of file CQBaseDataModel.cpp.

23  : QAbstractTableModel(parent)
24 
25 {}

Member Function Documentation

bool CQBaseDataModel::clear ( )
virtual
QString CQBaseDataModel::createNewName ( const QString  name,
const int  nameCol 
)

Definition at line 68 of file CQBaseDataModel.cpp.

References C_INT32, and data().

Referenced by CQReportDM::insertRows(), CQPlotDM::insertRows(), CQFunctionDM::insertRows(), CQReactionDM::insertRows(), CQEventDM::insertRows(), CQGlobalQuantityDM::insertRows(), CQCompartmentDM::insertRows(), CQSpecieDM::insertRows(), CQReportDM::setData(), CQPlotDM::setData(), CQReactionDM::setData(), CQFunctionDM::setData(), CQEventDM::setData(), CQGlobalQuantityDM::setData(), CQCompartmentDM::setData(), and CQSpecieDM::setData().

69 {
70  QString nname = name;
71  unsigned C_INT32 j, jmax = rowCount();
72 
73  for (unsigned C_INT32 i = 1;; ++i)
74  {
75  nname = name + "_" + QString::number(i);
76 
77  for (j = 0; j < jmax; ++j)
78  if (index(j, nameCol).data() == nname) break;
79 
80  if (j == jmax) break;
81  }
82 
83  return nname;
84 }
#define C_INT32
Definition: copasi.h:90
virtual QVariant data(const QModelIndex &index, int role) const =0
virtual QVariant CQBaseDataModel::data ( const QModelIndex &  index,
int  role 
) const
pure virtual
Qt::ItemFlags CQBaseDataModel::flags ( const QModelIndex &  index) const
virtual

Reimplemented in CQSpecieDM, CQCompartmentDM, CQGlobalQuantityDM, CQEFMNetReactionDM, CQFluxModeDM, CQEventDM, CQEFMSpeciesDM, CQFunctionDM, CQReactionDM, CQEFMReactionDM, CQPlotDM, CQLayoutsDM, CQReportDM, CQTimeSeriesDM, and CQParameterSetsDM.

Definition at line 27 of file CQBaseDataModel.cpp.

References COL_ROW_NUMBER.

28 {
29  if (!index.isValid())
30  return Qt::ItemIsEnabled;
31 
32  if (index.column() == COL_ROW_NUMBER)
33  return QAbstractItemModel::flags(index);
34  else
35  return QAbstractItemModel::flags(index) | Qt::ItemIsEditable;
36 }
#define COL_ROW_NUMBER
virtual QVariant CQBaseDataModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
pure virtual
bool CQBaseDataModel::insertRow ( )
virtual bool CQBaseDataModel::insertRows ( int  position,
int  rows,
const QModelIndex &  index = QModelIndex() 
)
protectedpure virtual
bool CQBaseDataModel::isDefaultRow ( const QModelIndex &  i) const
virtual

Reimplemented in CQEFMNetReactionDM, CQFluxModeDM, CQEFMSpeciesDM, CQEFMReactionDM, CQLayoutsDM, CQTimeSeriesDM, and CQParameterSetsDM.

Definition at line 56 of file CQBaseDataModel.cpp.

Referenced by CQSpinBoxDelegate::createEditor(), CQReportDM::data(), CQModifiedDM::data(), CQPlotDM::data(), CQReferenceDM::data(), CQBiologicalDescriptionDM::data(), CQCreatorDM::data(), CQFunctionDM::data(), CQReactionDM::data(), CQEventDM::data(), CQGlobalQuantityDM::data(), CQCompartmentDM::data(), CQSpecieDM::data(), CQFunctionDM::flags(), CQSpecieDM::flags(), CQSortFilterProxyModel::lessThan(), removeRow(), CQReportDM::removeRows(), CQModifiedDM::removeRows(), CQPlotDM::removeRows(), CQBiologicalDescriptionDM::removeRows(), CQReferenceDM::removeRows(), CQCreatorDM::removeRows(), CQReactionDM::removeRows(), CQFunctionDM::removeRows(), CQEventDM::removeRows(), CQGlobalQuantityDM::removeRows(), CQCompartmentDM::removeRows(), CQSpecieDM::removeRows(), CQReportDM::setData(), CQModifiedDM::setData(), CQPlotDM::setData(), CQReferenceDM::setData(), CQBiologicalDescriptionDM::setData(), CQCreatorDM::setData(), CQReactionDM::setData(), CQFunctionDM::setData(), CQEventDM::setData(), CQGlobalQuantityDM::setData(), CQCompartmentDM::setData(), CQSpecieDM::setData(), CQPlotsWidget::slotDoubleClicked(), CQReactionsWidget::slotDoubleClicked(), CQReportsWidget::slotDoubleClicked(), CQEventsWidget::slotDoubleClicked(), CQFunctionsWidget::slotDoubleClicked(), CQCompartmentsWidget::slotDoubleClicked(), CQGlobalQuantitiesWidget::slotDoubleClicked(), CQSpeciesWidget::slotDoubleClicked(), CQPlotsWidget::updateDeleteBtns(), CQReportsWidget::updateDeleteBtns(), CQReactionsWidget::updateDeleteBtns(), CQEventsWidget::updateDeleteBtns(), CQCompartmentsWidget::updateDeleteBtns(), CQFunctionsWidget::updateDeleteBtns(), CQSpeciesWidget::updateDeleteBtns(), and CQGlobalQuantitiesWidget::updateDeleteBtns().

57 {
58  //Index has to be from this model and should be valid.
59  if ((i.model() != this) ||
60  !i.isValid())
61  {
62  return false;
63  }
64 
65  return (i.row() == rowCount() - 1);
66 }
void CQBaseDataModel::notifyGUI ( ListViews::ObjectType  objectType,
ListViews::Action  action,
const std::string &  key = "" 
)
signal
bool CQBaseDataModel::removeRow ( int  position)

Definition at line 43 of file CQBaseDataModel.cpp.

References isDefaultRow(), and removeRows().

Referenced by CQParameterSetsDM::removeRows(), CQModifiedDM::removeRows(), CQReportDM::removeRows(), CQLayoutsDM::removeRows(), CQPlotDM::removeRows(), CQReferenceDM::removeRows(), CQBiologicalDescriptionDM::removeRows(), CQCreatorDM::removeRows(), CQFunctionDM::removeRows(), CQReactionDM::removeRows(), CQEventDM::removeRows(), CQGlobalQuantityDM::removeRows(), CQCompartmentDM::removeRows(), and CQSpecieDM::removeRows().

44 {
45  if (0 <= position && position < rowCount() && !isDefaultRow(index(position, 0)))
46  return removeRows(position, 1);
47  else
48  return false;
49 }
virtual bool isDefaultRow(const QModelIndex &i) const
virtual bool removeRows(int position, int rows, const QModelIndex &index=QModelIndex())=0
virtual bool CQBaseDataModel::removeRows ( int  position,
int  rows,
const QModelIndex &  index = QModelIndex() 
)
protectedpure virtual
virtual bool CQBaseDataModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
pure virtual

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