]> SALOME platform Git repositories - modules/gui.git/blobdiff - src/LightApp/LightApp_Displayer.cxx
Salome HOME
bos #19960: [CEA 19958] Show/Hide SHAPERSTUDY objects
[modules/gui.git] / src / LightApp / LightApp_Displayer.cxx
index a490d9c88aea278dca564de494ef5eaa5e16e9b7..fbc9200fda9be139c9f19b5e4ea6b054a1deecfb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -169,7 +169,7 @@ void LightApp_Displayer::Erase( const QStringList& list, const bool forced,
   QStringList::const_iterator it = list.constBegin();
   for ( ; it != list.constEnd(); ++it)
   {
-    SALOME_Prs* prs = vf->CreatePrs( (*it).toLatin1().data() );
+    SALOME_Prs* prs = vf->CreatePrs( (*it).toUtf8().data() );
     if ( prs ) {
       myLastEntry = *it;
       vf->BeforeErase( this, prs );
@@ -218,7 +218,7 @@ bool LightApp_Displayer::IsDisplayed( const QString& entry, SALOME_View* theView
   {
 #ifndef DISABLE_SALOMEOBJECT
     Handle( SALOME_InteractiveObject ) temp = new SALOME_InteractiveObject();
-    temp->setEntry( entry.toLatin1() );
+    temp->setEntry( entry.toUtf8() );
     res = vf->isVisible( temp );
 #endif
   }
@@ -248,7 +248,7 @@ SALOME_Prs* LightApp_Displayer::buildPresentation( const QString& entry, SALOME_
   SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
 
   if ( vf )
-    prs = vf->CreatePrs( entry.toLatin1() );
+    prs = vf->CreatePrs( entry.toUtf8() );
 
   return prs;
 }
@@ -298,33 +298,36 @@ bool LightApp_Displayer::canBeDisplayed( const QString& entry ) const
 
 /*!
   \return displayer, corresponding to module
-  \param mod_name - name of module
+  \param mod_name - name or title of module.
+  \note It is better to use name (component data type)
+        in any case when you are not sure the title is not empty.
   \param load - is module has to be forced loaded
 */
 LightApp_Displayer* LightApp_Displayer::FindDisplayer( const QString& mod_name, const bool load )
 {
+  QString mname = LightApp_Application::moduleDisplayer( mod_name );
   SUIT_Session* session = SUIT_Session::session();
   SUIT_Application* sapp = session ? session->activeApplication() : 0;
   LightApp_Application* app = dynamic_cast<LightApp_Application*>( sapp );
   if( !app )
     return 0;
 
-  LightApp_Module* m = dynamic_cast<LightApp_Module*>( app ? app->module( mod_name ) : 0 );
+  LightApp_Module* m = dynamic_cast<LightApp_Module*>( app ? app->module( mname ) : 0 );
   bool wasLoaded = false;
   if( !m && load )
   {
-    m = dynamic_cast<LightApp_Module*>( app->loadModule( mod_name, false ) );
-       if( m ) {
+    m = dynamic_cast<LightApp_Module*>( app->loadModule( mname, false ) );
+    if( m ) {
       app->addModule( m );
-         wasLoaded = true;
-       }
+      wasLoaded = true;
+    }
   }
 
   if( m )
   {
     m->connectToStudy( dynamic_cast<CAM_Study*>( app->activeStudy() ) );
-       if( wasLoaded ) 
-               m->updateModuleVisibilityState();
+    if( wasLoaded ) 
+      m->updateModuleVisibilityState();
   }
   return m ? m->displayer() : 0;
 }