From 21d815c94966232aee9f4e6f48beb9bef4151112 Mon Sep 17 00:00:00 2001 From: vtn Date: Fri, 19 Apr 2013 10:46:52 +0000 Subject: [PATCH] raster dump of Plot2d view is incorrect if view is hidden. --- src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx index d8bcbb819..c4834babb 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -41,6 +41,7 @@ #include #include #include +#include #include @@ -2245,19 +2246,24 @@ public: } if ( wnd ) { QString fmt = SUIT_Tools::extension( myFileName ).toUpper(); + Plot2d_ViewWindow* wnd2D = dynamic_cast(wnd); if(fmt == "PS" || fmt == "EPS" || fmt == "PDF") { - Plot2d_ViewWindow* wnd2D = dynamic_cast(wnd); if(wnd2D) { myResult = wnd2D->getViewFrame()->print(myFileName, fmt); } else { myResult = false; } } else { - QImage im = wnd->dumpView(); - if ( !im.isNull() && !myFileName.isEmpty() ) { - if ( fmt.isEmpty() ) fmt = QString( "BMP" ); // default format - if ( fmt == "JPG" ) fmt = "JPEG"; - myResult = im.save( myFileName, fmt.toLatin1() ); + if(wnd2D) { + qApp->postEvent( wnd2D->getViewFrame(), new QPaintEvent( QRect( 0, 0, wnd2D->getViewFrame()->width(), wnd2D->getViewFrame()->height() ) ) ); + qApp->postEvent( wnd2D, new QPaintEvent( QRect( 0, 0, wnd2D->width(), wnd2D->height() ) ) ); + qApp->processEvents(); + } + QImage im = wnd->dumpView(); + if ( !im.isNull() && !myFileName.isEmpty() ) { + if ( fmt.isEmpty() ) fmt = QString( "BMP" ); // default format + if ( fmt == "JPG" ) fmt = "JPEG"; + myResult = im.save( myFileName, fmt.toLatin1() ); } } } -- 2.39.2