From 3ba177842f7e8b299ec2ed3c2f424dded01a2e79 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 25 Feb 2011 06:19:16 +0000 Subject: [PATCH] Fix regression caused by introducing of GUI observers - Show/Hide children operation in GEOM module has stopped working. --- src/SUIT/SUIT_DataObject.cxx | 5 +++++ src/SUIT/SUIT_DataObject.h | 1 + src/SUIT/SUIT_TreeModel.cxx | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/SUIT/SUIT_DataObject.cxx b/src/SUIT/SUIT_DataObject.cxx index 36c8e5fd5..f8d8f23a9 100755 --- a/src/SUIT/SUIT_DataObject.cxx +++ b/src/SUIT/SUIT_DataObject.cxx @@ -546,6 +546,11 @@ int SUIT_DataObject::alignment( const int /*id*/ ) const return Qt::AlignLeft; } +bool SUIT_DataObject::expandable() const +{ + return true; +} + /*! \brief Check if the object is visible. diff --git a/src/SUIT/SUIT_DataObject.h b/src/SUIT/SUIT_DataObject.h index bc6ee7bbc..73792a514 100755 --- a/src/SUIT/SUIT_DataObject.h +++ b/src/SUIT/SUIT_DataObject.h @@ -113,6 +113,7 @@ public: virtual QFont font( const int = NameId ) const; virtual int alignment( const int = NameId ) const; + virtual bool expandable() 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 f4c3a999f..ed11fbad8 100755 --- a/src/SUIT/SUIT_TreeModel.cxx +++ b/src/SUIT/SUIT_TreeModel.cxx @@ -1500,10 +1500,12 @@ void SUIT_TreeModel::updateItem( SUIT_TreeModel::TreeItem* item ) return; // update all columns corresponding to the given data object + emit layoutAboutToBeChanged(); QModelIndex firstIdx = index( obj, 0 ); QModelIndex lastIdx = index( obj, columnCount() - 1 ); emit dataChanged( firstIdx, lastIdx ); obj->setModified(false); + emit layoutChanged(); } /*! @@ -1854,7 +1856,8 @@ SUIT_AbstractModel* SUIT_ProxyModel::treeModel() const bool SUIT_ProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const { SUIT_DataObject* o = treeModel()->object( sourceModel()->index( sourceRow, 0, sourceParent ) ); - return o && o->isVisible(); + SUIT_DataObject* p = o ? o->parent() : 0; + return ( !p || p->expandable() ) && o && o->isVisible(); } /*! -- 2.39.2