]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
refs #1417: debug of dump view
authorasl <asl@opencascade.com>
Tue, 21 Nov 2017 08:18:26 +0000 (11:18 +0300)
committerasl <asl@opencascade.com>
Tue, 21 Nov 2017 08:18:26 +0000 (11:18 +0300)
src/GraphicsView/GraphicsView_ViewPort.cxx
src/SUIT/SUIT_ViewManager.cxx

index de9a19d9e1fe38aee63adf619d0164b83af3b6ca..9cafbd7372132fe42fe837153ec083f4cfac212d 100644 (file)
@@ -462,13 +462,26 @@ QImage GraphicsView_ViewPort::dumpView( bool theWholeScene,
 bool GraphicsView_ViewPort::dumpViewToPSFormat(const QString& fileName)
 {
   QPrinter printer(QPrinter::HighResolution);
+  printer.setOutputFormat(QPrinter::PostScriptFormat);
   printer.setOutputFileName(fileName);
   QPainter painter;  
   if (!painter.begin(&printer))
     return false;
-  myScene->render(&painter);
+
+  QRect view( 0, 0, printer.pageRect().width(), printer.paperRect().height() );
+  QRectF bounds = myScene->itemsBoundingRect();
+    
+  if( !view.isEmpty() && !bounds.isEmpty() )
+  {
+    float SCALE = 0.5;//qMin( view.width()/bounds.width(), view.height()/bounds.height() );
+    painter.setViewport( view );
+    painter.scale( SCALE, SCALE );
+  }
+  myScene->render( &painter, QRectF( view ), bounds );
+
   if (!painter.end())
-    return false;;
+    return false;
+  return true;
 }
 
 //================================================================
index 85d50eb4f974ff962183e5b1b02eb3e80a643e55..89c950173610c9ae6d263f2115dfa5f9f66f4b20 100755 (executable)
@@ -57,8 +57,11 @@ SUIT_ViewManager::SUIT_ViewManager( SUIT_Study* theStudy,
 
   myId = useNewId( getType() );
 
-  connect( theDesktop, SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
-           this,       SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
+  if( theDesktop )
+  {
+    connect( theDesktop, SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
+             this,       SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
+  }
 
   myStudy = theStudy;
   if ( myStudy )