]> SALOME platform Git repositories - modules/shaper.git/blob - src/XGUI/XGUI_DocumentDataModel.h
Salome HOME
796a8e51a750f694176a8607d18c1ed028fdd5ee
[modules/shaper.git] / src / XGUI / XGUI_DocumentDataModel.h
1
2 #ifndef XGUI_DocumentDataModel_H
3 #define XGUI_DocumentDataModel_H
4
5 #include <QAbstractItemModel>
6 #include <Event_Listener.h>
7
8 #include <QList>
9
10 class ModelAPI_Document;
11 class XGUI_PartDataModel;
12 class XGUI_TopDataModel;
13
14
15 class XGUI_DocumentDataModel : public QAbstractItemModel, public Event_Listener
16 {
17   Q_OBJECT
18 public:
19   XGUI_DocumentDataModel(QObject* theParent);
20   virtual ~XGUI_DocumentDataModel();
21
22   // Event Listener method
23   virtual void processEvent(const Event_Message* theMessage);
24
25
26   virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
27   virtual QVariant headerData(int theSection, Qt::Orientation theOrient,
28                               int theRole = Qt::DisplayRole) const;
29
30   virtual int rowCount(const QModelIndex& theParent = QModelIndex()) const;
31   virtual int columnCount(const QModelIndex& theParent = QModelIndex()) const;
32
33   virtual QModelIndex index(int theRow, int theColumn, 
34                             const QModelIndex &parent = QModelIndex()) const;
35
36   virtual QModelIndex parent(const QModelIndex& theIndex) const;
37
38   virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
39
40 private:
41
42   QModelIndex toSourceModel(const QModelIndex& theProxy) const;
43   QModelIndex fromSourceModel(const QModelIndex& theSource) const;
44
45
46   std::shared_ptr<ModelAPI_Document> myDocument;
47
48   XGUI_TopDataModel* myModel;
49   QList<XGUI_PartDataModel*> myPartModels;
50 };
51
52 #endif