scidavis  2.3.0
About: SciDAVis is a free application for Scientific Data Analysis and Visualization (a fork off of QtiPlot).
  Fossies Dox: scidavis-2.3.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

TableCommentsHeaderModel.cpp
Go to the documentation of this file.
1 
12 
32 
34  : QAbstractTableModel( parent ), d_table_model(table_model)
35 {
36  connect(d_table_model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
37  this, SIGNAL(headerDataChanged(Qt::Orientation,int,int)));
38  connect(d_table_model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
39  this, SIGNAL(headerDataChanged(Qt::Orientation,int,int)));
40  connect(d_table_model, SIGNAL(columnsAboutToBeInserted(const QModelIndex&,int,int)),
41  this, SIGNAL(columnsAboutToBeInserted(const QModelIndex&,int,int)));
42  connect(d_table_model, SIGNAL(columnsAboutToBeRemoved(const QModelIndex&,int,int)),
43  this, SIGNAL(columnsAboutToBeRemoved(const QModelIndex&,int,int)));
44  connect(d_table_model, SIGNAL(columnsInserted(const QModelIndex&,int,int)),
45  this, SIGNAL(columnsInserted(const QModelIndex&,int,int)));
46  connect(d_table_model, SIGNAL(columnsRemoved(const QModelIndex&,int,int)),
47  this, SIGNAL(columnsRemoved(const QModelIndex&,int,int)));
48 }
49 
51 {
52 }
53 
54 Qt::ItemFlags TableCommentsHeaderModel::flags(const QModelIndex & index ) const
55 {
56  if (index.isValid())
57  return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
58  else
59  return Qt::ItemIsEnabled;
60 }
61 
62 
63 QVariant TableCommentsHeaderModel::data(const QModelIndex &index, int role) const
64 {
65  Q_UNUSED(index);
66  Q_UNUSED(role);
67  return QVariant();
68 }
69 
70 QVariant TableCommentsHeaderModel::headerData(int section, Qt::Orientation orientation,
71  int role) const
72 {
73  if( orientation != Qt::Horizontal || role != Qt::DisplayRole || section < 0 || section >= columnCount())
74  return QVariant();
75 
76  return QVariant(d_table_model->headerData(section, Qt::Horizontal, TableModel::CommentRole));
77 }
78 
79 int TableCommentsHeaderModel::rowCount(const QModelIndex &parent) const
80 {
81  Q_UNUSED(parent)
82  return d_table_model->rowCount();
83 }
84 
85 int TableCommentsHeaderModel::columnCount(const QModelIndex & parent) const
86 {
87  Q_UNUSED(parent)
88  return d_table_model->columnCount();
89 }
90 
TableModel
Model for the access to a Table.
Definition: TableModel.h:54
TableModel::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: TableModel.cpp:143
TableCommentsHeaderModel::flags
Qt::ItemFlags flags(const QModelIndex &index) const
Definition: TableCommentsHeaderModel.cpp:54
TableCommentsHeaderModel::TableCommentsHeaderModel
TableCommentsHeaderModel(TableModel *table_model, QObject *parent=0)
Constructor.
Definition: TableCommentsHeaderModel.cpp:33
TableCommentsHeaderModel::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role) const
Definition: TableCommentsHeaderModel.cpp:70
TableCommentsHeaderModel.h
TableModel::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role) const
Definition: TableModel.cpp:138
TableModel::columnCount
int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: TableModel.cpp:148
TableModel::CommentRole
@ CommentRole
the column comment (for headerData())
Definition: TableModel.h:67
TableCommentsHeaderModel::data
QVariant data(const QModelIndex &index, int role) const
Definition: TableCommentsHeaderModel.cpp:63
TableCommentsHeaderModel::d_table_model
TableModel * d_table_model
Definition: TableCommentsHeaderModel.h:59
TableCommentsHeaderModel::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: TableCommentsHeaderModel.cpp:79
TableCommentsHeaderModel::~TableCommentsHeaderModel
virtual ~TableCommentsHeaderModel()
Destructor.
Definition: TableCommentsHeaderModel.cpp:50
TableCommentsHeaderModel::columnCount
int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: TableCommentsHeaderModel.cpp:85