DataObjectTableModel Class Reference

An example TableModel for a QList<DataObject*> This class uses the metaproperties API to extract the header information to display in the table, and contains a QList<DataObject*> for row data. More...

#include <dataobjecttablemodel.h>

Collaboration diagram for DataObjectTableModel:

Collaboration graph
[legend]
List of all members.

Public Slots

void reset ()
void clear ()
void checkDirty ()
void rowChanged (DataObject *dobj)
 Mark the corresponding row for this dataobject changed.

Public Member Functions

 DataObjectTableModel (DataObject *headerModel=0)
 
Parameters:
headerModel - an example DataObject-derived class with properties defined, used to determine the name/type of the column headers

virtual const DataObjectoperator[] (int rowNum) const
 
Returns:
the DataObject record corresponding to a specific row in this table.

virtual DataObjectoperator[] (int rowNum)
virtual bool insertRecord (DataObject *newRecord, int position=-1, const QModelIndex &=QModelIndex())
 Inserts a new record into the table.
QStringList toStringList () const
 
Returns:
each DataObject as a toString()

QString toString () const
virtual int fieldIndex (QString fieldName) const
virtual ~DataObjectTableModel ()
 Deletes all of the contained DataObjects which were added to this model.
int rowCount (const QModelIndex &parent=QModelIndex()) const
int columnCount (const QModelIndex &parent=QModelIndex()) const
QVariant data (const QModelIndex &index, int role) const
QVariant headerData (int section, Qt::Orientation orientation=Qt::Horizontal, int role=DisplayRole) const
ItemFlags flags (const QModelIndex &index) const
bool setData (const QModelIndex &index, const QVariant &value, int role=EditRole)
bool insertRows (int position, int rows, const QModelIndex &index=QModelIndex())
bool removeRows (int position, int rows, const QModelIndex &index=QModelIndex())
DataObjectTableModeloperator<< (DataObject *newObj)
 A convenience function for insertRecord.

Protected Member Functions

void extractHeaders (DataObject *hmodel)

Protected Attributes

QList< DataObject * > m_Data
QList< bool > m_isEditable
QStringList m_Headers
DataObjectm_Original
QTimer m_Timer
bool m_Dirty

Detailed Description

An example TableModel for a QList<DataObject*> This class uses the metaproperties API to extract the header information to display in the table, and contains a QList<DataObject*> for row data.

It is demo-ware - not tested recommended for reuse in commercial software.

Author:
S. Alan Ezust sae@mcs.suffolk.edu
Version:
Id
dataobjecttablemodel.h 1011 2009-06-04 00:29:01Z sae

Definition at line 23 of file dataobjecttablemodel.h.


Member Function Documentation

bool DataObjectTableModel::insertRecord ( DataObject newRecord,
int  position = -1,
const QModelIndex &  = QModelIndex() 
) [virtual]

Inserts a new record into the table.

Parameters:
newRecord - a new DataObject to be interpreted as a row.
position - the row number it should be inserted at. If -1, it is appended to the end.

Definition at line 103 of file dataobjecttablemodel.cpp.

References m_Data, and rowCount().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Wed Sep 30 01:15:44 2009 for oopapidocs by  doxygen 1.5.1