From 29dc9afe35d7bc1896af7d6d2576166ab2e2592f Mon Sep 17 00:00:00 2001 From: mzn Date: Tue, 23 Dec 2008 11:01:29 +0000 Subject: [PATCH] Fix for improvement 0017606 (EDF 168: Is it possible to customize the tooltip of the objects in the browser?); --- src/SalomeApp/SalomeApp_DataObject.cxx | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) 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() ); } -- 2.39.2