goat3d
annotate 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 |
rev | line source |
---|---|
nuclear@86 | 1 #ifndef SCENEMODEL_H_ |
nuclear@86 | 2 #define SCENEMODEL_H_ |
nuclear@86 | 3 |
nuclear@86 | 4 #include <map> |
nuclear@88 | 5 #include <set> |
nuclear@86 | 6 #include <QtCore/QAbstractItemModel> |
nuclear@86 | 7 #include "goat3d.h" |
nuclear@86 | 8 |
nuclear@86 | 9 struct SceneNodeData { |
nuclear@86 | 10 bool visible; |
nuclear@88 | 11 bool selected; |
nuclear@86 | 12 }; |
nuclear@86 | 13 |
nuclear@86 | 14 class SceneModel : public QAbstractItemModel { |
nuclear@86 | 15 private: |
nuclear@86 | 16 Q_OBJECT |
nuclear@86 | 17 |
nuclear@86 | 18 goat3d *scn; |
nuclear@86 | 19 std::map<goat3d_node*, SceneNodeData> node_data; |
nuclear@88 | 20 std::set<goat3d_node*> selected; |
nuclear@86 | 21 |
nuclear@86 | 22 public: |
nuclear@86 | 23 SceneModel(); |
nuclear@86 | 24 ~SceneModel(); |
nuclear@86 | 25 |
nuclear@86 | 26 void set_scene(goat3d *scn); |
nuclear@86 | 27 void clear_scene(); |
nuclear@86 | 28 |
nuclear@86 | 29 SceneNodeData *get_node_data(goat3d_node *node) const; |
nuclear@86 | 30 |
nuclear@86 | 31 Qt::ItemFlags flags(const QModelIndex &index) const; |
nuclear@86 | 32 QVariant data(const QModelIndex &index, int role) const; |
nuclear@86 | 33 bool setData(const QModelIndex &index, const QVariant &value, int role); |
nuclear@86 | 34 QVariant headerData(int section, Qt::Orientation orient, int role) const; |
nuclear@86 | 35 int rowCount(const QModelIndex &parent) const; |
nuclear@86 | 36 int columnCount(const QModelIndex &parent) const; |
nuclear@86 | 37 bool hasChildren(const QModelIndex &parent) const; |
nuclear@86 | 38 QModelIndex index(int row, int column, const QModelIndex &parent) const; |
nuclear@86 | 39 QModelIndex parent(const QModelIndex &index) const; |
nuclear@88 | 40 |
nuclear@88 | 41 void selchange(const QModelIndexList &selidx); |
nuclear@86 | 42 }; |
nuclear@86 | 43 |
nuclear@86 | 44 #endif // SCENEMODEL_H_ |