From: mzn Date: Tue, 23 Dec 2008 11:01:29 +0000 (+0000) Subject: Fix for improvement 0017606 (EDF 168: Is it possible to customize the tooltip of... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FBR_V5_IMP_P8;p=modules%2Fgui.git Fix for improvement 0017606 (EDF 168: Is it possible to customize the tooltip of the objects in the browser?); --- diff --git a/src/SalomeApp/SalomeApp_DataObject.cxx b/src/SalomeApp/SalomeApp_DataObject.cxx index 8a2af3bda..5e8c044dc 100644 --- a/src/SalomeApp/SalomeApp_DataObject.cxx +++ b/src/SalomeApp/SalomeApp_DataObject.cxx @@ -21,14 +21,17 @@ // #include "SalomeApp_DataObject.h" - #include "SalomeApp_Study.h" +#include "SalomeApp_Application.h" #include +#include #include #include +#include + #include #include @@ -249,6 +252,26 @@ QString SalomeApp_DataObject::toolTip( const int /*id*/ ) const { // we ignore parameter in order to use the same tooltip for // all columns + + // Get customized tooltip in case of it exists + const SalomeApp_DataObject* compObj = dynamic_cast( 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( 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( 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() ); }