From 01d3c8017f5ce988f80f6ce322b1aea172ff5769 Mon Sep 17 00:00:00 2001 From: asl Date: Tue, 20 Dec 2005 07:26:34 +0000 Subject: [PATCH] PAL10670 - it is necessary to increase speed of selection and popup construction of big number of objects --- src/LightApp/LightApp_Application.cxx | 6 +- src/LightApp/LightApp_DataObject.cxx | 38 ++-- src/LightApp/LightApp_DataObject.h | 3 + src/LightApp/LightApp_OBSelector.cxx | 34 ++-- src/LightApp/LightApp_OBSelector.h | 2 + src/LightApp/LightApp_Selection.cxx | 14 +- src/LightApp/LightApp_Selection.h | 6 +- src/Qtx/QtxPopupMgr.cxx | 249 ++++++++++++++++++++----- src/Qtx/QtxPopupMgr.h | 16 +- src/SUIT/SUIT_DataOwner.cxx | 38 ++-- src/SUIT/SUIT_DataOwner.h | 7 +- src/SUIT/SUIT_SelectionMgr.cxx | 8 +- src/SalomeApp/SalomeApp_DataObject.cxx | 67 ++++--- src/SalomeApp/SalomeApp_DataObject.h | 2 + 14 files changed, 355 insertions(+), 135 deletions(-) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 9270ece69..475b2763b 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -972,8 +972,8 @@ void LightApp_Application::setWindowShown( const int type, const bool on ) OB_Browser* LightApp_Application::objectBrowser() { OB_Browser* ob = 0; - QWidget* wid = getWindow( WT_ObjectBrowser ); - if ( wid->inherits( "OB_Browser" ) ) + QWidget* wid = window( WT_ObjectBrowser ); + if ( wid && wid->inherits( "OB_Browser" ) ) ob = (OB_Browser*)wid; return ob; } @@ -1140,6 +1140,7 @@ void LightApp_Application::onStudyCreated( SUIT_Study* theStudy ) aRoot = theStudy->root(); //aRoot->setName( tr( "DATA_MODELS" ) ); } + getWindow( WT_ObjectBrowser ); if ( objectBrowser() != 0 ) objectBrowser()->setRootObject( aRoot ); @@ -1157,6 +1158,7 @@ void LightApp_Application::onStudyOpened( SUIT_Study* theStudy ) aRoot = theStudy->root(); //aRoot->dump(); } + getWindow( WT_ObjectBrowser ); if ( objectBrowser() != 0 ) { objectBrowser()->setRootObject( aRoot ); } diff --git a/src/LightApp/LightApp_DataObject.cxx b/src/LightApp/LightApp_DataObject.cxx index 6b1c80f8d..831385908 100644 --- a/src/LightApp/LightApp_DataObject.cxx +++ b/src/LightApp/LightApp_DataObject.cxx @@ -79,7 +79,7 @@ bool LightApp_DataObject::Key::isEqual( const SUIT_DataObjectKey* other ) const */ /*!Constructor. Initialize by \a parent*/ LightApp_DataObject::LightApp_DataObject( SUIT_DataObject* parent ) -: CAM_DataObject( parent ) +: CAM_DataObject( parent ), myCompObject( 0 ), myCompDataType( "" ) { } @@ -108,30 +108,38 @@ SUIT_DataObjectKey* LightApp_DataObject::key() const */ SUIT_DataObject* LightApp_DataObject::componentObject() const { + if ( !myCompObject ) { SUIT_DataObject* compObj = 0; // for root object - if ( parent() && parent() == root() ) - compObj = (SUIT_DataObject*)this; // for component-level objects - else - { - compObj = parent(); // for lower level objects - while ( compObj && compObj->parent() != root() ) - compObj = compObj->parent(); + if ( parent() && parent() == root() ) + compObj = (SUIT_DataObject*)this; // for component-level objects + else + { + compObj = parent(); // for lower level objects + while ( compObj && compObj->parent() != root() ) + compObj = compObj->parent(); + } + LightApp_DataObject* that = (LightApp_DataObject*)this; + that->myCompObject = compObj; } - return compObj; + return myCompObject; } /*!Get component type.*/ QString LightApp_DataObject::componentDataType() const { + if ( myCompDataType.isEmpty() ) { SUIT_DataObject* aCompObj = componentObject(); - LightApp_ModuleObject* anObj = dynamic_cast( aCompObj ); - if ( anObj ) { - CAM_DataModel* aModel = anObj->dataModel(); - if ( aModel ) - return aModel->module()->name(); + LightApp_ModuleObject* anObj = dynamic_cast( aCompObj ); + if ( anObj ) { + CAM_DataModel* aModel = anObj->dataModel(); + if ( aModel ) { + LightApp_DataObject* that = (LightApp_DataObject*)this; + that->myCompDataType = aModel->module()->name(); + } + } } - return ""; + return myCompDataType; } /* diff --git a/src/LightApp/LightApp_DataObject.h b/src/LightApp/LightApp_DataObject.h index 1e8aa302e..1f194ffc2 100644 --- a/src/LightApp/LightApp_DataObject.h +++ b/src/LightApp/LightApp_DataObject.h @@ -46,6 +46,9 @@ public: virtual SUIT_DataObject* componentObject() const; virtual QString componentDataType() const; +protected: + QString myCompDataType; + SUIT_DataObject* myCompObject; }; /*! diff --git a/src/LightApp/LightApp_OBSelector.cxx b/src/LightApp/LightApp_OBSelector.cxx index e7f5a4d09..537f270bb 100644 --- a/src/LightApp/LightApp_OBSelector.cxx +++ b/src/LightApp/LightApp_OBSelector.cxx @@ -24,6 +24,7 @@ #include #include +#include /*! Constructor @@ -57,22 +58,25 @@ OB_Browser* LightApp_OBSelector::browser() const */ void LightApp_OBSelector::getSelection( SUIT_DataOwnerPtrList& theList ) const { - if ( !myBrowser ) - return; - - DataObjectList objlist; - myBrowser->getSelected( objlist ); - for ( DataObjectListIterator it( objlist ); it.current(); ++it ) - { - LightApp_DataObject* obj = dynamic_cast( it.current() ); - if ( obj ) + if (mySelectedList.count() == 0 ) { + if ( !myBrowser ) + return; + DataObjectList objlist; + myBrowser->getSelected( objlist ); + LightApp_OBSelector* that = (LightApp_OBSelector*)this; + for ( DataObjectListIterator it( objlist ); it.current(); ++it ) { - Handle( SALOME_InteractiveObject ) aSObj = new SALOME_InteractiveObject - ( obj->entry(), obj->componentDataType(), obj->name() ); - LightApp_DataOwner* owner = new LightApp_DataOwner( aSObj ); - theList.append( SUIT_DataOwnerPtr( owner ) ); + LightApp_DataObject* obj = dynamic_cast( it.current() ); + if ( obj ) + { + Handle(SALOME_InteractiveObject) aSObj = new SALOME_InteractiveObject + ( obj->entry(), obj->componentDataType(), obj->name() ); + LightApp_DataOwner* owner = new LightApp_DataOwner( aSObj ); + that->mySelectedList.append( SUIT_DataOwnerPtr( owner ) ); + } } } + theList = mySelectedList; } /*!Sets selection.*/ @@ -98,7 +102,11 @@ void LightApp_OBSelector::setSelection( const SUIT_DataOwnerPtrList& theList ) /*!On selection changed.*/ void LightApp_OBSelector::onSelectionChanged() { + QTime t1 = QTime::currentTime(); + mySelectedList.clear(); selectionChanged(); + QTime t2 = QTime::currentTime(); + qDebug( QString( "selection time = %1 msecs" ).arg( t1.msecsTo( t2 ) ) ); } /*!Fill entries.*/ diff --git a/src/LightApp/LightApp_OBSelector.h b/src/LightApp/LightApp_OBSelector.h index e4bc2c883..3669610ff 100644 --- a/src/LightApp/LightApp_OBSelector.h +++ b/src/LightApp/LightApp_OBSelector.h @@ -22,6 +22,7 @@ #include "LightApp.h" #include +#include class OB_Browser; class LightApp_DataObject; @@ -51,6 +52,7 @@ private: private: OB_Browser* myBrowser; + SUIT_DataOwnerPtrList mySelectedList; }; #endif diff --git a/src/LightApp/LightApp_Selection.cxx b/src/LightApp/LightApp_Selection.cxx index 2416983dd..bca35cfec 100644 --- a/src/LightApp/LightApp_Selection.cxx +++ b/src/LightApp/LightApp_Selection.cxx @@ -65,6 +65,8 @@ void LightApp_Selection::init( const QString& client, LightApp_SelectionMgr* mgr QPtrList aSelectors; mgr->selectors( aSelectors ); for( SUIT_Selector* selector = aSelectors.first(); selector; selector = aSelectors.next() ) + { + qDebug( selector->type() ); if( selector->type()!=client ) { mgr->selected( cur_sel, selector->type() ); @@ -72,19 +74,27 @@ void LightApp_Selection::init( const QString& client, LightApp_SelectionMgr* mgr for( ; aLIt!=aLLast; aLIt++ ) sel.append( *aLIt ); //check entry and don't append if such entry is in list already } + } //3) to analyse owner and fill internal data structures SUIT_DataOwnerPtrList::const_iterator anIt = sel.begin(), aLast = sel.end(); + QMap entries; QString entry; + int num=0; for( ; anIt!=aLast; anIt++ ) { LightApp_DataOwner* sowner = dynamic_cast( (*anIt ).get() ); if( sowner ) { + if( entries.contains( sowner->entry() ) ) + continue; + entry = myStudy->referencedToEntry( sowner->entry() ); - myEntries.append( entry ); - myIsReferences.append( sowner->entry() == entry ); + entries.insert( entry, 0 ); + myEntries.insert( num, entry ); + myIsReferences.insert( num, sowner->entry() == entry ); processOwner( sowner ); + num++; } } } diff --git a/src/LightApp/LightApp_Selection.h b/src/LightApp/LightApp_Selection.h index fc92b8ca5..79cc0fac6 100644 --- a/src/LightApp/LightApp_Selection.h +++ b/src/LightApp/LightApp_Selection.h @@ -60,10 +60,10 @@ protected: QString activeViewType() const; SUIT_ViewWindow* activeVW() const; -protected: +private: QString myPopupClient; - QStringList myEntries; // entries of selected objects - QValueList myIsReferences; // whether i-th selected object was a reference + QMap myEntries; // entries of selected objects + QMap myIsReferences; // whether i-th selected object was a reference LightApp_Study* myStudy; }; diff --git a/src/Qtx/QtxPopupMgr.cxx b/src/Qtx/QtxPopupMgr.cxx index 5b1074312..f01716c16 100644 --- a/src/Qtx/QtxPopupMgr.cxx +++ b/src/Qtx/QtxPopupMgr.cxx @@ -23,6 +23,7 @@ #include "QtxAction.h" #include +#include //================================================================ // Function : @@ -92,6 +93,97 @@ QString QtxPopupMgr::Selection::defSelCountParam() + +//================================================================ +// Class : +// Purpose : +//================================================================ +class QtxCacheSelection : public QtxPopupMgr::Selection +{ +public: + QtxCacheSelection( QtxPopupMgr::Selection* ); + virtual ~QtxCacheSelection(); + + virtual int count() const; + virtual QtxValue param( const int, const QString& ) const; + virtual QtxValue globalParam( const QString& ) const; + +private: + typedef QMap< QString, QtxValue > CacheMap; + + QtxPopupMgr::Selection* mySel; + CacheMap myParamCache; +}; + +//================================================================ +// Function : +// Purpose : +//================================================================ +QtxCacheSelection::QtxCacheSelection( QtxPopupMgr::Selection* sel ) +: mySel( sel ) +{ +} + +//================================================================ +// Function : +// Purpose : +//================================================================ +QtxCacheSelection::~QtxCacheSelection() +{ +} + +//================================================================ +// Function : +// Purpose : +//================================================================ +int QtxCacheSelection::count() const +{ + return mySel ? mySel->count() : 0; +} + +//================================================================ +// Function : +// Purpose : +//================================================================ +QtxValue QtxCacheSelection::param( const int i, const QString& name ) const +{ + QString param_name = name + "#####" + QString::number( i ); + if( myParamCache.contains( param_name ) ) + return myParamCache[ param_name ]; + else + { + QtxValue v; + if( mySel ) + v = mySel->param( i, name ); + if( v.isValid() ) + ( ( CacheMap& )myParamCache ).insert( param_name, v ); + return v; + } +} + +//================================================================ +// Function : +// Purpose : +//================================================================ +QtxValue QtxCacheSelection::globalParam( const QString& name ) const +{ + if( myParamCache.contains( name ) ) + return myParamCache[ name ]; + else + { + QtxValue v; + if( mySel ) + v = mySel->globalParam( name ); + if( v.isValid() ) + ( ( CacheMap& )myParamCache ).insert( name, v ); + return v; + } +} + + + + + //================================================================ // Function : // Purpose : @@ -381,50 +473,111 @@ void QtxPopupMgr::setParams( QtxParser* p, QStringList& specific ) const } } +bool operator<( const QtxValue& v1, const QtxValue& v2 ) +{ + QVariant::Type t1 = v1.type(), t2 = v2.type(); + if( t1==t2 ) + { + switch( t1 ) + { + case QVariant::Int: + return v1.toInt() < v2.toInt(); + + case QVariant::Double: + return v1.toDouble() < v2.toDouble(); + + case QVariant::CString: + case QVariant::String: + return v1.toString() < v2.toString(); + + case QVariant::StringList: + case QVariant::List: + { + const QValueList& aList1 = v1.toList(), aList2 = v2.toList(); + QValueList::const_iterator + anIt1 = aList1.begin(), aLast1 = aList1.end(), + anIt2 = aList2.begin(), aLast2 = aList2.end(); + for( ; anIt1!=aLast1 && anIt2!=aLast2; anIt1++, anIt2++ ) + if( (*anIt1)!=(*anIt2) ) + return (*anIt1)<(*anIt2); + + return anIt1==aLast1 && anIt2!=aLast2; + } + + default: + return v1.toString()menuText(); - //const char* mmm = menu.latin1(); + QString menu = act->menuText(); - bool res = false; - if( !act ) - return res; - - if( hasRule( act, visibility ) ) - { - QtxParser* p = map( visibility )[ act ]; - //QString pdump = p->dump(); - //const char* pdd = pdump.latin1(); - - - QStringList specific; - p->clear(); - ( ( Operations* )myOperations->operations( "custom" ) )->clear(); - - setParams( p, specific ); - - if( specific.count()>0 ) - if( myCurrentSelection ) - for( int i=0, n=myCurrentSelection->count(); iset( *anIt1, myCurrentSelection->param( i, *anIt1 ) ); + bool res = false; + if( !act ) + return res; - res = res || result( p ); - } - else - res = false; - else - res = result( p ); - } + if( hasRule( act, visibility ) ) + { + QtxParser* p = map( visibility )[ act ]; + QStringList specific; + p->clear(); + ( ( Operations* )myOperations->operations( "custom" ) )->clear(); + + setParams( p, specific ); + + QMap,int> aCorteges; + QValueList c; + + if( specific.count()>0 ) + if( myCurrentSelection ) + { + res = false; + + for( int i=0, n=myCurrentSelection->count(); iparam( i, *anIt1 ) ); + aCorteges.insert( c, 0 ); + } + + //qDebug( QString( "%1 corteges" ).arg( aCorteges.count() ) ); + QMap,int>::const_iterator anIt = aCorteges.begin(), aLast = aCorteges.end(); + for( ; anIt!=aLast; anIt++ ) + { + QStringList::const_iterator anIt1 = specific.begin(), aLast1 = specific.end(); + const QValueList& aCortege = anIt.key(); + QValueList::const_iterator anIt2 = aCortege.begin(); + for( ; anIt1!=aLast1; anIt1++, anIt2++ ) + p->set( *anIt1, *anIt2 ); + res = res || result( p ); + } + + /* + for( int i=0, n=myCurrentSelection->count(); iset( *anIt1, myCurrentSelection->param( i, *anIt1 ) ); + res = res || result( p ); + }*/ + } + else + res = false; + else + res = result( p ); + } - return res; + return res; } //================================================================ @@ -446,19 +599,25 @@ bool QtxPopupMgr::isVisible( const int actId, const int place ) const //================================================================ void QtxPopupMgr::updatePopup( QPopupMenu* p, Selection* sel ) { - if( !p || !sel ) - return; + QTime t1 = QTime::currentTime(); - myCurrentSelection = sel; + if( !p || !sel ) + return; - RulesMap::iterator anIt = myToggle.begin(), - aLast = myToggle.end(); - for( ; anIt!=aLast; anIt++ ) - if( anIt.key()->isToggleAction() && hasRule( anIt.key(), false ) ) - anIt.key()->setOn( isSatisfied( anIt.key(), false ) ); + myCurrentSelection = new QtxCacheSelection( sel ); + RulesMap::iterator anIt = myToggle.begin(), + aLast = myToggle.end(); + for( ; anIt!=aLast; anIt++ ) + if( anIt.key()->isToggleAction() && hasRule( anIt.key(), false ) ) + anIt.key()->setOn( isSatisfied( anIt.key(), false ) ); + + setWidget( ( QWidget* )p ); + updateMenu(); + QTime t2 = QTime::currentTime(); + qDebug( QString( "update popup time = %1 msecs" ).arg( t1.msecsTo( t2 ) ) ); + qDebug( QString( "number of objects = %1" ).arg( myCurrentSelection->count() ) ); - setWidget( ( QWidget* )p ); - updateMenu(); + delete myCurrentSelection; } //================================================================ diff --git a/src/Qtx/QtxPopupMgr.h b/src/Qtx/QtxPopupMgr.h index d581bf3a1..a75a7dced 100644 --- a/src/Qtx/QtxPopupMgr.h +++ b/src/Qtx/QtxPopupMgr.h @@ -43,13 +43,13 @@ public: public: virtual int count() const = 0; virtual QtxValue param( const int, const QString& ) const = 0; - virtual QtxValue globalParam( const QString& ) const; + virtual QtxValue globalParam( const QString& ) const; - virtual QChar equality() const; - virtual QString selCountParam() const; + virtual QChar equality() const; + virtual QString selCountParam() const; - static QChar defEquality(); - static QString defSelCountParam(); + static QChar defEquality(); + static QString defSelCountParam(); }; protected: @@ -109,9 +109,9 @@ protected: void createOperations(); private: - RulesMap myVisibility, myToggle; - Selection* myCurrentSelection; - QtxListOfOperations* myOperations; + RulesMap myVisibility, myToggle; + Selection* myCurrentSelection; + QtxListOfOperations* myOperations; }; diff --git a/src/SUIT/SUIT_DataOwner.cxx b/src/SUIT/SUIT_DataOwner.cxx index b1c9e8bba..f21bbd416 100755 --- a/src/SUIT/SUIT_DataOwner.cxx +++ b/src/SUIT/SUIT_DataOwner.cxx @@ -132,17 +132,33 @@ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list //==================================================================== SUIT_DataOwnerPtrList::iterator SUIT_DataOwnerPtrList::append( const SUIT_DataOwnerPtr& x ) { - SUIT_DataOwnerPtrList::iterator it = find( x ); - if ( it != end() ) - { - if ( mySkipEqual ) - return it; + if( mySkipEqual && myMap.contains( x ) ) //contains uses SUIT_DataOwnerPtr::operator== + return myMap[ x ]; - const _typeinfo& ti1 = typeid( *((*it).operator->()) ); - const _typeinfo& ti2 = typeid( *(x.operator->()) ); + iterator it = QValueList::append( x ); - if (ti1 == ti2) - return it; - } - return QValueList::append( x ); + if( mySkipEqual ) + myMap.insert( x, it ); + + return it; +} + +//==================================================================== +//! Clear list +//==================================================================== +void SUIT_DataOwnerPtrList::clear() +{ + if( mySkipEqual ) + myMap.clear(); + QValueList::clear(); +} + +//==================================================================== +//! Remove an item from the list +//==================================================================== +uint SUIT_DataOwnerPtrList::remove(const SUIT_DataOwnerPtr& x ) +{ + if( mySkipEqual && myMap.contains(x) ) + myMap.remove(x); + return QValueList::remove( x ); } diff --git a/src/SUIT/SUIT_DataOwner.h b/src/SUIT/SUIT_DataOwner.h index 4e4c5ecfd..8f8caadff 100755 --- a/src/SUIT/SUIT_DataOwner.h +++ b/src/SUIT/SUIT_DataOwner.h @@ -22,6 +22,7 @@ #include "SUIT_SmartPtr.h" #include +#include #ifdef WIN32 #pragma warning( disable:4275 ) @@ -64,6 +65,8 @@ public: #endif iterator append ( const SUIT_DataOwnerPtr& x );//!< append function + void clear (); + uint remove (const SUIT_DataOwnerPtr& x ); private: // hide this methods: only append() should be used to add items to the list @@ -71,8 +74,10 @@ private: iterator insert ( iterator it, const SUIT_DataOwnerPtr& x );//!< hide method void push_front ( const SUIT_DataOwnerPtr& x );//!< hide method void push_back ( const SUIT_DataOwnerPtr& x );//!< hide method + private: - bool mySkipEqual; + bool mySkipEqual; + QMap myMap; }; #ifdef WIN32 diff --git a/src/SUIT/SUIT_SelectionMgr.cxx b/src/SUIT/SUIT_SelectionMgr.cxx index edd1ee591..640ee62ab 100755 --- a/src/SUIT/SUIT_SelectionMgr.cxx +++ b/src/SUIT/SUIT_SelectionMgr.cxx @@ -85,7 +85,6 @@ void SUIT_SelectionMgr::selected( SUIT_DataOwnerPtrList& lst, const QString& typ { lst.clear(); - QMap map; for ( SelectorListIterator it( mySelectors ); it.current(); ++it ) { if ( !type.isEmpty() && it.current()->type() != type ) @@ -93,12 +92,7 @@ void SUIT_SelectionMgr::selected( SUIT_DataOwnerPtrList& lst, const QString& typ SUIT_DataOwnerPtrList curList; it.current()->selected( curList ); for ( SUIT_DataOwnerPtrList::const_iterator itr = curList.begin(); itr != curList.end(); ++itr ) - { - const SUIT_DataOwnerPtr& ptr = *itr; - if ( !map.contains( ptr.operator->() ) ) - lst.append( ptr ); - map.insert( ptr.operator->(), 0 ); - } + lst.append( *itr ); } } diff --git a/src/SalomeApp/SalomeApp_DataObject.cxx b/src/SalomeApp/SalomeApp_DataObject.cxx index e8f32dea9..938754e92 100644 --- a/src/SalomeApp/SalomeApp_DataObject.cxx +++ b/src/SalomeApp/SalomeApp_DataObject.cxx @@ -40,16 +40,20 @@ /*!Constructor. Initialize by \a parent*/ SalomeApp_DataObject::SalomeApp_DataObject( SUIT_DataObject* parent ) : LightApp_DataObject( parent ), - CAM_DataObject( parent ) + CAM_DataObject( parent ), + myEntry( "" ), + myName( "" ) { } /*!Constructor. Initialize by \a parent and SObject*/ SalomeApp_DataObject::SalomeApp_DataObject( const _PTR(SObject)& sobj, SUIT_DataObject* parent ) : LightApp_DataObject( parent ), - CAM_DataObject( parent ) + CAM_DataObject( parent ), + myName( "" ) { myObject = sobj; + myEntry = myObject->GetID().c_str(); } /*!Destructor. Do nothing.*/ @@ -62,35 +66,39 @@ SalomeApp_DataObject::~SalomeApp_DataObject() */ QString SalomeApp_DataObject::entry() const { - if ( myObject ) + if ( myObject ) return myObject->GetID().c_str(); return QString::null; + //return myEntry; } /*!Gets name of object.*/ QString SalomeApp_DataObject::name() const { - QString str; - - if ( myObject ) - str = myObject->GetName().c_str(); - - if ( str.isEmpty() ) + //if ( myName.isEmpty() ) { - _PTR(SObject) refObj = referencedObject(); - if ( refObj ) - str = refObj->GetName().c_str(); - } + QString str; + if ( myObject ) + str = myObject->GetName().c_str(); - if ( isReference() ) + if ( str.isEmpty() ) { - if ( !(QString(referencedObject()->GetName().c_str()).isEmpty()) ) - str = QString( "* " ) + str; - else - str = QString( "" ); + _PTR(SObject) refObj = referencedObject(); + if ( refObj ) + str = refObj->GetName().c_str(); } - return str; + if ( isReference() ) + { + if ( !(QString(referencedObject()->GetName().c_str()).isEmpty()) ) + str = QString( "* " ) + str; + else + str = QString( "" ); + } + SalomeApp_DataObject* that = (SalomeApp_DataObject*)this; + that->myName = str; + } + return myName; } /*!Gets icon picture of object.*/ @@ -199,15 +207,18 @@ QString SalomeApp_DataObject::toolTip() const /*!Get component type.*/ QString SalomeApp_DataObject::componentDataType() const { - const SalomeApp_DataObject* compObj = dynamic_cast( componentObject() ); - if ( compObj && compObj->object() ) - { - _PTR(SComponent) aComp( compObj->object() ); - if ( aComp ) - return aComp->ComponentDataType().c_str(); - } - - return ""; + // if ( myCompDataType.isEmpty() ) { + const SalomeApp_DataObject* compObj = dynamic_cast( componentObject() ); + if ( compObj && compObj->object() ) + { + _PTR(SComponent) aComp( compObj->object() ); + if ( aComp ) { + SalomeApp_DataObject* that = (SalomeApp_DataObject*)this; + that->myCompDataType = aComp->ComponentDataType().c_str(); + } + } + // } + return myCompDataType; } /*!Gets object.*/ diff --git a/src/SalomeApp/SalomeApp_DataObject.h b/src/SalomeApp/SalomeApp_DataObject.h index cc4f1ce0f..15a1d96bf 100644 --- a/src/SalomeApp/SalomeApp_DataObject.h +++ b/src/SalomeApp/SalomeApp_DataObject.h @@ -64,6 +64,8 @@ private: private: _PTR(SObject) myObject; + QString myEntry; + QString myName; }; /*! -- 2.39.2