1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 #ifndef XGUI_DataTreeModel_H
4 #define XGUI_DataTreeModel_H
8 #include <ModelAPI_Document.h>
9 #include <ModelAPI_Feature.h>
10 #include <ModelAPI_ResultPart.h>
12 #include <QAbstractItemModel>
15 /**\class XGUI_FeaturesModel
17 * \brief Abstaract class of model object which operates with features data.
19 class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel
22 XGUI_FeaturesModel(QObject* theParent)
23 : QAbstractItemModel(theParent),
24 myItemsColor(Qt::black)
28 //! Returns Feature object by the given Model index.
29 //! Returns 0 if the given index is not index of a feature
30 virtual ObjectPtr object(const QModelIndex& theIndex) const = 0;
32 //! Returns QModelIndex which corresponds to the given feature
33 //! If the feature is not found then index is not valid
34 virtual QModelIndex objectIndex(const ObjectPtr& theFeature) const = 0;
36 //! Returns parent index of the given feature
37 virtual QModelIndex findParent(const ObjectPtr& theObject) const = 0;
39 //! Returns index corresponded to the group
40 virtual QModelIndex findGroup(const std::string& theGroup) const = 0;
42 void setItemsColor(const QColor& theColor)
44 myItemsColor = theColor;
47 QColor itemsColor() const
56 /**\class XGUI_PartModel
58 * \brief Abstaract class of model object which operates with parts data.
60 class XGUI_PartModel : public XGUI_FeaturesModel
63 XGUI_PartModel(QObject* theParent)
64 : XGUI_FeaturesModel(theParent)
68 void setPartId(int theId)
73 //! Returns true if the given document is a sub-document of this tree
74 virtual bool hasDocument(const DocumentPtr& theDoc) const = 0;
76 //! Return a Part object
77 virtual ResultPartPtr part() const = 0;
80 //! Id of the current part object in the document