File indexing completed on 2024-12-22 04:17:38

0001 /***************************************************************************
0002  *                                                                         *
0003  *   copyright : (C) 2007 The University of Toronto                        *
0004  *                   netterfield@astro.utoronto.ca                         *
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  ***************************************************************************/
0012 
0013 #ifndef MATRIXMODEL_H
0014 #define MATRIXMODEL_H
0015 
0016 #include <QAbstractItemModel>
0017 #include <matrix.h>
0018 
0019 namespace Kst {
0020 
0021 class MatrixModel : public QAbstractItemModel
0022 {
0023 public:
0024   explicit MatrixModel(MatrixPtr v);
0025   ~MatrixModel();
0026 
0027   int columnCount(const QModelIndex& parent = QModelIndex()) const;
0028   int rowCount(const QModelIndex& parent = QModelIndex()) const;
0029   QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
0030   QModelIndex index(int row, int col, const QModelIndex& parent = QModelIndex()) const;
0031   QModelIndex parent(const QModelIndex& index) const;
0032   QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
0033   Qt::ItemFlags flags(const QModelIndex& index) const;
0034   bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
0035 
0036 private:
0037   MatrixPtr _m;
0038 };
0039 
0040 }
0041 
0042 #endif
0043 
0044 // vim: ts=2 sw=2 et