Документ взят из кэша поисковой машины. Адрес оригинального документа : http://astro.uni-altai.ru/~aw/stellarium/api/PropertyBasedTableModel_8hpp_source.html
Дата изменения: Unknown
Дата индексирования: Fri Feb 28 08:02:28 2014
Кодировка:

Поисковые слова: star
Stellarium: /home/aw/devel/stellarium/trunk/plugins/Oculars/src/gui/PropertyBasedTableModel.hpp Source File
Stellarium 0.12.3
PropertyBasedTableModel.hpp
1 /*
2  * Copyright (C) 2012 Stellarium Team
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
17  */
18 
19 #ifndef PROPERTYBASEDTABLEMODEL_H
20 #define PROPERTYBASEDTABLEMODEL_H
21 
22 #include <QAbstractTableModel>
23 
35 class PropertyBasedTableModel : public QAbstractTableModel
36 {
37  Q_OBJECT
38 public:
39  PropertyBasedTableModel(QObject *parent = 0);
40  virtual ~PropertyBasedTableModel();
41 
48  void init(QList<QObject *>* content, QObject *model, QMap<int, QString> mappings);
49 
50  //Over-rides from QAbstractTableModel
51  virtual QVariant data(const QModelIndex &item, int role = Qt::DisplayRole) const;
52 
53  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
54  virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
55 
56  virtual Qt::ItemFlags flags(const QModelIndex &index) const;
57  virtual bool insertRows(int position, int rows, const QModelIndex &index=QModelIndex());
58  virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole);
59  virtual bool removeRows(int position, int rows, const QModelIndex &index=QModelIndex());
60 
61  void moveRowUp(int position);
62  void moveRowDown(int position);
63 
64 private:
65  QList<QObject *>* content;
66  QMap<int, QString> mappings;
67  QObject* modelObject;
68 };
69 
70 #endif // PROPERTYBASEDTABLEMODEL_H