Loading [MathJax]/extensions/TeX/AMSmath.js
Radium Engine  1.5.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
EntityTreeModel.hpp
1 #pragma once
2 
3 #include <Gui/RaGui.hpp>
4 
5 #include <Engine/RadiumEngine.hpp>
6 #include <Engine/Scene/ItemEntry.hpp>
7 
8 #include <Gui/TreeModel/TreeModel.hpp>
9 namespace Ra {
10 namespace Gui {
11 
12 class RA_GUI_API EngineTreeItem : public TreeItem
13 {
14  public:
15  std::string getName() const override {
16  return getEntryName( Engine::RadiumEngine::getInstance(), m_entry );
17  }
18 
19  bool isValid() const override { return m_entry.isValid(); }
20 
21  bool isSelectable() const override { return m_entry.isSelectable(); }
22 
23  public:
24  Engine::Scene::ItemEntry m_entry;
25 };
26 
29 class RA_GUI_API ItemModel : public TreeModel
30 {
31  Q_OBJECT
32  public:
33  explicit ItemModel( const Engine::RadiumEngine* engine, QObject* parent = nullptr ) :
34  TreeModel( parent ), m_engine( engine ) {
35  buildModel();
36  connect( this, &TreeModel::dataChanged, this, &ItemModel::onDataChanged );
37  }
38 
39  // Other functions
40 
43  const Engine::Scene::ItemEntry& getEntry( const QModelIndex& index ) const;
44 
47  QModelIndex findEntryIndex( const Engine::Scene::ItemEntry& entry ) const;
48 
49  public slots:
50 
51  void addItem( const Engine::Scene::ItemEntry& ent );
52 
53  void removeItem( const Engine::Scene::ItemEntry& ent );
54 
55  private slots:
56 
57  void onDataChanged( const QModelIndex& topLeft,
58  const QModelIndex& bottomRight,
59  const QVector<int>& roles );
60 
61  signals:
62 
63  void visibilityROChanged( Ra::Core::Utils::Index roIndex, bool visible );
64 
65  protected:
67  void buildModel() override;
68 
69  std::string getHeaderString() const override { return "Engine Objects Tree"; }
70 
71  protected:
74 };
75 
76 } // namespace Gui
77 } // namespace Ra
const Engine::RadiumEngine * m_engine
Engine instance.
Definition: Cage.cpp:3