X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_DataTreeModel.h;h=5b9f5a8394f4c2ec8c6d8fc74cab6db593ba8252;hb=a21978de92f434702a3215df667f22e720cf107f;hp=b7313a922a5a53f99aaef4a79cd9cc359e49af5b;hpb=be6e3770b8d97cc079f33efc8eaa571f645fbbdb;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_DataTreeModel.h b/src/XGUI/XGUI_DataTreeModel.h index b7313a922..5b9f5a839 100644 --- a/src/XGUI/XGUI_DataTreeModel.h +++ b/src/XGUI/XGUI_DataTreeModel.h @@ -6,7 +6,10 @@ #include "XGUI_Constants.h" #include +#include + #include +#include /**\class XGUI_FeaturesModel * \ingroup GUI @@ -15,21 +18,29 @@ class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel { public: - XGUI_FeaturesModel(const boost::shared_ptr& theDocument, QObject* theParent): - QAbstractItemModel(theParent), myDocument(theDocument) {} + XGUI_FeaturesModel(QObject* theParent): + QAbstractItemModel(theParent), myItemsColor(Qt::black) {} //! Returns Feature object by the given Model index. //! Returns 0 if the given index is not index of a feature virtual FeaturePtr feature(const QModelIndex& theIndex) const = 0; + //! Returns QModelIndex which corresponds to the given feature + //! If the feature is not found then index is not valid + virtual QModelIndex featureIndex(const FeaturePtr& theFeature) const = 0; + //! Returns parent index of the given feature - virtual QModelIndex findParent(const boost::shared_ptr& theFeature) const = 0; + virtual QModelIndex findParent(const FeaturePtr& theFeature) const = 0; //! Returns index corresponded to the group virtual QModelIndex findGroup(const std::string& theGroup) const = 0; + void setItemsColor(const QColor& theColor) { myItemsColor = theColor; } + + QColor itemsColor() const { return myItemsColor; } + protected: - boost::shared_ptr myDocument; + QColor myItemsColor; }; @@ -40,13 +51,13 @@ protected: class XGUI_PartModel : public XGUI_FeaturesModel { public: - XGUI_PartModel(const boost::shared_ptr& theDocument, QObject* theParent): - XGUI_FeaturesModel(theDocument, theParent) {} + XGUI_PartModel(QObject* theParent): + XGUI_FeaturesModel(theParent) {} void setPartId(int theId) { myId = theId; } //! Returns true if the given document is a sub-document of this tree - virtual bool hasDocument(const boost::shared_ptr& theDoc) const = 0; + virtual bool hasDocument(const DocumentPtr& theDoc) const = 0; //! Return a Part object virtual FeaturePtr part() const = 0;