QXRD  0.11.16
Public Member Functions | Private Attributes | List of all members
QcepDataGroupSpreadsheetModel Class Reference

#include <qcepdatagroupspreadsheetmodel.h>

Inheritance diagram for QcepDataGroupSpreadsheetModel:
Inheritance graph
[legend]
Collaboration diagram for QcepDataGroupSpreadsheetModel:
Collaboration graph
[legend]

Public Member Functions

 QcepDataGroupSpreadsheetModel (QcepDataGroupWPtr group)
 
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) const
 
- Public Member Functions inherited from QcepSpreadsheetModel
 QcepSpreadsheetModel ()
 

Private Attributes

QcepDataGroupWPtr m_Group
 

Detailed Description

Definition at line 7 of file qcepdatagroupspreadsheetmodel.h.

Constructor & Destructor Documentation

QcepDataGroupSpreadsheetModel::QcepDataGroupSpreadsheetModel ( QcepDataGroupWPtr  group)

Definition at line 4 of file qcepdatagroupspreadsheetmodel.cpp.

4  :
5  m_Group(group)
6 {
7 
8 }

Member Function Documentation

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

Definition at line 21 of file qcepdatagroupspreadsheetmodel.cpp.

22 {
23  return 3;
24 }
QVariant QcepDataGroupSpreadsheetModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const

Definition at line 26 of file qcepdatagroupspreadsheetmodel.cpp.

References m_Group.

27 {
28  QVariant res = QVariant();
29 
30  if (role == Qt::DisplayRole) {
31  if (index.isValid()) {
33 
34  if (grp) {
35  QcepDataObjectPtr obj = grp->item(index.row());
36 
37  if (obj) {
38  res = obj->columnData(index.column());
39  }
40  }
41  }
42  }
43 
44  return res;
45 }
QSharedPointer< QcepDataGroup > QcepDataGroupPtr
QSharedPointer< QcepDataObject > QcepDataObjectPtr
QVariant QcepDataGroupSpreadsheetModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const

Definition at line 47 of file qcepdatagroupspreadsheetmodel.cpp.

48 {
49  QVariant res = QVariant();
50 
51  if (role == Qt::DisplayRole) {
52  if (orientation == Qt::Horizontal) {
53  switch (section) {
54  case 0:
55  res = "Name";
56  break;
57 
58  case 1:
59  res = "Type";
60  break;
61 
62  case 2:
63  res = "Description";
64  break;
65  }
66  } else if (orientation == Qt::Vertical) {
67  res = section;
68  }
69  }
70 
71  return res;
72 }
int QcepDataGroupSpreadsheetModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const

Definition at line 10 of file qcepdatagroupspreadsheetmodel.cpp.

References m_Group.

11 {
13 
14  if (grp) {
15  return grp->childCount();
16  } else {
17  return 0;
18  }
19 }
QSharedPointer< QcepDataGroup > QcepDataGroupPtr

Member Data Documentation

QcepDataGroupWPtr QcepDataGroupSpreadsheetModel::m_Group
private

Definition at line 18 of file qcepdatagroupspreadsheetmodel.h.

Referenced by data(), and rowCount().


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