1 #ifndef XGUI_DataTreeModel_H
2 #define XGUI_DataTreeModel_H
6 #include <ModelAPI_Document.h>
7 #include <ModelAPI_Feature.h>
8 #include <ModelAPI_ResultPart.h>
10 #include <QAbstractItemModel>
13 /**\class XGUI_FeaturesModel
15 * \brief Abstaract class of model object which operates with features data.
17 class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel
20 XGUI_FeaturesModel(QObject* theParent)
21 : QAbstractItemModel(theParent),
22 myItemsColor(Qt::black)
26 //! Returns Feature object by the given Model index.
27 //! Returns 0 if the given index is not index of a feature
28 virtual ObjectPtr object(const QModelIndex& theIndex) const = 0;
30 //! Returns QModelIndex which corresponds to the given feature
31 //! If the feature is not found then index is not valid
32 virtual QModelIndex objectIndex(const ObjectPtr& theFeature) const = 0;
34 //! Returns parent index of the given feature
35 virtual QModelIndex findParent(const ObjectPtr& theObject) const = 0;
37 //! Returns index corresponded to the group
38 virtual QModelIndex findGroup(const std::string& theGroup) const = 0;
40 void setItemsColor(const QColor& theColor)
42 myItemsColor = theColor;
45 QColor itemsColor() const
54 /**\class XGUI_PartModel
56 * \brief Abstaract class of model object which operates with parts data.
58 class XGUI_PartModel : public XGUI_FeaturesModel
61 XGUI_PartModel(QObject* theParent)
62 : XGUI_FeaturesModel(theParent)
66 void setPartId(int theId)
71 //! Returns true if the given document is a sub-document of this tree
72 virtual bool hasDocument(const DocumentPtr& theDoc) const = 0;
74 //! Return a Part object
75 virtual ResultPartPtr part() const = 0;
78 //! Id of the current part object in the document