qse  0.5.0
Public Slots | Public Member Functions | Private Types | Private Attributes
QseScanAveragerModel Class Reference

#include <qsescanaveragermodel.h>

List of all members.

Public Slots

void operationCompleted ()
void dataChanged ()
void dataCleared ()
void scanAdded (int n)

Public Member Functions

 QseScanAveragerModel (QseScanAverager *averager, QTableView *table, 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

QseScanAveragerm_ScanAverager
QTableView * m_TableView
int m_PrevRowCount
int m_PrevColumnCount

Detailed Description

Definition at line 9 of file qsescanaveragermodel.h.


Member Typedef Documentation

typedef QAbstractTableModel QseScanAveragerModel::inherited
private

Definition at line 11 of file qsescanaveragermodel.h.


Constructor & Destructor Documentation

QseScanAveragerModel::QseScanAveragerModel ( QseScanAverager averager,
QTableView *  table,
QObject *  parent = 0 
)

Definition at line 11 of file qsescanaveragermodel.cpp.

References QseScanAveragerUI::m_ScanAverager.

: inherited(parent),
m_ScanAverager(scanaverager),
m_TableView(table),
{
connect(m_ScanAverager -> inputData(), SIGNAL(operationCompleted()),
this, SLOT(operationCompleted()));
// connect(m_ScanAverager -> inputData(), SIGNAL(dataChanged()),
// this, SLOT(dataChanged()));
// connect(m_ScanAverager -> inputData(), SIGNAL(dataCleared()),
// this, SLOT(dataCleared()));
// connect(m_ScanAverager -> inputData(), SIGNAL(dataChanged()),
// this, SIGNAL(modelReset()));
}

Member Function Documentation

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

Definition at line 52 of file qsescanaveragermodel.cpp.

References m_PrevColumnCount.

Referenced by data().

{
int res = 3 // + m_ScanAverager -> inputData() -> maxColumnCount()
;
// printf("QseScanAveragerModel::columnCount = %d\n", res);
// if (res > m_PrevColumnCount) {
// printf("QseScanAveragerModel::columnCount(%d>%d)\n", res, m_PrevColumnCount);
// } else if (res < m_PrevColumnCount) {
// printf("QseScanAveragerModel::columnCount(%d<%d)\n", res, m_PrevColumnCount);
// }
return res;
}
QVariant QseScanAveragerModel::data ( const QModelIndex &  index,
int  role 
) const

Definition at line 71 of file qsescanaveragermodel.cpp.

References QseScan::column(), columnCount(), and m_ScanAverager.

{
// printf("QseScanAveragerModel::data(%d,%d,%d)\n", index.row(), index.column(), role);
if (!index.isValid()) {
return QVariant();
}
if (role == Qt::DisplayRole) {
int row = index.row();
int col = index.column();
QseScan *scan = m_ScanAverager -> inputData() -> scan(row);
switch (col) {
case 0:
return scan -> name();
break;
case 1:
return scan -> maxRowCount();
break;
case 2:
return scan -> columnCount();
break;
default:
QseColumn *c = scan->column(col-3);
if (c) {
return c -> name();
} else {
return QVariant();
}
}
} else {
return QVariant();
}
}
void QseScanAveragerModel::dataChanged ( )
slot

Definition at line 149 of file qsescanaveragermodel.cpp.

{
reset();
// m_TableView -> resizeRowsToContents();
// m_TableView -> resizeColumnsToContents();
}
void QseScanAveragerModel::dataCleared ( )
slot

Definition at line 158 of file qsescanaveragermodel.cpp.

{
reset();
}
QVariant QseScanAveragerModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const

Definition at line 112 of file qsescanaveragermodel.cpp.

{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
switch (section) {
case 0:
return "Scan Name";
break;
case 1:
return "Rows";
break;
case 2:
return "Columns";
break;
default:
return tr("Col %1").arg(section-3);
}
}
if (orientation == Qt::Vertical && role == Qt::DisplayRole) {
return section;
}
return QVariant();
}
void QseScanAveragerModel::operationCompleted ( )
slot

Definition at line 138 of file qsescanaveragermodel.cpp.

{
// printf("QseScanAveragerModel::operationCompleted\n");
reset();
// m_TableView -> resizeRowsToContents();
// m_TableView -> resizeColumnsToContents();
}
int QseScanAveragerModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const

Definition at line 32 of file qsescanaveragermodel.cpp.

References m_PrevRowCount, and m_ScanAverager.

{
if (parent.column() > 0) {
return 0;
}
int res = m_ScanAverager -> inputData() -> scanCount();
// if (res > m_PrevRowCount) {
// printf("QseScanAveragerModel::rowCount(%d>%d)\n", res, m_PrevRowCount);
// } else if (res < m_PrevRowCount) {
// printf("QseScanAveragerModel::rowCount(%d<%d)\n", res, m_PrevRowCount);
// }
return res;
}
void QseScanAveragerModel::scanAdded ( int  n)
slot

Definition at line 164 of file qsescanaveragermodel.cpp.

{
}

Member Data Documentation

int QseScanAveragerModel::m_PrevColumnCount
mutableprivate

Definition at line 34 of file qsescanaveragermodel.h.

Referenced by columnCount().

int QseScanAveragerModel::m_PrevRowCount
mutableprivate

Definition at line 33 of file qsescanaveragermodel.h.

Referenced by rowCount().

QseScanAverager* QseScanAveragerModel::m_ScanAverager
private

Definition at line 31 of file qsescanaveragermodel.h.

Referenced by data(), and rowCount().

QTableView* QseScanAveragerModel::m_TableView
private

Definition at line 32 of file qsescanaveragermodel.h.


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