Loading [MathJax]/extensions/TeX/AMSmath.js
Radium Engine  1.5.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
SelectionManager.hpp
1 #pragma once
2 #include <Gui/RaGui.hpp>
3 
4 #include <Engine/Scene/ItemEntry.hpp>
5 #include <Gui/TreeModel/EntityTreeModel.hpp>
6 #include <QItemSelectionModel>
7 
8 namespace Ra {
9 namespace Gui {
10 
11 class RA_GUI_API SelectionManager : public QItemSelectionModel
12 {
13  Q_OBJECT
14  public:
15  explicit SelectionManager( ItemModel* model, QObject* parent = nullptr );
16 
17  // The following functions adapt QItemSelectionModel functions to
18  // operate with ItemEntries instead of model indices.
19 
25  bool isSelected( const Engine::Scene::ItemEntry& ent ) const;
26 
28  std::vector<Engine::Scene::ItemEntry> selectedEntries() const;
29 
35  const Engine::Scene::ItemEntry& currentItem() const;
36 
42  virtual void select( const Engine::Scene::ItemEntry& ent,
43  QItemSelectionModel::SelectionFlags command );
44 
50  void setCurrentEntry( const Engine::Scene::ItemEntry& ent,
51  QItemSelectionModel::SelectionFlags command );
52 
53  protected slots:
54  void onModelRebuilt();
55 
56  protected slots:
57  void printSelection() const;
58 
59  protected:
60  const ItemModel* itemModel() const { return static_cast<const ItemModel*>( model() ); }
61 };
62 
63 } // namespace Gui
64 } // namespace Ra
Definition: Cage.cpp:3