QseGraphColumnsModel Class Reference

#include <qsegraphcolumnsmodel.h>

Inheritance diagram for QseGraphColumnsModel:

Inheritance graph
[legend]
Collaboration diagram for QseGraphColumnsModel:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 QseGraphColumnsModel (QseGraphController *controller, 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
void columnsChanged ()
void emitDataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)

Private Types

typedef QAbstractTableModel inherited

Private Attributes

QseGraphControllerm_Controller
QseDataSetm_DataSet


Detailed Description

Definition at line 9 of file qsegraphcolumnsmodel.h.


Member Typedef Documentation

Definition at line 11 of file qsegraphcolumnsmodel.h.


Constructor & Destructor Documentation

QseGraphColumnsModel::QseGraphColumnsModel ( QseGraphController controller,
QObject parent = 0 
)

Definition at line 6 of file qsegraphcolumnsmodel.cpp.

00007   : QAbstractTableModel(parent),
00008     m_Controller(controller),
00009     m_DataSet(NULL)
00010 {
00011   if (m_Controller) {
00012     m_DataSet = m_Controller->dataSet();
00013   }
00014 }


Member Function Documentation

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

Definition at line 35 of file qsegraphcolumnsmodel.cpp.

References m_Controller, and QseGraphController::selectedColumnCount().

Referenced by QseGraphController::columnsCellClicked().

00036 {
00037   if (parent.column() > 0) {
00038     return 0;
00039   }
00040 
00041   int res = m_Controller->selectedColumnCount();
00042 
00043   return res;
00044 }

Here is the call graph for this function:

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

Definition at line 47 of file qsegraphcolumnsmodel.cpp.

00048 {
00049   return 5;
00050 }

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

Definition at line 53 of file qsegraphcolumnsmodel.cpp.

References m_Controller, QseGraphController::selectedColumn(), QseGraphController::selectedPlotNorm(), QseGraphController::selectedPlotX(), QseGraphController::selectedPlotY(), and QseGraphController::selectedPlotY2().

00054 {
00055   if (!index.isValid()) {
00056     return QVariant();
00057   }
00058 
00059 //   if (role != Qt::DisplayRole) {
00060 //     return QVariant();
00061 //   }
00062 
00063   int row = index.row();
00064   int col = index.column();
00065 
00066   switch (role) {
00067   case Qt::DisplayRole:
00068     switch (col) {
00069     case 0:
00070       return m_Controller->selectedColumn(row);
00071       break;
00072     case 1: // X?
00073       return m_Controller->selectedPlotX(row) ? "X" : " ";
00074   break;
00075     case 2: // Y1?
00076       return m_Controller->selectedPlotY(row) ? "Y" : " ";
00077       break;
00078     case 3: // Y2?
00079       return m_Controller->selectedPlotY2(row) ? "Y2" : " ";
00080       break;
00081     case 4: // NRM?
00082       return m_Controller->selectedPlotNorm(row) ? "NRM" : " ";
00083       break;
00084     default:
00085       return QVariant();
00086     }
00087 
00088   case Qt::DecorationRole:
00089     switch (col) {
00090     case 2:
00091       return m_Controller->selectedPlotY(row) ? QIcon(":/images/ok.png") : QIcon(":/images/up.png");
00092   break;
00093     default:
00094       return QVariant();
00095     }
00096     break;
00097 
00098   default:
00099     return QVariant();
00100   }
00101 }

Here is the call graph for this function:

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

Definition at line 105 of file qsegraphcolumnsmodel.cpp.

00106 {
00107   if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
00108     switch (section) {
00109     case 0:
00110       return "Col";
00111       break;
00112     case 1:
00113       return "X";
00114       break;
00115     case 2:
00116       return "Y1";
00117       break;
00118     case 3:
00119       return "Y2";
00120       break;
00121     case 4:
00122       return "NRM";
00123       break;
00124     default:
00125       return QVariant();
00126     }
00127   }
00128 
00129   if (orientation == Qt::Vertical && role == Qt::DisplayRole) {
00130     return section;
00131   }
00132 
00133   return QVariant();
00134 }

void QseGraphColumnsModel::columnsChanged (  ) 

Definition at line 29 of file qsegraphcolumnsmodel.cpp.

00030 {
00031   reset();
00032 }

void QseGraphColumnsModel::emitDataChanged ( const QModelIndex &  topLeft,
const QModelIndex &  bottomRight 
)

Definition at line 23 of file qsegraphcolumnsmodel.cpp.

00024 {
00025   emit dataChanged(topLeft, bottomRight);
00026 }


Member Data Documentation

Definition at line 34 of file qsegraphcolumnsmodel.h.

Referenced by data(), and rowCount().

Definition at line 35 of file qsegraphcolumnsmodel.h.


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