2 #ifndef XGUI_PartDataModel_H
3 #define XGUI_PartDataModel_H
5 #include "XGUI_DataTreeModel.h"
7 /**\class XGUI_TopDataModel
9 * \brief This is a data model for Object Browser (QTreeView).
10 * It represents only upper part of data tree (non-parts tree items)
12 class XGUI_TopDataModel : public XGUI_FeaturesModel
16 XGUI_TopDataModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent);
17 virtual ~XGUI_TopDataModel();
19 // Reimplementation from QAbstractItemModel
20 virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
21 virtual QVariant headerData(int section, Qt::Orientation orientation,
22 int role = Qt::DisplayRole) const;
24 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
25 virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
27 virtual QModelIndex index(int theRow, int theColumn,
28 const QModelIndex& theParent = QModelIndex()) const;
30 virtual QModelIndex parent(const QModelIndex& theIndex) const;
32 virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
34 //! Returns Feature object by the given Model index.
35 //! Returns 0 if the given index is not index of a feature
36 virtual FeaturePtr feature(const QModelIndex& theIndex) const;
39 //! Types of QModelIndexes
50 /**\class XGUI_PartDataModel
52 * \brief This is a data model for Object Browser (QTreeView).
53 * It represents data tree only of a one part
55 class XGUI_PartDataModel : public XGUI_PartModel
59 XGUI_PartDataModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent);
60 virtual ~XGUI_PartDataModel();
62 // Reimplementation from QAbstractItemModel
63 virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
64 virtual QVariant headerData(int section, Qt::Orientation orientation,
65 int role = Qt::DisplayRole) const;
67 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
68 virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
70 virtual QModelIndex index(int theRow, int theColumn,
71 const QModelIndex& theParent = QModelIndex()) const;
73 virtual QModelIndex parent(const QModelIndex& theIndex) const;
75 virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
77 //! Returns Feature object by the given Model index.
78 //! Returns 0 if the given index is not index of a feature
79 virtual FeaturePtr feature(const QModelIndex& theIndex) const;
82 std::shared_ptr<ModelAPI_Document> featureDocument() const;
84 //! Types of QModelIndexes