From: vsr Date: Tue, 18 Jan 2011 10:12:28 +0000 (+0000) Subject: 0021135: EDF 1753 OTHER: Bug in the python dump due to iparameters X-Git-Tag: V6_3_0a1~92 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1f5c8e9ac86a0a9fb3f4a068fd63d10227865d7c;p=modules%2Fgui.git 0021135: EDF 1753 OTHER: Bug in the python dump due to iparameters --- diff --git a/src/LightApp/LightApp_DataObject.cxx b/src/LightApp/LightApp_DataObject.cxx index 804bbc214..cd7e7bdab 100644 --- a/src/LightApp/LightApp_DataObject.cxx +++ b/src/LightApp/LightApp_DataObject.cxx @@ -124,6 +124,16 @@ int LightApp_DataObject::groupId() const return m ? m->groupId() : CAM_DataObject::groupId(); } +/*! + \brief Check if the object is visible. + \return \c true if this object is displayable or \c false otherwise +*/ +bool LightApp_DataObject::isVisible() const +{ + LightApp_RootObject* r = dynamic_cast( root() ); + return r && r->study() && componentDataType() != r->study()->getVisualComponentName(); +} + /*! \brief Get object string identifier. diff --git a/src/LightApp/LightApp_DataObject.h b/src/LightApp/LightApp_DataObject.h index 3b8bb9cc1..d9e903726 100644 --- a/src/LightApp/LightApp_DataObject.h +++ b/src/LightApp/LightApp_DataObject.h @@ -58,6 +58,8 @@ public: virtual bool compare( const QVariant&, const QVariant&, const int = NameId ) const; virtual int groupId() const; + virtual bool isVisible() const; + protected: QString myCompDataType; SUIT_DataObject* myCompObject; diff --git a/src/SUIT/SUIT_DataObject.cxx b/src/SUIT/SUIT_DataObject.cxx index 8716401c2..8b9f076d2 100755 --- a/src/SUIT/SUIT_DataObject.cxx +++ b/src/SUIT/SUIT_DataObject.cxx @@ -543,6 +543,19 @@ int SUIT_DataObject::alignment( const int /*id*/ ) const return Qt::AlignLeft; } +/*! + \brief Check if the object is visible. + + This method can be re-implemented in the subclasses. + Default implementation returns \c true (all objects are visible by default). + + \return \c true if this object is displayable or \c false otherwise +*/ +bool SUIT_DataObject::isVisible() const +{ + return true; +} + /*! \brief Check if the object is draggable. diff --git a/src/SUIT/SUIT_DataObject.h b/src/SUIT/SUIT_DataObject.h index c44155817..0b9377ae9 100755 --- a/src/SUIT/SUIT_DataObject.h +++ b/src/SUIT/SUIT_DataObject.h @@ -110,6 +110,7 @@ public: virtual QFont font( const int = NameId ) const; virtual int alignment( const int = NameId ) const; + virtual bool isVisible() const; virtual bool isDragable() const; virtual bool isDropAccepted( SUIT_DataObject* obj ); diff --git a/src/SUIT/SUIT_TreeModel.cxx b/src/SUIT/SUIT_TreeModel.cxx index 8e53c621b..969c61201 100755 --- a/src/SUIT/SUIT_TreeModel.cxx +++ b/src/SUIT/SUIT_TreeModel.cxx @@ -1684,6 +1684,18 @@ SUIT_AbstractModel* SUIT_ProxyModel::treeModel() const return dynamic_cast( sourceModel() ); } +/*! + \brief Filter rows + \param sourceRow row index of the source data model + \param sourceParent parent model index of the source data model + \return \c true if the specified row should be filtered out (i.e. not displayed) or \c false otherwise +*/ +bool SUIT_ProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const +{ + SUIT_DataObject* o = treeModel()->object( sourceModel()->index( sourceRow, 0, sourceParent ) ); + return o && o->isVisible(); +} + /*! \brief Register new column in the model \param group_id - unique data object identificator allowing the classification of objects diff --git a/src/SUIT/SUIT_TreeModel.h b/src/SUIT/SUIT_TreeModel.h index 1163e8745..a1711fe01 100755 --- a/src/SUIT/SUIT_TreeModel.h +++ b/src/SUIT/SUIT_TreeModel.h @@ -244,6 +244,7 @@ signals: protected: SUIT_AbstractModel* treeModel() const; + virtual bool filterAcceptsRow( int, const QModelIndex& ) const; private: bool mySortingEnabled; diff --git a/src/SalomeApp/SalomeApp_DataObject.cxx b/src/SalomeApp/SalomeApp_DataObject.cxx index ad7910208..2e143d567 100644 --- a/src/SalomeApp/SalomeApp_DataObject.cxx +++ b/src/SalomeApp/SalomeApp_DataObject.cxx @@ -393,6 +393,22 @@ bool SalomeApp_DataObject::expandable() const return exp; } +/*! + \brief Check if the object is visible. + \return \c true if this object is displayable or \c false otherwise +*/ +bool SalomeApp_DataObject::isVisible() const +{ + bool isDraw = true; + _PTR(GenericAttribute) anAttr; + if ( myObject && myObject->FindAttribute(anAttr, "AttributeDrawable") ) + { + _PTR(AttributeDrawable) aAttrDraw = anAttr; + isDraw = aAttrDraw->IsDrawable(); + } + return isDraw && LightApp_DataObject::isVisible() && ( !name().isEmpty() || isReference() ); +} + /*! \brief Check if the specified column supports custom sorting. \param id column id diff --git a/src/SalomeApp/SalomeApp_DataObject.h b/src/SalomeApp/SalomeApp_DataObject.h index 9487a6fe8..b0c2df905 100644 --- a/src/SalomeApp/SalomeApp_DataObject.h +++ b/src/SalomeApp/SalomeApp_DataObject.h @@ -64,6 +64,8 @@ public: bool hasChildren() const; bool expandable() const; + virtual bool isVisible() const; + virtual QString componentDataType() const; virtual bool customSorting( const int = NameId ) const;