QseGraphScansModel Class Reference

#include <qsegraphscansmodel.h>

Inheritance diagram for QseGraphScansModel:

Inheritance graph
[legend]
Collaboration diagram for QseGraphScansModel:

Collaboration graph
[legend]

List of all members.

Public Slots

void dataChanged ()

Public Member Functions

 QseGraphScansModel (QseDataSet *dataSet, QObject *parent=0)
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, int role=Qt::DisplayRole) const

Private Types

typedef QAbstractTableModel inherited

Private Attributes

QseDataSetm_DataSet


Detailed Description

Definition at line 8 of file qsegraphscansmodel.h.


Member Typedef Documentation

Definition at line 10 of file qsegraphscansmodel.h.


Constructor & Destructor Documentation

QseGraphScansModel::QseGraphScansModel ( QseDataSet dataSet,
QObject parent = 0 
)

Definition at line 6 of file qsegraphscansmodel.cpp.

00007   : QAbstractTableModel(parent),
00008     m_DataSet(dataSet)
00009 {
00010   connect(dataSet, SIGNAL(dataChanged()),
00011     this,    SIGNAL(modelReset()));
00012 }


Member Function Documentation

int QseGraphScansModel::rowCount ( const QModelIndex &  parent = QModelIndex()  )  const

Definition at line 20 of file qsegraphscansmodel.cpp.

References m_DataSet.

00021 {
00022   if (parent.column() > 0) {
00023     return 0;
00024   }
00025 
00026   int res = m_DataSet -> scanCount();
00027 
00028   return res;
00029 }

int QseGraphScansModel::columnCount ( const QModelIndex &  parent = QModelIndex()  )  const

Definition at line 32 of file qsegraphscansmodel.cpp.

Referenced by data().

00033 {
00034   return 3;
00035 }

QVariant QseGraphScansModel::data ( const QModelIndex &  index,
int  role 
) const

Definition at line 38 of file qsegraphscansmodel.cpp.

References columnCount(), m_DataSet, and QseDataSet::scan().

00039 {
00040   if (!index.isValid()) {
00041     return QVariant();
00042   }
00043 
00044   int row = index.row();
00045   int col = index.column();
00046   
00047   QseScan *scan = m_DataSet->scan(row);
00048 
00049   switch (role) {
00050   case Qt::DisplayRole:
00051     switch (col) {
00052     case 0:
00053       return scan -> maxRowCount();
00054       break;
00055     case 1:
00056       return scan -> columnCount();
00057       break;
00058     case 2:
00059       return scan -> name();
00060       break;
00061     default:
00062       return QVariant();
00063     }
00064     break;
00065 
00066 //   case Qt::BackgroundRole:
00067 //     return QColor(255,255,192);
00068 //     break;
00069 
00070   case Qt::ForegroundRole:
00071     return QBrush(Qt::red);
00072     break;
00073 
00074   default:
00075     return QVariant();
00076   }
00077 }

Here is the call graph for this function:

QVariant QseGraphScansModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const

Definition at line 81 of file qsegraphscansmodel.cpp.

00082 {
00083   if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
00084     switch (section) {
00085     case 0:
00086       return "NR";
00087       break;
00088     case 1:
00089       return "NC";
00090       break;
00091     case 2:
00092       return "Scan";
00093       break;
00094     default:
00095       return QVariant();
00096     }
00097   }
00098 
00099   if (orientation == Qt::Vertical && role == Qt::DisplayRole) {
00100     return section;
00101   }
00102 
00103   return QVariant();
00104 }

void QseGraphScansModel::dataChanged (  )  [slot]

Definition at line 15 of file qsegraphscansmodel.cpp.

00016 {
00017 }


Member Data Documentation

Definition at line 28 of file qsegraphscansmodel.h.

Referenced by data(), and rowCount().


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

Generated on Fri May 2 16:26:42 2008 for QSE by  doxygen 1.5.5