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