QXRD  0.11.16
qcepintegrateddataspreadsheetmodel.cpp
Go to the documentation of this file.
2 #include "qcepintegrateddata.h"
3 
6  : m_Integrated(integ)
7 {
8 
9 }
10 
11 int QcepIntegratedDataSpreadsheetModel::rowCount(const QModelIndex &parent) const
12 {
14 
15  if (integ) {
16  return integ->size();
17  } else {
18  return 0;
19  }
20 }
21 
22 int QcepIntegratedDataSpreadsheetModel::columnCount(const QModelIndex &parent) const
23 {
24  return 2;
25 }
26 
27 QVariant QcepIntegratedDataSpreadsheetModel::data(const QModelIndex &index, int role) const
28 {
29  QVariant res = QVariant();
30 
31  if (role == Qt::DisplayRole) {
32  if (index.isValid()) {
34 
35  if (integ) {
36  if (index.column() == 0) {
37  res = integ->x(index.row());
38  } else if (index.column() == 1) {
39  res = integ->y(index.row());
40  }
41  }
42  }
43  }
44 
45  return res;
46 }
47 
48 QVariant QcepIntegratedDataSpreadsheetModel::headerData(int section, Qt::Orientation orientation, int role) const
49 {
50  QVariant res = QVariant();
51 
52  if (role == Qt::DisplayRole) {
53  if (orientation == Qt::Horizontal) {
54  if (section == 0) {
55  res = "x";
56  } else if (section == 1) {
57  res = "y";
58  }
59  } else {
60  res = section;
61  }
62  }
63 
64  return res;
65 }
int columnCount(const QModelIndex &parent=QModelIndex()) const
QVariant headerData(int section, Qt::Orientation orientation, int role) const
int rowCount(const QModelIndex &parent=QModelIndex()) const
QSharedPointer< QcepIntegratedData > QcepIntegratedDataPtr
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
QWeakPointer< QcepIntegratedData > QcepIntegratedDataWPtr
QcepIntegratedDataSpreadsheetModel(QcepIntegratedDataWPtr integ)