From: ouv Date: Tue, 29 Mar 2011 10:03:58 +0000 (+0000) Subject: Additional fix for issue 0021055: EDF 1602 STUDY: Object browser reactualisation... X-Git-Tag: V6_3_0a1~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=746eea05a122b7ed31591c801e92de2847add481;p=modules%2Fgui.git Additional fix for issue 0021055: EDF 1602 STUDY: Object browser reactualisation when creating an object --- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 4d7978a52..4b49152d4 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -3545,31 +3545,41 @@ QString LightApp_Application::browseObjects( const QStringList& theEntryList, if( !aModel ) return aResult; - bool anIsSelected = false; QStringListIterator anIter( theEntryList ); + if( theIsOptimizedBrowsing ) + { + // go to the last entry + anIter.toBack(); + if( anIter.hasPrevious() ) + anIter.previous(); + } + + // scroll to each entry in the list + // (in optimized mode - to the last entry only) + QString anEntry; + LightApp_DataObject* anObject; while( anIter.hasNext() ) { - QString anEntry = anIter.next(); + anEntry = anIter.next(); if( !anEntry.isEmpty() ) { - if( LightApp_DataObject* anObject = aStudy->findObjectByEntry( anEntry ) ) + anObject = aStudy->findObjectByEntry( anEntry ); + if( anObject ) { QModelIndex anIndex = aModel->index( anObject ); anOB->treeView()->scrollTo( anIndex ); - - if( !anIsSelected ) - { - SUIT_DataOwnerPtrList aList; - aList.append( new LightApp_DataOwner( anEntry ) ); - selectionMgr()->setSelected( aList ); - anIsSelected = true; // always select the first object only - aResult = anEntry; - } - - if( theIsOptimizedBrowsing ) - break; // browse only the first object in this mode } } } + + // always select the last object + if( anObject && !anEntry.isEmpty() ) + { + SUIT_DataOwnerPtrList aList; + aList.append( new LightApp_DataOwner( anEntry ) ); + selectionMgr()->setSelected( aList ); + aResult = anEntry; + } + return aResult; }