goat3d
view goatview/src/scenemodel.h @ 93:07c0ec4a410d
[goatview] line endings fix and missing post_redisplay in load_scene
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 18 May 2014 06:20:20 +0300 |
parents | 6d04caf510ab |
children |
line source
1 #ifndef SCENEMODEL_H_
2 #define SCENEMODEL_H_
4 #include <map>
5 #include <set>
6 #include <QtCore/QAbstractItemModel>
7 #include "goat3d.h"
9 struct SceneNodeData {
10 bool visible;
11 bool selected;
12 };
14 class SceneModel : public QAbstractItemModel {
15 private:
16 Q_OBJECT
18 goat3d *scn;
19 std::map<goat3d_node*, SceneNodeData> node_data;
20 std::set<goat3d_node*> selected;
22 public:
23 SceneModel();
24 ~SceneModel();
26 void set_scene(goat3d *scn);
27 void clear_scene();
29 SceneNodeData *get_node_data(goat3d_node *node) const;
31 Qt::ItemFlags flags(const QModelIndex &index) const;
32 QVariant data(const QModelIndex &index, int role) const;
33 bool setData(const QModelIndex &index, const QVariant &value, int role);
34 QVariant headerData(int section, Qt::Orientation orient, int role) const;
35 int rowCount(const QModelIndex &parent) const;
36 int columnCount(const QModelIndex &parent) const;
37 bool hasChildren(const QModelIndex &parent) const;
38 QModelIndex index(int row, int column, const QModelIndex &parent) const;
39 QModelIndex parent(const QModelIndex &index) const;
41 void selchange(const QModelIndexList &selidx);
42 };
44 #endif // SCENEMODEL_H_