Salome HOME
b18866eeae01c1bdd238d0cc1449ffb053360b77
[modules/shaper.git] / src / ModuleBase / ModuleBase_IDocumentDataModel.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        ModuleBase_IDocumentDataModel.h
4 // Created:     28 Apr 2015
5 // Author:      Vitaly SMETANNIKOV
6
7
8 #ifndef ModuleBase_IDocumentDataModel_H
9 #define ModuleBase_IDocumentDataModel_H
10
11 #include "ModuleBase.h"
12 #include <QAbstractItemModel>
13 #include <ModelAPI_Object.h>
14
15 class MODULEBASE_EXPORT ModuleBase_IDocumentDataModel : public QAbstractItemModel
16 {
17 Q_OBJECT
18 public:
19   ModuleBase_IDocumentDataModel(QObject* theParent): QAbstractItemModel(theParent) {}
20
21   //! Returns an object by the given Model index.
22   //! Returns 0 if the given index is not index of an object
23   virtual ObjectPtr object(const QModelIndex& theIndex) const = 0;
24
25   //! Returns index of the object
26   //! \param theObject object to find
27   virtual QModelIndex objectIndex(const ObjectPtr theObject) const = 0;
28
29   //! Clear internal data
30   virtual void clear() {}
31
32   //! Rebuild data tree
33   virtual void rebuildDataTree() {}
34 };
35
36 #endif