2 #ifndef XGUI_PartDataModel_H
3 #define XGUI_PartDataModel_H
5 #include <QAbstractItemModel>
7 class ModelAPI_Feature;
8 class ModelAPI_Document;
10 /**\class XGUI_TopDataModel
12 * \brief This is a data model for Object Browser (QTreeView).
13 * It represents only upper part of data tree (non-parts tree items)
15 class XGUI_TopDataModel : public QAbstractItemModel
19 XGUI_TopDataModel(QObject* theParent);
20 virtual ~XGUI_TopDataModel();
22 //! Set a document object
23 virtual void setDocument(const std::shared_ptr<ModelAPI_Document>& theDoc)
28 // Reimplementation from QAbstractItemModel
29 virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
30 virtual QVariant headerData(int section, Qt::Orientation orientation,
31 int role = Qt::DisplayRole) const;
33 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
34 virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
36 virtual QModelIndex index(int theRow, int theColumn,
37 const QModelIndex& theParent = QModelIndex()) const;
39 virtual QModelIndex parent(const QModelIndex& theIndex) const;
41 virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
44 //! Types of QModelIndexes
53 std::shared_ptr<ModelAPI_Document> myDocument;
57 /**\class XGUI_PartDataModel
59 * \brief This is a data model for Object Browser (QTreeView).
60 * It represents data tree only of a one part
62 class XGUI_PartDataModel : public QAbstractItemModel
66 XGUI_PartDataModel(QObject* theParent);
67 virtual ~XGUI_PartDataModel();
69 //! Set a document object and Id of a part in the document
70 virtual void setDocument(const std::shared_ptr<ModelAPI_Document>& theDoc, int theId)
76 // Reimplementation from QAbstractItemModel
77 virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
78 virtual QVariant headerData(int section, Qt::Orientation orientation,
79 int role = Qt::DisplayRole) const;
81 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
82 virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
84 virtual QModelIndex index(int theRow, int theColumn,
85 const QModelIndex& theParent = QModelIndex()) const;
87 virtual QModelIndex parent(const QModelIndex& theIndex) const;
89 virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
92 std::shared_ptr<ModelAPI_Document> featureDocument() const;
94 //! Types of QModelIndexes
104 std::shared_ptr<ModelAPI_Document> myDocument;
106 //! Id of the current part object in the document