qavrg 0.0.28
Public Slots | Public Member Functions | Private Attributes
QavrgResultsModel Class Reference

#include <qavrgresultsmodel.h>

List of all members.

Public Slots

void new_FittingResults ()

Public Member Functions

 QavrgResultsModel (QavrgAcquisition *acq, QObject *parent=0)
int rowCount (const QModelIndex &parent=QModelIndex()) const
int columnCount (const QModelIndex &parent=QModelIndex()) const
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const

Private Attributes

QavrgAcquisitionm_Acquisition

Detailed Description

Definition at line 8 of file qavrgresultsmodel.h.


Constructor & Destructor Documentation

QavrgResultsModel::QavrgResultsModel ( QavrgAcquisition acq,
QObject *  parent = 0 
)

Definition at line 6 of file qavrgresultsmodel.cpp.

  : QAbstractTableModel(parent),
    m_Acquisition(acq)
{
}

Member Function Documentation

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

3

Definition at line 28 of file qavrgresultsmodel.cpp.

References m_Acquisition.

{
  int res = m_Acquisition->get_NChannels();

//   printf("QavrgResultsModel::columnCount() = %d\n", res);

  return res;
}
QVariant QavrgResultsModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const

Definition at line 37 of file qavrgresultsmodel.cpp.

References m_Acquisition, and QavrgFitter::PeakHeight.

{
  if (!index.isValid()) {
    return QVariant();
  }

  if (role == Qt::DisplayRole) {
    int row = index.row();
    int col = index.column();

    return m_Acquisition -> readResult((int)(col), QavrgFitter::PeakHeight, row);
  }

  if (role == Qt::TextAlignmentRole) {
    int res = Qt::AlignRight | Qt::AlignVCenter;
    return res;
  }

  return QVariant();
}
QVariant QavrgResultsModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const

Definition at line 58 of file qavrgresultsmodel.cpp.

References QavrgAcquisition::bucketNumber(), m_Acquisition, QavrgAcquisition::orbitNumber(), and QavrgFitter::PeakHeight.

{
  if (role == Qt::DisplayRole) {
    const char * labels[] = {"Baseline","Slope","Peak"};

    if (orientation == Qt::Horizontal) {
      return tr("Ch%1.%2").arg((int)(section)).arg(labels[QavrgFitter::PeakHeight]);
    } else {
      return tr("%1 [%2,%3]").arg(section).arg(m_Acquisition->orbitNumber(section)).arg(m_Acquisition->bucketNumber(section));
    }
  }

  return QVariant();
}
void QavrgResultsModel::new_FittingResults ( ) [slot]

Definition at line 12 of file qavrgresultsmodel.cpp.

{
//  printf("QavrgResultsModel::new_FittingResults()\n");

  reset();
}
int QavrgResultsModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const

Definition at line 19 of file qavrgresultsmodel.cpp.

References m_Acquisition, and QavrgAcquisition::resultSize().

{
  int res = m_Acquisition->resultSize();

//   printf("QavrgResultsModel::rowCount() = %d\n", res);

  return res;
}

Member Data Documentation

Definition at line 24 of file qavrgresultsmodel.h.

Referenced by columnCount(), data(), headerData(), and rowCount().


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