From: asl Date: Tue, 21 Nov 2017 08:18:26 +0000 (+0300) Subject: refs #1417: debug of dump view X-Git-Tag: V8_5_0b1^2~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=59c31fe149a5ec513b40010c8c811155c4bc7326;p=modules%2Fgui.git refs #1417: debug of dump view --- diff --git a/src/GraphicsView/GraphicsView_ViewPort.cxx b/src/GraphicsView/GraphicsView_ViewPort.cxx index de9a19d9e..9cafbd737 100644 --- a/src/GraphicsView/GraphicsView_ViewPort.cxx +++ b/src/GraphicsView/GraphicsView_ViewPort.cxx @@ -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; } //================================================================ diff --git a/src/SUIT/SUIT_ViewManager.cxx b/src/SUIT/SUIT_ViewManager.cxx index 85d50eb4f..89c950173 100755 --- a/src/SUIT/SUIT_ViewManager.cxx +++ b/src/SUIT/SUIT_ViewManager.cxx @@ -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 )