From 41541efd8140fbc1195a915db59f20e87a2e3bc6 Mon Sep 17 00:00:00 2001 From: asl Date: Tue, 26 May 2015 10:38:28 +0300 Subject: [PATCH] refs #551: incorrect visible status --- src/HYDROGUI/HYDROGUI_DataModel.cxx | 7 ++++++- src/HYDROGUI/HYDROGUI_Module.cxx | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/HYDROGUI/HYDROGUI_DataModel.cxx b/src/HYDROGUI/HYDROGUI_DataModel.cxx index 9b9863db..44c63cd2 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.cxx +++ b/src/HYDROGUI/HYDROGUI_DataModel.cxx @@ -705,7 +705,12 @@ LightApp_DataObject* HYDROGUI_DataModel::createObject( SUIT_DataObject* treeModel = dynamic_cast( app->objectBrowser()->model() ); if ( treeModel ) - treeModel->setVisibilityState( aResObj->text( aResObj->customData( Qtx::IdType ).toInt() ), Qtx::HiddenState, false ); + { + HYDROGUI_Module* aModule = dynamic_cast( module() ); + bool isVisible = aModule->isObjectVisible( -1, theModelObject ); + Qtx::VisibilityState aVisState = isVisible ? Qtx::ShownState : Qtx::HiddenState; + treeModel->setVisibilityState( aResObj->text( aResObj->customData( Qtx::IdType ).toInt() ), aVisState, false ); + } } if ( theIsBuildTree ) diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 283f361e..95d4a590 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -951,6 +951,17 @@ bool HYDROGUI_Module::isObjectVisible( const int theViewId, if( theObject.IsNull() ) return false; + if( theViewId < 0 ) + { + //search in all + foreach( int aViewId, myObjectStateMap.keys() ) + { + if( isObjectVisible( aViewId, theObject ) ) + return true; + } + return false; + } + ViewId2Entry2ObjectStateMap::const_iterator anIter1 = myObjectStateMap.find( theViewId ); if( anIter1 != myObjectStateMap.end() ) { -- 2.39.2