From f1e7606b49d947fec810d4f0b7f657345ac22ea0 Mon Sep 17 00:00:00 2001 From: ouv Date: Tue, 22 Nov 2005 07:13:12 +0000 Subject: [PATCH] Fixed bug GVIEW10550 : picking feedback too slow --- src/ObjBrowser/OB_Browser.cxx | 13 +++++++++++++ src/ObjBrowser/OB_Browser.h | 5 +++++ src/SalomeApp/SalomeApp_OBSelector.cxx | 19 +++++++++++++++---- src/SalomeApp/SalomeApp_OBSelector.h | 7 +++++++ 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/ObjBrowser/OB_Browser.cxx b/src/ObjBrowser/OB_Browser.cxx index a660a57d7..dc4cf1996 100755 --- a/src/ObjBrowser/OB_Browser.cxx +++ b/src/ObjBrowser/OB_Browser.cxx @@ -95,6 +95,8 @@ myRootDecorated( true ) connect( myView, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); setRootObject( root ); + + setModified(); } OB_Browser::~OB_Browser() @@ -199,6 +201,8 @@ void OB_Browser::setRootObject( SUIT_DataObject* theRoot ) autoOpenBranches(); + setModified(); + if ( selNum != numberOfSelected() ) emit selectionChanged(); } @@ -506,6 +510,8 @@ void OB_Browser::updateTree( SUIT_DataObject* obj ) autoOpenBranches(); + setModified(); + if ( selNum != numberOfSelected() ) emit selectionChanged(); } @@ -544,6 +550,8 @@ void OB_Browser::replaceTree( SUIT_DataObject* src, SUIT_DataObject* trg ) autoOpenBranches(); + setModified(); + if ( selNum != numberOfSelected() ) emit selectionChanged(); } @@ -1089,3 +1097,8 @@ void OB_Browser::openBranch( QListViewItem* item, const int level ) item = item->nextSibling(); } } + +void OB_Browser::setModified() +{ + myModifiedTime = clock(); +} diff --git a/src/ObjBrowser/OB_Browser.h b/src/ObjBrowser/OB_Browser.h index 944a8ccf3..9788f244f 100755 --- a/src/ObjBrowser/OB_Browser.h +++ b/src/ObjBrowser/OB_Browser.h @@ -99,6 +99,9 @@ public: virtual void contextMenuPopup( QPopupMenu* ); + void setModified(); + unsigned long getModifiedTime() { return myModifiedTime; } + signals: void selectionChanged(); void dropped( DataObjectList, SUIT_DataObject*, int ); @@ -163,6 +166,8 @@ private: int myAutoOpenLevel; friend class OB_Browser::ToolTip; + + unsigned long myModifiedTime; }; #endif diff --git a/src/SalomeApp/SalomeApp_OBSelector.cxx b/src/SalomeApp/SalomeApp_OBSelector.cxx index 655f80998..bb5773d4b 100644 --- a/src/SalomeApp/SalomeApp_OBSelector.cxx +++ b/src/SalomeApp/SalomeApp_OBSelector.cxx @@ -17,6 +17,8 @@ SalomeApp_OBSelector::SalomeApp_OBSelector( OB_Browser* ob, SUIT_SelectionMgr* m if ( myBrowser ) { connect( myBrowser, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) ); } + + setModified(); } /*! @@ -63,15 +65,16 @@ void SalomeApp_OBSelector::setSelection( const SUIT_DataOwnerPtrList& thelist ) if ( !myBrowser ) return; - QMap themap; - fillEntries( themap ); + if( myEntries.count() == 0 || + myModifiedTime < myBrowser->getModifiedTime() ) + fillEntries( myEntries ); DataObjectList objList; for ( SUIT_DataOwnerPtrList::const_iterator it = thelist.begin(); it != thelist.end(); ++it ) { const SalomeApp_DataOwner* owner = dynamic_cast( (*it).operator->() ); - if ( owner && themap.contains( owner->entry() ) ) - objList.append( themap[owner->entry()] ); + if ( owner && myEntries.contains( owner->entry() ) ) + objList.append( myEntries[owner->entry()] ); } myBrowser->setSelected( objList ); @@ -98,4 +101,12 @@ void SalomeApp_OBSelector::fillEntries( QMap& en if ( obj ) entires.insert( obj->entry(), obj ); } + + setModified(); +} + +/*!Update modified time.*/ +void SalomeApp_OBSelector::setModified() +{ + myModifiedTime = clock(); } diff --git a/src/SalomeApp/SalomeApp_OBSelector.h b/src/SalomeApp/SalomeApp_OBSelector.h index 312d4fef5..bd55fd26c 100644 --- a/src/SalomeApp/SalomeApp_OBSelector.h +++ b/src/SalomeApp/SalomeApp_OBSelector.h @@ -21,6 +21,9 @@ public: /*!Return "ObjectBrowser"*/ virtual QString type() const { return "ObjectBrowser"; } + void setModified(); + unsigned long getModifiedTime() { return myModifiedTime; } + private slots: void onSelectionChanged(); @@ -33,6 +36,10 @@ private: private: OB_Browser* myBrowser; + + QMap myEntries; + + unsigned long myModifiedTime; }; #endif -- 2.39.2