]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fit All on visible objects
authorCHEMIN Sebastien <sc236498@is245491.intra.cea.fr>
Fri, 19 Apr 2024 07:18:20 +0000 (09:18 +0200)
committerCHEMIN Sebastien <sc236498@is245491.intra.cea.fr>
Fri, 19 Apr 2024 07:18:20 +0000 (09:18 +0200)
src/QtViewer/QtViewer_ViewPort.cxx

index 56cac94ff59e7bf3a77fdc265efa16279089b265..af62030ed3ec54bad54f735c9e77911151351762 100644 (file)
@@ -81,8 +81,14 @@ void QtViewer_ViewPort::addItem( QGraphicsItem* theItem )
 
 void QtViewer_ViewPort::fitAll()
 {
+  QRectF aRect;
+  foreach (QGraphicsItem* item, scene()->items())
+    { 
+      if (item->isVisible())
+        aRect = aRect.united(item->boundingRect());
+    }
   scene()->setSceneRect(scene()->itemsBoundingRect());
-  QRectF aRect = scene()->sceneRect();
   fitInView( aRect.adjusted(-myFitAllGap, -myFitAllGap, myFitAllGap, myFitAllGap), Qt::KeepAspectRatio);
 }