]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix for improvement 0017606 (EDF 168: Is it possible to customize the tooltip of... BR_V5_IMP_P8
authormzn <mzn@opencascade.com>
Tue, 23 Dec 2008 11:01:29 +0000 (11:01 +0000)
committermzn <mzn@opencascade.com>
Tue, 23 Dec 2008 11:01:29 +0000 (11:01 +0000)
src/SalomeApp/SalomeApp_DataObject.cxx

index 8a2af3bda1d280b2f26156e89d0fe6cc42e0eb18..5e8c044dce2e90950c04329d4213fb73ada24509 100644 (file)
 //
 
 #include "SalomeApp_DataObject.h"
-
 #include "SalomeApp_Study.h"
+#include "SalomeApp_Application.h"
 
 #include <CAM_DataObject.h>
 
+#include <SUIT_Session.h>
 #include <SUIT_Application.h>
 #include <SUIT_ResourceMgr.h>
 
+#include <SALOME_LifeCycleCORBA.hxx>
+
 #include <QObject>
 #include <QVariant>
 
@@ -249,6 +252,26 @@ QString SalomeApp_DataObject::toolTip( const int /*id*/ ) const
 {
   // we ignore parameter <id> in order to use the same tooltip for 
   // all columns
+  
+  // Get customized tooltip in case of it exists
+  const SalomeApp_DataObject* compObj = dynamic_cast<SalomeApp_DataObject*>( componentObject() );
+  // Check if the component has been loaded.
+  // In order to avoid loading the component only for getting a custom tooltip.
+  if ( compObj && compObj != this && !ior(compObj->object()).isEmpty() ) {
+    SalomeApp_Application* app = 
+      dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+    if ( app ) {
+      Engines::Component_var aComponent = 
+       app->lcc()->FindOrLoad_Component( "FactoryServer", componentDataType().toLatin1().constData() );
+      
+      if ( !CORBA::is_nil(aComponent) && aComponent->hasObjectInfo() ) {
+       LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root() );
+       if ( aRoot && aRoot->study() )
+         return QString( aComponent->getObjectInfo( aRoot->study()->id(), entry().toLatin1().constData()) );
+      }
+    }
+  }
+  
   return QString( "Object \'%1\', module \'%2\', ID=%3" ).arg( name() ).arg( componentDataType() ).arg( entry() );
 }