From: vtn Date: Tue, 19 Mar 2013 10:37:22 +0000 (+0000) Subject: Allow to made photo if view is not visible. Added PDF support. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5633648d7b1c68e1dd5508ed7bddb5eda5aab8a5;p=modules%2Fgui.git Allow to made photo if view is not visible. Added PDF support. --- diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index 4559f433c..93e7509c9 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -3256,17 +3256,15 @@ void Plot2d_ViewFrame::updateTitles() */ bool Plot2d_ViewFrame::print( const QString& file, const QString& format ) const { -#ifdef WIN32 - return false; - -#else bool res = false; if( myPlot ) { QPaintDevice* pd = 0; - if( format=="PS" || format=="EPS" ) + if( format=="PS" || format=="EPS" || format == "PDF") { QPrinter* pr = new QPrinter( QPrinter::HighResolution ); + if(format == "PDF") + pr->setOutputFormat(QPrinter::PdfFormat); pr->setPageSize( QPrinter::A4 ); pr->setOutputFileName( file ); pr->setPrintProgram( "" ); @@ -3281,7 +3279,6 @@ bool Plot2d_ViewFrame::print( const QString& file, const QString& format ) const } } return res; -#endif } /** diff --git a/src/Plot2d/Plot2d_ViewWindow.cxx b/src/Plot2d/Plot2d_ViewWindow.cxx index 56424b9a1..2d9475b53 100755 --- a/src/Plot2d/Plot2d_ViewWindow.cxx +++ b/src/Plot2d/Plot2d_ViewWindow.cxx @@ -528,7 +528,7 @@ void Plot2d_ViewWindow::setVisualParameters( const QString& parameters ) */ void Plot2d_ViewWindow::RefreshDumpImage() { - QPixmap px = QPixmap::grabWindow( myViewFrame->winId() ); + QPixmap px = QPixmap::grabWidget( myViewFrame ); myDumpImage = px.toImage(); } @@ -742,7 +742,7 @@ void Plot2d_ViewWindow::onDumpView() QImage Plot2d_ViewWindow::dumpView() { if ( getToolBar()->underMouse() || myDumpImage.isNull() ) { - QPixmap px = QPixmap::grabWindow( myViewFrame->winId() ); + QPixmap px = QPixmap::grabWidget( myViewFrame ); return px.toImage(); }