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

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 VECTORMODEL_H
0014 #define VECTORMODEL_H
0015 
0016 #include <QAbstractTableModel>
0017 #include <QPointer>
0018 #include <vector.h>
0019 
0020 namespace Kst {
0021 
0022 class VectorModel : public QAbstractTableModel
0023 {
0024 public:
0025   VectorModel();
0026   ~VectorModel();
0027 
0028   bool addVector(VectorPtr v);
0029   bool removeVector(int order);
0030   int columnCount(const QModelIndex& parent = QModelIndex()) const;
0031   int rowCount(const QModelIndex& parent = QModelIndex()) const;
0032   QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
0033   QModelIndex parent(const QModelIndex& index) const;
0034   QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
0035   Qt::ItemFlags flags(const QModelIndex& index) const;
0036   bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
0037   void resetIfChanged();
0038   void setDigitNumber(int column, int nbDigits);
0039 private:
0040   VectorList _vectorList;
0041   QList<int> _digitNbList;
0042   int _rows;
0043 };
0044 
0045 }
0046 
0047 #endif
0048 
0049 // vim: ts=2 sw=2 et