]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Additional fix for issue 0021055: EDF 1602 STUDY: Object browser reactualisation...
authorouv <ouv@opencascade.com>
Tue, 29 Mar 2011 10:03:58 +0000 (10:03 +0000)
committerouv <ouv@opencascade.com>
Tue, 29 Mar 2011 10:03:58 +0000 (10:03 +0000)
src/LightApp/LightApp_Application.cxx

index 4d7978a52e82d68eb3aa1e8db023fd553ae8f165..4b49152d44433329ad9d62047491e6cede6c569b 100644 (file)
@@ -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;
 }