]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Implement generic "Dump view" method to be used by all views (toolbar & context menu)
authorvsr <vsr@opencascade.com>
Mon, 20 Jun 2005 14:31:43 +0000 (14:31 +0000)
committervsr <vsr@opencascade.com>
Mon, 20 Jun 2005 14:31:43 +0000 (14:31 +0000)
22 files changed:
src/GLViewer/GLViewer_ViewFrame.cxx
src/GLViewer/GLViewer_ViewFrame.h
src/GLViewer/GLViewer_Viewer2d.cxx
src/GLViewer/GLViewer_Viewer2d.h
src/GLViewer/resources/GLViewer_msg_en.po
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/OCCViewer/OCCViewer_ViewWindow.h
src/Plot2d/Plot2d_ViewFrame.cxx
src/Plot2d/Plot2d_ViewFrame.h
src/Plot2d/Plot2d_ViewModel.cxx
src/Plot2d/Plot2d_ViewModel.h
src/Plot2d/Plot2d_ViewWindow.cxx
src/Plot2d/Plot2d_ViewWindow.h
src/Plot2d/resources/Plot2d_msg_en.po
src/SUIT/SUIT_ViewWindow.cxx
src/SUIT/SUIT_ViewWindow.h
src/SUIT/resources/SUIT_msg_en.po
src/SVTK/SVTK_ViewWindow.cxx
src/SVTK/SVTK_ViewWindow.h
src/VTKViewer/VTKViewer_ViewWindow.cxx
src/VTKViewer/VTKViewer_ViewWindow.h
src/VTKViewer/resources/VTKViewer_msg_en.po

index 14e2305abae6ac18696a2dade2e0e02d1a9dd413..5053889bd09b39be1c4191a7485e1f81e2a3ea76 100644 (file)
@@ -81,7 +81,7 @@ void GLViewer_ViewFrame::createActions()
   aAction = new QtxAction(tr("MNU_DUMP_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_DUMP" ) ),
                            tr( "MNU_DUMP_VIEW" ), 0, this);
   aAction->setStatusTip(tr("DSC_DUMP_VIEW"));
-  connect(aAction, SIGNAL(activated()), this, SLOT(onViewDump()));
+  connect(aAction, SIGNAL(activated()), this, SLOT(onDumpView()));
   myActionsMap[ DumpId ] = aAction;
 
   // FitAll
@@ -246,7 +246,7 @@ void GLViewer_ViewFrame::onUpdate( int )
 {
 }
 
-void GLViewer_ViewFrame::onViewDump()
+QImage GLViewer_ViewFrame::dumpView()
 {
     GLViewer_Widget* aWidget = ((GLViewer_ViewPort2d*)myVP)->getGLWidget();
     int width, height;
@@ -383,31 +383,7 @@ void GLViewer_ViewFrame::onViewDump()
     }
 
     delete [] imageBits;
-
-    SUIT_Application* app = getViewManager()->study()->application();
-
-    QString aFileName = app->getFileName( false, QString::null, QString( "*.bmp;*.png" ), tr( "DUMP_VIEW_SAVE_FILE_DLG_CAPTION" ), 0 );
-
-    if( aFileName.isEmpty() ) // cancelled
-      return;
-
-    QString aSaveOp = SUIT_Tools::extension( aFileName ).upper();
-
-    if ( aSaveOp != "BMP" && aSaveOp != "PNG" ) {
-      SUIT_MessageBox::error1( this,
-                              tr( "DUMP_VIEW_ERROR_DLG_CAPTION" ),
-                              tr( "DUMP_VIEW_ERROR_UNSUPPORTED_FORMAT" ).arg( aSaveOp ),
-                              tr( "BUT_OK" ) );
-      return;
-    }
-
-    if( !anImage.save( aFileName, aSaveOp ) )
-    {
-        SUIT_MessageBox::error1( this,
-                                tr( "DUMP_VIEW_ERROR_DLG_CAPTION" ),
-                                tr( "DUMP_VIEW_ERROR_DLG_TEXT" ),
-                                tr( "BUT_OK" ) );
-    }
+    return anImage;
 }
 
 void GLViewer_ViewFrame::onViewPan()
@@ -509,3 +485,4 @@ void GLViewer_ViewFrame::wheelEvent( QWheelEvent* e )
     break;
   }
 }
+
index 18d17263197423caab66e78174ebefd8267635d7..9033b70204cbfba3579ec4878869d0c8bccd3ef6 100644 (file)
@@ -56,12 +56,14 @@ protected:
   GLViewer_Viewer*        myViewer;
   GLViewer_ViewPort*      myVP;
   
+protected:
+  QImage dumpView();
+
 public:
   //ViewType       getTypeView() const { return VIEW_GL; }; 
   QWidget*       getViewWidget() { return ( QWidget* )getViewPort(); };
   
 protected slots:
-  void           onViewDump();
   void           onViewPan();
   void           onViewZoom();
   void           onViewFitAll();
index e80af49be85fbb20cb0abcf45d8bd5331baa34d9..d13de15e70b1e9661fab6db4e539287d99546f4f 100644 (file)
@@ -57,6 +57,7 @@ void GLViewer_Viewer2d::contextMenuPopup( QPopupMenu* thePopup )
   {
     if( thePopup->count() > 0 )
         thePopup->insertSeparator();
+    thePopup->insertItem( tr( "MNU_DUMP_VIEW" ),  this, SLOT( onDumpView() ) );
     thePopup->insertItem( tr( "CHANGE_BGCOLOR" ), this, SLOT( onChangeBgColor() ) );
   }
 }
@@ -993,6 +994,14 @@ void GLViewer_Viewer2d::startOperations( QWheelEvent* e )
         updateAll();
 }
 
+/*!
+    Processes "Dump view..." context popup menu command
+*/
+void GLViewer_Viewer2d::onDumpView()
+{
+  if ( getActiveView() )
+    getActiveView()->onDumpView();
+}
 
 /****************************************************************
 **  Class: GLViewer_View2dTransformer
@@ -1068,3 +1077,4 @@ void GLViewer_View2dTransformer::onTransform( TransformState state )
     }
     GLViewer_ViewTransformer::onTransform( state );
 }
+
index 98275331464d62c9e267f1a62c5c704ac9cf275e..9441c23abb1f5081e6c1e2ce8cd66b47d5bc6798 100644 (file)
@@ -129,6 +129,7 @@ protected:
 
 protected slots:
     void                 onMouseEvent( SUIT_ViewWindow*, QMouseEvent* );
+    void                 onDumpView();
 
 private:
     bool                 testRotation( QMouseEvent* );
index ca1b5e351a19b3ffcd4a4319185c07838c829215..3b9e942beee47d9690312305c51280448800358a 100644 (file)
@@ -60,7 +60,7 @@ msgid "DSC_DUMP_VIEW"
 msgstr "Saves the active view in the image file"
 
 msgid "MNU_DUMP_VIEW"
-msgstr "Dump"
+msgstr "Dump view..."
 
 msgid "GL_IMAGE_FILES"
 msgstr "Images Files (*.bmp *.png)"
index 0cb903a56372ea3ca754c49719b54fb6fbd8efb8..0351deacd668b655e8ee4a9c138daad5e1f24e35 100755 (executable)
@@ -775,36 +775,6 @@ void OCCViewer_ViewWindow::onFitAll()
   myViewPort->fitAll();
 }
 
-//****************************************************************
-/*
-   Dumps 3d-Viewer contents into image file
-   File format is defined by file's extension; supported formats : PNG, BMP, GIF, JPG
-*/
-void OCCViewer_ViewWindow::onDumpView()
-{
-  QApplication::setOverrideCursor( Qt::waitCursor );
-  QPixmap px = QPixmap::grabWindow(myViewPort->winId());
-  QApplication::restoreOverrideCursor();
-  
-  SUIT_Application* app = getViewManager()->study()->application();
-
-  QString aFileName = app->getFileName( false, QString::null, tr("OCC_IMAGE_FILES"), tr("INF_APP_DUMP_VIEW"), 0 );
-
-  if ( !aFileName.isNull() ) {
-    QApplication::setOverrideCursor( Qt::waitCursor );
-    QString fmt = SUIT_Tools::extension( aFileName ).upper();
-    if (fmt.isEmpty())
-      fmt = QString("BMP"); // default format
-    if (fmt == "JPG")
-      fmt = "JPEG";
-    bool bOk = px.save(aFileName, fmt.latin1());
-    QApplication::restoreOverrideCursor();
-    if (!bOk) {
-      SUIT_MessageBox::error1(this, tr("ERROR"), tr("ERR_DOC_CANT_SAVE_FILE"), tr("BUT_OK"));
-    }
-  }
-}
-
 //****************************************************************
 void OCCViewer_ViewWindow::onCloneView()
 {
@@ -886,3 +856,10 @@ void OCCViewer_ViewWindow::onTrihedronShow()
 {
   myModel->toggleTrihedron();
 }
+
+//****************************************************************
+QImage OCCViewer_ViewWindow::dumpView()
+{
+  QPixmap px = QPixmap::grabWindow( myViewPort->winId() );
+  return px.convertToImage();
+}
index efac118cfd1c74a160ff277ba543d55b004d61b3..9866785775d27476a2220e84de41e1942ff7d14b 100755 (executable)
@@ -48,7 +48,6 @@ public slots:
   void onRightView();
   void onResetView();
   void onFitAll();
-  void onDumpView();
   void activateZoom();
   void activateWindowFit();
   void activateRotation();
@@ -72,6 +71,7 @@ protected:
 
   typedef QMap<int, QtxAction*> ActionsMap;
 
+  QImage dumpView();
 
   /* Transformation selected but not started yet */
   bool transformRequested() const { return ( myOperation != NOTHING ); }
index a5f7abd2a205b50393de0c5d003e3b49db2c1bea..116410def87b44fbe522a8be4bfe9fa41c1b49e2 100755 (executable)
@@ -1462,34 +1462,6 @@ void Plot2d_ViewFrame::wheelEvent(QWheelEvent* event)
   myPlot->replot();
   myPnt = event->pos();
 }
-/*!
-  View operations : Dump view
-*/
-void Plot2d_ViewFrame::onDump()
-{
-  QApplication::setOverrideCursor( Qt::waitCursor );
-  QPixmap px = QPixmap::grabWindow(winId());
-  QApplication::restoreOverrideCursor();
-
-  SUIT_Application* app = ((Plot2d_ViewWindow*)parent())->getViewManager()->study()->application();
-
-  QString aFileName = app->getFileName( false, QString::null, tr("PLOT2D_IMAGE_FILES"), tr("INF_APP_DUMP_VIEW"), 0 );
-
-  if ( !aFileName.isNull() )
-  {
-    QApplication::setOverrideCursor( Qt::waitCursor );
-    QString fmt = SUIT_Tools::extension( aFileName ).upper();
-    if (fmt.isEmpty())
-      fmt = QString("BMP"); // default format
-    if (fmt == "JPG")
-      fmt = "JPEG";
-    bool bOk = px.save(aFileName, fmt.latin1());
-    QApplication::restoreOverrideCursor();
-    if (!bOk) {
-      SUIT_MessageBox::error1(this, tr("ERROR"), tr("ERR_DOC_CANT_SAVE_FILE"), tr("BUT_OK"));
-    }
-  }
-}
 /*!
   View operations : Pan view
 */
index 1c5f3037d4678624da9155047b502dd4f1c8d93c..565f8d04ede7431df4d7eb2659a51592c3cd399a 100755 (executable)
@@ -94,7 +94,6 @@ protected:
   virtual void wheelEvent( QWheelEvent* );
 
 public slots:
-  void    onDump();
   void    onViewPan(); 
   void    onViewZoom();
   void    onViewFitAll();
index beadcac51497675e3db3c622e33e59359a651510..e5f1bf9679604f9bc441264f7b252cad83509dd9 100755 (executable)
@@ -36,7 +36,8 @@ void Plot2d_Viewer::contextMenuPopup(QPopupMenu* thePopup)
     aView->contextMenuPopup(thePopup);
 
   if (thePopup->count() > 0) thePopup->insertSeparator();
-  thePopup->insertItem("Change background...", this, SLOT(onChangeBgColor()));
+  thePopup->insertItem( tr( "MNU_DUMP_VIEW" ),                this, SLOT(onDumpView()));
+  thePopup->insertItem( tr( "MEN_PLOT2D_CHANGE_BACKGROUND" ), this, SLOT(onChangeBgColor()));
 
   if ( aView ) {
     if ( !aView->getToolBar()->isVisible() ) {
@@ -110,3 +111,11 @@ void Plot2d_Viewer::onShowToolbar() {
   if ( aView )
     aView->getToolBar()->show();    
 }
+
+//*********************************************************************
+void Plot2d_Viewer::onDumpView()
+{
+  Plot2d_ViewWindow* aView = (Plot2d_ViewWindow*)(myViewManager->getActiveView());
+  if ( aView )
+    aView->onDumpView();    
+}
index a53f16b7b753d981e4d0372425bf9e00a93e7bef..ab40293bd613ee1dca43fa4a2d725c932241f007 100755 (executable)
@@ -35,6 +35,7 @@ public:
 
 protected slots:
   void onChangeBgColor();
+  void onDumpView();
   void onShowToolbar();
 
 private:
index 7f7ed5ef3d8cc6c16c9e42129f7af8ec555e9d77..6a5d512dc358eea8e37d1fc6b27d4faaeb4262a7 100755 (executable)
@@ -10,6 +10,7 @@
 
 #include <qstatusbar.h>
 #include <qlayout.h>
+#include <qapplication.h>
 
 //////////////////////////////////////////////////////////////////////
 // Construction/Destruction
@@ -341,12 +342,6 @@ void Plot2d_ViewWindow::onChangeLegendMode()
   myActionsMap[ LegendId ]->setOn(myViewFrame->isLegendShow());
 }
 
-//****************************************************************
-void Plot2d_ViewWindow::onDumpView()
-{
-  myViewFrame->onDump();
-}
-
 //****************************************************************
 void Plot2d_ViewWindow::onFitAll()
 {
@@ -425,3 +420,17 @@ void Plot2d_ViewWindow::onCurves()
     myViewFrame->setCurveType(2);
   }
 }
+
+//****************************************************************
+void Plot2d_ViewWindow::onDumpView()
+{
+  qApp->postEvent( myViewFrame, new QPaintEvent( QRect( 0, 0, myViewFrame->width(), myViewFrame->height() ), TRUE ) );
+  SUIT_ViewWindow::onDumpView();
+}
+
+//****************************************************************
+QImage Plot2d_ViewWindow::dumpView()
+{
+  QPixmap px = QPixmap::grabWindow( myViewFrame->winId() );
+  return px.convertToImage();
+}
index 9c20a5bd49d6a471095001b903378870844eb7dd..6ac6970b60542049967f4a97670a7f59513c7530 100755 (executable)
@@ -35,6 +35,9 @@ public:
   QToolBar*         getToolBar() { return myToolBar; };
   void              contextMenuPopup( QPopupMenu* thePopup );
 
+protected:
+  QImage dumpView();
+
 private:
   bool eventFilter(QObject* watched, QEvent* e);
 
@@ -47,7 +50,6 @@ public slots:
   void onChangeCurveMode();
   void onChangeLegendMode();
   
-  void onDumpView();
   void onFitAll();
   void onFitRect();
   void onZoom();
@@ -58,6 +60,8 @@ public slots:
   void onLegend();
   void onCurves();
 
+  void onDumpView();
+
 signals:
   void cloneView();
 
index ce99101b582250e3471af5f53a368d4a527da6ff..45d54cf10d121d99d35d88494f2cc559f6159dfe 100755 (executable)
@@ -275,7 +275,7 @@ msgid "DSC_DUMP_VIEW"
 msgstr "Saves the active view in the image file"
 
 msgid "MNU_DUMP_VIEW"
-msgstr "Dump"
+msgstr "Dump view..."
 
 msgid "DSC_FITALL"
 msgstr "Fit all objects inside the view frame"
index 4eb47e3ef6706bef2dfbbaba7600eff1bd926413..f7060156b509d637099dd12d86f1d28069f7adeb 100755 (executable)
@@ -4,8 +4,18 @@
 
 #include "SUIT_ViewWindow.h"
 #include "SUIT_Desktop.h"
+#include "SUIT_Application.h"
+#include "SUIT_Study.h"
+#include "SUIT_ViewManager.h"
+#include "SUIT_Tools.h"
+#include "SUIT_MessageBox.h"
 #include "qhbox.h"
 #include "qpopupmenu.h"
+#include "qapplication.h"
+
+// Dump view custom event
+const int DUMP_EVENT = QEvent::User + 123;
+
 //////////////////////////////////////////////////////////////////////
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
@@ -33,3 +43,44 @@ void SUIT_ViewWindow::contextMenuEvent ( QContextMenuEvent * e )
   if ( e->reason() != QContextMenuEvent::Mouse )
     emit contextMenuRequested( e );
 }
+
+//****************************************************************
+void SUIT_ViewWindow::onDumpView()
+{
+  qApp->postEvent( this, new QPaintEvent( QRect( 0, 0, width(), height() ), TRUE ) );
+  qApp->postEvent( this, new QCustomEvent( DUMP_EVENT ) );
+}
+
+//****************************************************************
+bool SUIT_ViewWindow::event( QEvent* e )
+{
+  if ( e->type() == DUMP_EVENT ) {
+    bool bOk = false;
+    if ( myManager && myManager->study() && myManager->study()->application() ) {
+      // first create an image (this is small trick to avoid dialog box overlapping)
+      QImage img = dumpView();
+      if ( !img.isNull() ) {
+        // get file name
+        QString fileName = myManager->study()->application()->getFileName( false, QString::null, tr( "TLT_IMAGE_FILES" ), tr( "TLT_DUMP_VIEW" ), 0 );
+        if ( fileName ) {
+          QString fmt = SUIT_Tools::extension( fileName ).upper();
+          if ( fmt.isEmpty() ) fmt = QString( "BMP" ); // default format
+         if ( fmt == "JPG" )  fmt = "JPEG";
+          QApplication::setOverrideCursor( Qt::waitCursor );
+         bOk = img.save( fileName, fmt.latin1() );
+         QApplication::restoreOverrideCursor();
+        }
+       else {
+          bOk = true; // cancelled
+        }
+      }
+    }
+    if ( !bOk ) {
+      SUIT_MessageBox::error1( this, tr( "ERROR" ), tr( "ERR_CANT_DUMP_VIEW" ), tr( "BUT_OK" ) );
+    }
+    return TRUE;
+  }
+  return QMainWindow::event( e );
+}
+
+//****************************************************************
index 4f8525db9ad619b3fc8ed3b039ae0936a76c7999..115f1fc4c3d28d75c4a22d22f4725a08a53655ea 100755 (executable)
@@ -12,6 +12,7 @@
 #include "SUIT.h"
 
 #include <qmainwindow.h>
+#include <qimage.h>
 
 class SUIT_Desktop;
 class SUIT_ViewManager;
@@ -26,6 +27,11 @@ public:
   void              setViewManager(SUIT_ViewManager* theManager) { myManager = theManager;}
   SUIT_ViewManager* getViewManager() const { return myManager; }
 
+  bool              event(QEvent*);
+
+public slots:
+  virtual void      onDumpView();
+
 signals:
   void              closing(SUIT_ViewWindow*);
   void              mousePressed(SUIT_ViewWindow*, QMouseEvent*);
@@ -41,6 +47,8 @@ protected:
   void              closeEvent(QCloseEvent* theEvent);
   virtual void      contextMenuEvent( QContextMenuEvent * e );
 
+  virtual QImage    dumpView() { return QImage(); }
+
   SUIT_Desktop*     myDesktop;
   SUIT_ViewManager* myManager;
 };
index 32d03cff3540d347da917d6a136465531d80282b..4cedd757a092239fc2168de3aeec012d52a04b33 100755 (executable)
@@ -75,3 +75,11 @@ msgstr "Directories"
 msgid "QUE_FILE_EXISTS"
 msgstr "The file \"%1\" already exists.\nDo you want to overwrite it?"
 
+msgid "TLT_DUMP_VIEW"
+msgstr "Dump View to File"
+
+msgid "TLT_IMAGE_FILES"
+msgstr "Images Files (*.bmp *.png *.jpg *.jpeg)""
+
+msgid "ERR_CANT_DUMP_VIEW"
+msgstr "Can't dump view contents to the file."
\ No newline at end of file
index dace6f30e893fc531d3506b8731c9b06d4e9e68e..cd140f5fa99436e555f1fafb216eae516eb52eac 100755 (executable)
@@ -417,34 +417,6 @@ SVTK_ViewWindow
   Repaint();
 }
 
-//----------------------------------------------------------------------------
-void
-SVTK_ViewWindow
-::onDumpView()
-{
-  QApplication::setOverrideCursor( Qt::waitCursor );
-  QPixmap px = QPixmap::grabWindow(myRenderWindow->winId());
-  QApplication::restoreOverrideCursor();
-  
-  SUIT_Application* app = getViewManager()->study()->application();
-
-  QString aFileName = app->getFileName( false, QString::null, tr("VTK_IMAGE_FILES"), tr("INF_APP_DUMP_VIEW"), 0 );
-
-  if ( !aFileName.isNull() ) {
-    QApplication::setOverrideCursor( Qt::waitCursor );
-    QString fmt = SUIT_Tools::extension( aFileName ).upper();
-    if (fmt.isEmpty())
-      fmt = QString("BMP"); // default format
-    if (fmt == "JPG")
-      fmt = "JPEG";
-    bool bOk = px.save(aFileName, fmt.latin1());
-    QApplication::restoreOverrideCursor();
-    if (!bOk) {
-      SUIT_MessageBox::error1(this, tr("ERROR"), tr("ERR_DOC_CANT_SAVE_FILE"), tr("BUT_OK"));
-    }
-  }
-}
-
 //----------------------------------------------------------------
 void
 SVTK_ViewWindow
@@ -898,3 +870,12 @@ SVTK_ViewWindow
   RemoveActor(theActor);
   InsertActor(theActor,true);
 }
+
+//----------------------------------------------------------------------------
+QImage
+SVTK_ViewWindow
+::dumpView()
+{
+  QPixmap px = QPixmap::grabWindow( myRenderWindow->winId() );
+  return px.convertToImage();
+}
index 3b4f4c38365533333ed5aadb68c583248b66ecbf..a2f70efa4f815d37bb09a6671242af7cd1fd3e95 100755 (executable)
@@ -85,7 +85,7 @@ public:
 public slots:
   void onSelectionChanged();
 
- signals:
+signals:
  void selectionChanged();
 
 public slots:
@@ -98,7 +98,6 @@ public slots:
 
   void onResetView();     
   void onFitAll();
-  void onDumpView();
 
   void onViewTrihedron(); 
   void onAdjustTrihedron();
@@ -120,6 +119,9 @@ public slots:
   void activatePanning(); 
   void activateGlobalPanning(); 
 
+protected:
+  QImage dumpView();
+
 protected slots:
   void onKeyPressed(QKeyEvent* event);
   void onKeyReleased(QKeyEvent* event);
index 014608d6843a92e337a750908f23ae0a3f72551a..78b400430e5b0d6b68d353fd89cb75b88f60fbf4 100755 (executable)
@@ -385,36 +385,6 @@ void VTKViewer_ViewWindow::onFitAll()
   Repaint();
 }
 
-//****************************************************************
-/*
-   Dumps 3d-Viewer contents into image file
-   File format is defined by file's extension; supported formats : PNG, BMP, GIF, JPG
-*/
-void VTKViewer_ViewWindow::onDumpView()
-{
-  QApplication::setOverrideCursor( Qt::waitCursor );
-  QPixmap px = QPixmap::grabWindow(myRenderWindow->winId());
-  QApplication::restoreOverrideCursor();
-  SUIT_Application* app = getViewManager()->study()->application();
-
-  QString aFileName = app->getFileName( false, QString::null, tr("VTK_IMAGE_FILES"), tr("INF_APP_DUMP_VIEW"), 0 );
-  if ( !aFileName.isNull() ) {
-    QApplication::setOverrideCursor( Qt::waitCursor );
-    QString fmt = SUIT_Tools::extension( aFileName ).upper();
-    if (fmt.isEmpty())
-      fmt = QString("BMP"); // default format
-    if (fmt == "JPG")
-      fmt = "JPEG";
-    bool bOk = px.save(aFileName, fmt.latin1());
-    QApplication::restoreOverrideCursor();
-    if (!bOk) {
-      SUIT_MessageBox::error1(this, tr("ERROR"), tr("ERR_DOC_CANT_SAVE_FILE"), tr("BUT_OK"));
-    }
-  }
-}
-
 //****************************************************************
 /*!
     Set background of the viewport
@@ -566,3 +536,10 @@ void VTKViewer_ViewWindow::onTrihedronShow()
     myTrihedron->VisibilityOn();
   myRenderWindow->update();
 }
+
+//****************************************************************
+QImage VTKViewer_ViewWindow::dumpView()
+{
+  QPixmap px = QPixmap::grabWindow( myRenderWindow->winId() );
+  return px.convertToImage();
+}
index a998414d74df38debd4ddd03a79cd6751d10fd6c..df62ed447ef2a352fa966e4ac3a750f52c44e50b 100755 (executable)
@@ -57,7 +57,6 @@ public slots:
   void onRightView();
   void onResetView();
   void onFitAll();
-  void onDumpView();
   void activateZoom();
   void activateWindowFit();
   void activateRotation();
@@ -65,6 +64,9 @@ public slots:
   void activateGlobalPanning();
   void onTrihedronShow();
 
+protected:
+  QImage dumpView();
+
 protected slots:
   void onKeyPressed(QKeyEvent* event);
   void onKeyReleased(QKeyEvent* event);
index 18fe26af36638542c20bd7f0e0003d98a767ff3d..603fbb3c09a26c9cc07f4a6d15cf5352d9c05958 100755 (executable)
@@ -117,7 +117,7 @@ msgid "DSC_DUMP_VIEW"
 msgstr "Saves the active view in the image file"
 
 msgid "MNU_DUMP_VIEW"
-msgstr "Dump"
+msgstr "Dump view..."
 
 msgid "VTK_IMAGE_FILES"
 msgstr "Images Files (*.bmp *.png *.jpg *.jpeg)"