From: nds Date: Tue, 1 Nov 2016 07:23:38 +0000 (+0300) Subject: Debug correction for display/erase annotation in manager, update visible icon in... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fafd844adebfe868d9bbf945caa1eb656290c2ea;p=modules%2Fgeom.git Debug correction for display/erase annotation in manager, update visible icon in tree widget --- diff --git a/src/GEOMGUI/GEOMGUI_AnnotationMgr.h b/src/GEOMGUI/GEOMGUI_AnnotationMgr.h index 459b395f3..1d26e70c6 100755 --- a/src/GEOMGUI/GEOMGUI_AnnotationMgr.h +++ b/src/GEOMGUI/GEOMGUI_AnnotationMgr.h @@ -54,8 +54,8 @@ public: void Display( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 ); void Erase( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 ); - void DisplayVisibleAnnotations( const QString& theEntry, SALOME_View* theView ); - void EraseVisibleAnnotations( const QString& theEntry, SALOME_View* theView ); + void DisplayVisibleAnnotations( const QString& theEntry, SALOME_View* theView = 0 ); + void EraseVisibleAnnotations( const QString& theEntry, SALOME_View* theView = 0 ); void RemoveView( SALOME_View* theView); diff --git a/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx b/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx index 4eb3457d0..881e9dbb8 100644 --- a/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx +++ b/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx @@ -198,8 +198,6 @@ GEOMGUI_TextTreeWdg::GEOMGUI_TextTreeWdg( SalomeApp_Application* app ) connect( this, SIGNAL( customContextMenuRequested(const QPoint&) ), this, SLOT( showContextMenu(const QPoint&) ) ); - connect( myStudy, SIGNAL( objVisibilityChanged( QString, Qtx::VisibilityState ) ), - this, SLOT( onUpdateVisibilityColumn( QString, Qtx::VisibilityState ) ) ); connect( app->objectBrowser(), SIGNAL( updated() ), this, SLOT( updateTree() ) ); GeometryGUI* aGeomGUI = dynamic_cast( app->module( "Geometry" ) ); @@ -462,7 +460,7 @@ QTreeWidgetItem* GEOMGUI_TextTreeWdg::itemFromEntry( const BranchType& theBranch // function : onUpdateVisibilityColumn // purpose : Update visible state of icons of entry items. //================================================================================= -void GEOMGUI_TextTreeWdg::onUpdateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState ) +void GEOMGUI_TextTreeWdg::updateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState ) { // dimension property branch updateVisibilityColumn( DimensionShape, theEntry, theState ); diff --git a/src/GEOMGUI/GEOMGUI_TextTreeWdg.h b/src/GEOMGUI/GEOMGUI_TextTreeWdg.h index 1eb3aa7e3..abbb99b6c 100644 --- a/src/GEOMGUI/GEOMGUI_TextTreeWdg.h +++ b/src/GEOMGUI/GEOMGUI_TextTreeWdg.h @@ -67,6 +67,7 @@ public: QTreeWidgetItem* theWidgetItem, const bool theVisibility ); void updateVisibility( SALOME_View* theView ); + void updateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState ); protected: void createActions(); @@ -80,7 +81,6 @@ public slots: private slots: void onItemClicked(QTreeWidgetItem*, int ); - void onUpdateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState ); void setVisibility( QTreeWidgetItem* theItem, bool visibility ); void showContextMenu( const QPoint& pos ); diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 2727281fc..1e7d72690 100755 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -2159,12 +2159,6 @@ void GEOM_Displayer::BeforeDisplay( SALOME_View* v, const SALOME_OCCPrs* ) void GEOM_Displayer::AfterDisplay( SALOME_View* v, const SALOME_OCCPrs* p ) { UpdateColorScale(false,false); - // visualize annotations for displayed presentation - SUIT_Session* session = SUIT_Session::session(); - SalomeApp_Application* anApp = dynamic_cast( session->activeApplication() ); - GeometryGUI* aModule = dynamic_cast( anApp->activeModule() ); - if ( aModule ) - aModule->GetAnnotationMgr()->DisplayVisibleAnnotations(QString(p->GetEntry()), v); } void GEOM_Displayer::BeforeErase( SALOME_View* v, const SALOME_OCCPrs* p ) @@ -2177,13 +2171,6 @@ void GEOM_Displayer::AfterErase( SALOME_View* v, const SALOME_OCCPrs* p ) { LightApp_Displayer::AfterErase( v, p ); UpdateColorScale(false,false); - - // hide annotations for erased presentation - //SUIT_Session* session = SUIT_Session::session(); - //SalomeApp_Application* anApp = dynamic_cast( session->activeApplication() ); - //GeometryGUI* aModule = dynamic_cast( anApp->activeModule() ); - //if ( aModule ) - // aModule->GetAnnotationMgr()->EraseVisibleAnnotations(QString(p->GetEntry()), v); } //================================================================= diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index a1f8677dd..e9d676bd0 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -1828,6 +1828,11 @@ bool GeometryGUI::activateModule( SUIT_Study* study ) connect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) ); + SalomeApp_Study* appStudy = dynamic_cast( application()->activeStudy() ); + if ( appStudy ) + connect( appStudy, SIGNAL( objVisibilityChanged( QString, Qtx::VisibilityState ) ), + this, SLOT( onUpdateVisibilityColumn( QString, Qtx::VisibilityState ) ) ); + // Reset actions accelerator keys action(GEOMOp::OpDelete)->setEnabled( true ); // Delete: Key_Delete @@ -1880,7 +1885,6 @@ bool GeometryGUI::activateModule( SUIT_Study* study ) // 0020836 (Basic vectors and origin) SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); if ( aResourceMgr->booleanValue( "Geometry", "auto_create_base_objects", false ) ) { - SalomeApp_Study* appStudy = dynamic_cast( application()->activeStudy() ); if ( appStudy ) { _PTR(Study) studyDS = appStudy->studyDS(); if ( studyDS ) { @@ -1910,6 +1914,10 @@ bool GeometryGUI::deactivateModule( SUIT_Study* study ) disconnect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) ); + SalomeApp_Study* appStudy = dynamic_cast( application()->activeStudy() ); + if ( appStudy ) + disconnect( appStudy, SIGNAL( objVisibilityChanged( QString, Qtx::VisibilityState ) ), + this, SLOT( onUpdateVisibilityColumn( QString, Qtx::VisibilityState ) ) ); LightApp_SelectionMgr* selMrg = getApp()->selectionMgr(); @@ -1980,6 +1988,18 @@ void GeometryGUI::onWindowActivated( SUIT_ViewWindow* win ) } } +void GeometryGUI::onUpdateVisibilityColumn( QString theEntry, + Qtx::VisibilityState theState ) +{ + if ( myTextTreeWdg ) + myTextTreeWdg->updateVisibilityColumn( theEntry, theState ); + + if ( theState == Qtx::ShownState ) + GetAnnotationMgr()->DisplayVisibleAnnotations( theEntry ); + else + GetAnnotationMgr()->EraseVisibleAnnotations( theEntry ); +} + void GeometryGUI::windows( QMap& mappa ) const { mappa.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea ); diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index b736f666b..f334ba3b9 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -36,6 +36,7 @@ #include #include #include +#include #include "GEOMGUI.h" #include "GEOMPluginGUI.h" @@ -170,6 +171,9 @@ protected slots: private slots: void OnGUIEvent(); void onWindowActivated( SUIT_ViewWindow* ); + void onUpdateVisibilityColumn( QString theEntry, + Qtx::VisibilityState theState ); + void onViewAboutToShow(); void OnSetMaterial( const QString& ); void updateMaterials();