SciDAVis  1.D4
MatrixModel.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : MatrixModel.h
3  Project : SciDAVis
4  Description : Model for the access to a Matrix
5  --------------------------------------------------------------------
6  Copyright : (C) 2008-2009 Tilman Benkert (thzs*gmx.net)
7  (replace * with @ in the email addresses)
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 
30 #ifndef MATRIXMODEL_H
31 #define MATRIXMODEL_H
32 
33 #include <QAbstractItemModel>
34 #include <QVector>
35 #include <QColor>
36 
37 namespace future{
38 class Matrix;
39 }
40 
42 
49 class MatrixModel : public QAbstractItemModel
50 {
51  Q_OBJECT
52 
53  public:
55  explicit MatrixModel(future::Matrix * matrix);
57  ~MatrixModel();
58 
60 
61  Qt::ItemFlags flags( const QModelIndex & index ) const;
62  QVariant data(const QModelIndex &index, int role) const;
63  QVariant headerData(int section,
64  Qt::Orientation orientation,int role = Qt::DisplayRole) const;
65  int rowCount(const QModelIndex &parent = QModelIndex()) const;
66  int columnCount(const QModelIndex & parent = QModelIndex()) const;
67  bool setData(const QModelIndex & index, const QVariant & value, int role);
68  QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
69  QModelIndex parent(const QModelIndex & child) const;
71 
72  private slots:
74 
75  void handleColumnsAboutToBeInserted(int before, int count);
76  void handleColumnsInserted(int first, int count);
77  void handleColumnsAboutToBeRemoved(int first, int count);
78  void handleColumnsRemoved(int first, int count);
79  void handleRowsAboutToBeInserted(int before, int count);
80  void handleRowsInserted(int first, int count);
81  void handleRowsAboutToBeRemoved(int first, int count);
82  void handleRowsRemoved(int first, int count);
83  void handleDataChanged(int top, int left, int bottom, int right);
85  void handleFormatChanged();
87 
88  private:
90 };
91 
92 #endif