qtopengl_lua_statetree_model.h
Go to the documentation of this file.
1 
7 #ifndef QTOPENGL_LUA_STATETREE_MODEL_H
8 #define QTOPENGL_LUA_STATETREE_MODEL_H
9 
10 namespace argos {
11  class CQTOpenGLLuaStateTreeModel;
12  class CQTOpenGLLuaStateTreeVariableModel;
13  class CQTOpenGLLuaStateTreeFunctionModel;
14  class CQTOpenGLLuaStateTreeItem;
15 }
16 
17 extern "C" {
18 #include <lua.h>
19 }
20 
21 #include <QAbstractItemModel>
22 #include <QModelIndex>
23 #include <QVariant>
24 
25 namespace argos {
26 
27  /****************************************/
28  /****************************************/
29 
30  class CQTOpenGLLuaStateTreeModel : public QAbstractItemModel {
31 
32  Q_OBJECT
33 
34  public:
35 
36  CQTOpenGLLuaStateTreeModel(lua_State* pt_state,
37  bool b_remove_empty_tables,
38  QObject* pc_parent = 0);
39 
41 
42  virtual QVariant data(const QModelIndex& c_index,
43  int n_role) const;
44 
45  virtual Qt::ItemFlags flags(const QModelIndex& c_index) const;
46 
47  virtual QModelIndex index(int n_row,
48  int n_column,
49  const QModelIndex& c_parent = QModelIndex()) const;
50 
51  virtual QModelIndex parent(const QModelIndex& c_index) const;
52 
53  virtual int rowCount(const QModelIndex& c_parent = QModelIndex()) const;
54 
55  void SetLuaState(lua_State* pt_state);
56 
57  public slots:
58 
59  void Refresh();
60  void Refresh(int);
61 
62  protected:
63 
64  void ProcessLuaState(lua_State* pt_state,
65  CQTOpenGLLuaStateTreeItem* pc_item);
66 
67  virtual bool IsTypeVisitable(lua_State* pt_state) = 0;
68 
69  private:
70 
71  lua_State* m_ptState;
72  CQTOpenGLLuaStateTreeItem* m_pcDataRoot;
73  bool m_bRemoveEmptyTables;
74 
75  };
76 
77  /****************************************/
78  /****************************************/
79 
81 
82  Q_OBJECT
83 
84  public:
85 
86  CQTOpenGLLuaStateTreeVariableModel(lua_State* pt_state,
87  bool b_remove_empty_tables,
88  QObject* pc_parent = 0);
89 
91 
92  virtual QVariant headerData(int n_section,
93  Qt::Orientation e_orientation,
94  int n_role = Qt::DisplayRole) const;
95 
96  virtual int columnCount(const QModelIndex& c_parent = QModelIndex()) const;
97 
98  protected:
99 
100  virtual bool IsTypeVisitable(lua_State* pt_state);
101 
102  };
103 
104  /****************************************/
105  /****************************************/
106 
108 
109  Q_OBJECT
110 
111  public:
112 
113  CQTOpenGLLuaStateTreeFunctionModel(lua_State* pt_state,
114  bool b_remove_empty_tables,
115  QObject* pc_parent = 0);
116 
118 
119  virtual QVariant headerData(int n_section,
120  Qt::Orientation e_orientation,
121  int n_role = Qt::DisplayRole) const;
122 
123  virtual int columnCount(const QModelIndex& c_parent = QModelIndex()) const;
124 
125  protected:
126 
127  virtual bool IsTypeVisitable(lua_State* pt_state);
128 
129  };
130 
131  /****************************************/
132  /****************************************/
133 
134 }
135 
136 #endif
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
virtual int rowCount(const QModelIndex &c_parent=QModelIndex()) const
virtual QVariant data(const QModelIndex &c_index, int n_role) const
void ProcessLuaState(lua_State *pt_state, CQTOpenGLLuaStateTreeItem *pc_item)
CQTOpenGLLuaStateTreeModel(lua_State *pt_state, bool b_remove_empty_tables, QObject *pc_parent=0)
virtual bool IsTypeVisitable(lua_State *pt_state)=0
virtual QModelIndex parent(const QModelIndex &c_index) const
virtual QModelIndex index(int n_row, int n_column, const QModelIndex &c_parent=QModelIndex()) const
virtual Qt::ItemFlags flags(const QModelIndex &c_index) const
CQTOpenGLLuaStateTreeVariableModel(lua_State *pt_state, bool b_remove_empty_tables, QObject *pc_parent=0)
virtual int columnCount(const QModelIndex &c_parent=QModelIndex()) const
virtual QVariant headerData(int n_section, Qt::Orientation e_orientation, int n_role=Qt::DisplayRole) const
virtual int columnCount(const QModelIndex &c_parent=QModelIndex()) const
CQTOpenGLLuaStateTreeFunctionModel(lua_State *pt_state, bool b_remove_empty_tables, QObject *pc_parent=0)
virtual QVariant headerData(int n_section, Qt::Orientation e_orientation, int n_role=Qt::DisplayRole) const