Debug correction for display/erase annotation in manager, update visible icon in tree widget

This commit is contained in:
nds 2016-11-01 10:23:38 +03:00
parent aebbb9d494
commit fafd844ade
6 changed files with 29 additions and 20 deletions

View File

@ -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);

View File

@ -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<GeometryGUI*>( 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 );

View File

@ -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 );

View File

@ -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<SalomeApp_Application*>( session->activeApplication() );
GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( 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<SalomeApp_Application*>( session->activeApplication() );
//GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
//if ( aModule )
// aModule->GetAnnotationMgr()->EraseVisibleAnnotations(QString(p->GetEntry()), v);
}
//=================================================================

View File

@ -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<SalomeApp_Study*>( 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<SalomeApp_Study*>( 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<SalomeApp_Study*>( 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<int, int>& mappa ) const
{
mappa.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );

View File

@ -36,6 +36,7 @@
#include <GEOM_Client.hxx>
#include <SALOME_InteractiveObject.hxx>
#include <SALOMEDSClient.hxx>
#include <Qtx.h>
#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();