#include <qsegraphcolumnsmodel.h>


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 | |
| QseGraphController * | m_Controller |
| QseDataSet * | m_DataSet |
Definition at line 9 of file qsegraphcolumnsmodel.h.
typedef QAbstractTableModel QseGraphColumnsModel::inherited [private] |
Definition at line 11 of file qsegraphcolumnsmodel.h.
| 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 }
| 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 }

| int QseGraphColumnsModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() |
) | const |
| 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 }

| 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 | ( | ) |
| void QseGraphColumnsModel::emitDataChanged | ( | const QModelIndex & | topLeft, | |
| const QModelIndex & | bottomRight | |||
| ) |
QseDataSet* QseGraphColumnsModel::m_DataSet [private] |
Definition at line 35 of file qsegraphcolumnsmodel.h.
1.5.5