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)  

TableModel.h
Go to the documentation of this file.
1 
11 
30 #ifndef TABLEMODEL_H
31 #define TABLEMODEL_H
32 
33 #include <QAbstractItemModel>
34 #include <QList>
35 #include <QStringList>
36 #include "core/AbstractFilter.h"
37 #include <QColor>
38 #include <QPointer>
39 
40 class Column;
41 namespace future{ class Table; }
42 
44 
53 class TableModel : public QAbstractItemModel
54 {
55  Q_OBJECT
56 
57  public:
59  explicit TableModel(future::Table * table);
61  ~TableModel();
62 
65  MaskingRole = Qt::UserRole,
66  FormulaRole = Qt::UserRole+1,
67  CommentRole = Qt::UserRole+2,
68  };
69 
71 
72  Qt::ItemFlags flags( const QModelIndex & index ) const;
73  QVariant data(const QModelIndex &index, int role) const;
74  QVariant headerData(int section,
75  Qt::Orientation orientation,int role) const;
76  int rowCount(const QModelIndex &parent = QModelIndex()) const;
77  int columnCount(const QModelIndex & parent = QModelIndex()) const;
78  bool setData(const QModelIndex & index, const QVariant & value, int role);
79  QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
80  QModelIndex parent(const QModelIndex & child) const;
82 
83 #ifdef LEGACY_CODE_0_2_x
84  bool isReadOnly() const { return d_read_only; }
85  void setReadOnly(bool read_only) { d_read_only = read_only; }
86 #endif
87 
88  Column * column(int index); // this is needed for the comment header view
89 
90  void activateFormulaMode(bool on) { d_formula_mode = on; }
91  bool formulaModeActive() const { return d_formula_mode; }
92 
93  private slots:
95 
96  void handleColumnsAboutToBeInserted(int, QList<Column*>);
97  void handleColumnsInserted(int first, int count);
98  void handleColumnsAboutToBeRemoved(int first, int count);
99  void handleColumnsRemoved(int first, int count);
100  void handleRowsAboutToBeInserted(int before, int count);
101  void handleRowsInserted(int first, int count);
102  void handleRowsAboutToBeRemoved(int first, int count);
103  void handleRowsRemoved(int first, int count);
104  void handleDataChanged(int top, int left, int bottom, int right);
106 
107  private:
108  QPointer<future::Table> d_table;
111 
112 #ifdef LEGACY_CODE_0_2_x
113  bool d_read_only;
114 #endif
115 };
116 
117 #endif
TableModel
Model for the access to a Table.
Definition: TableModel.h:54
TableModel::CustomDataRole
CustomDataRole
Custom data roles used in addition to Qt::ItemDataRole.
Definition: TableModel.h:64
future
Definition: AbstractAspect.h:43
AbstractFilter.h
TableModel::handleColumnsAboutToBeInserted
void handleColumnsAboutToBeInserted(int, QList< Column * >)
Definition: TableModel.cpp:198
TableModel::data
QVariant data(const QModelIndex &index, int role) const
Definition: TableModel.cpp:85
TableModel::d_table
QPointer< future::Table > d_table
Definition: TableModel.h:108
TableModel::TableModel
TableModel(future::Table *table)
Constructor.
Definition: TableModel.cpp:38
TableModel::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: TableModel.cpp:143
TableModel::handleColumnsRemoved
void handleColumnsRemoved(int first, int count)
Definition: TableModel.cpp:217
TableModel::d_formula_mode
bool d_formula_mode
Toggle flag for formula mode.
Definition: TableModel.h:110
future::Table
Aspect providing a spreadsheet table with column logic.
Definition: future_Table.h:86
TableModel::index
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: TableModel.cpp:187
Column
Aspect that manages a column.
Definition: Column.h:59
TableModel::handleRowsAboutToBeInserted
void handleRowsAboutToBeInserted(int before, int count)
Definition: TableModel.cpp:224
TableModel::flags
Qt::ItemFlags flags(const QModelIndex &index) const
Definition: TableModel.cpp:70
Table
MDI window providing a spreadsheet table with column logic.
Definition: Table.h:51
TableModel::handleColumnsAboutToBeRemoved
void handleColumnsAboutToBeRemoved(int first, int count)
Definition: TableModel.cpp:212
TableModel::~TableModel
~TableModel()
Destructor.
Definition: TableModel.cpp:66
TableModel::handleDataChanged
void handleDataChanged(int top, int left, int bottom, int right)
Definition: TableModel.cpp:248
TableModel::handleRowsAboutToBeRemoved
void handleRowsAboutToBeRemoved(int first, int count)
Definition: TableModel.cpp:236
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::handleColumnsInserted
void handleColumnsInserted(int first, int count)
Definition: TableModel.cpp:205
TableModel::parent
QModelIndex parent(const QModelIndex &child) const
Definition: TableModel.cpp:192
TableModel::activateFormulaMode
void activateFormulaMode(bool on)
Definition: TableModel.h:90
TableModel::CommentRole
@ CommentRole
the column comment (for headerData())
Definition: TableModel.h:67
TableModel::FormulaRole
@ FormulaRole
the cells formula
Definition: TableModel.h:66
TableModel::handleRowsInserted
void handleRowsInserted(int first, int count)
Definition: TableModel.cpp:229
TableModel::MaskingRole
@ MaskingRole
bool determining whether the cell is masked
Definition: TableModel.h:65
TableModel::handleRowsRemoved
void handleRowsRemoved(int first, int count)
Definition: TableModel.cpp:241
TableModel::formulaModeActive
bool formulaModeActive() const
Definition: TableModel.h:91
TableModel::setData
bool setData(const QModelIndex &index, const QVariant &value, int role)
Definition: TableModel.cpp:153
TableModel::column
Column * column(int index)
Definition: TableModel.cpp:253