1 #ifndef XGUI_DataTreeModel_H
2 #define XGUI_DataTreeModel_H
5 #include "XGUI_Constants.h"
7 #include <ModelAPI_Document.h>
8 #include <ModelAPI_Feature.h>
9 #include <ModelAPI_ResultPart.h>
11 #include <QAbstractItemModel>
14 /**\class XGUI_FeaturesModel
16 * \brief Abstaract class of model object which operates with features data.
18 class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel
21 XGUI_FeaturesModel(QObject* theParent)
22 : QAbstractItemModel(theParent),
23 myItemsColor(Qt::black)
27 //! Returns Feature object by the given Model index.
28 //! Returns 0 if the given index is not index of a feature
29 virtual ObjectPtr object(const QModelIndex& theIndex) const = 0;
31 //! Returns QModelIndex which corresponds to the given feature
32 //! If the feature is not found then index is not valid
33 virtual QModelIndex objectIndex(const ObjectPtr& theFeature) const = 0;
35 //! Returns parent index of the given feature
36 virtual QModelIndex findParent(const ObjectPtr& theObject) const = 0;
38 //! Returns index corresponded to the group
39 virtual QModelIndex findGroup(const std::string& theGroup) const = 0;
41 void setItemsColor(const QColor& theColor)
43 myItemsColor = theColor;
46 QColor itemsColor() const
55 /**\class XGUI_PartModel
57 * \brief Abstaract class of model object which operates with parts data.
59 class XGUI_PartModel : public XGUI_FeaturesModel
62 XGUI_PartModel(QObject* theParent)
63 : XGUI_FeaturesModel(theParent)
67 void setPartId(int theId)
72 //! Returns true if the given document is a sub-document of this tree
73 virtual bool hasDocument(const DocumentPtr& theDoc) const = 0;
75 //! Return a Part object
76 virtual ResultPartPtr part() const = 0;
79 //! Id of the current part object in the document