From: mzn Date: Wed, 16 Aug 2006 15:43:17 +0000 (+0000) Subject: Fix for bug PAL12468(When dumping a VTK view, the dialog box appears in the saved... X-Git-Tag: For_OCT_611 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bc9d893914f2c977c60e858fe3d0c24ccb365bb6;p=modules%2Fvisu.git Fix for bug PAL12468(When dumping a VTK view, the dialog box appears in the saved image). --- diff --git a/src/VVTK/VVTK_MainWindow.cxx b/src/VVTK/VVTK_MainWindow.cxx index 01a0b2b4..4aa149fd 100644 --- a/src/VVTK/VVTK_MainWindow.cxx +++ b/src/VVTK/VVTK_MainWindow.cxx @@ -154,6 +154,10 @@ VVTK_MainWindow::~VVTK_MainWindow() //---------------------------------------------------------------------------- void VVTK_MainWindow::onDumpView() { + QImage img = dumpView(); + if( img.isNull() ) + return; + SUIT_Application* app = SUIT_Session::session()->activeApplication(); QString fileName = app->getFileName( false, QString::null, tr( "TLT_IMAGE_FILES" ), @@ -161,10 +165,6 @@ void VVTK_MainWindow::onDumpView() if( fileName.isEmpty() ) return; - QImage img = dumpView(); - if( img.isNull() ) - return; - QString fmt = SUIT_Tools::extension( fileName ).upper(); if( fmt.isEmpty() ) fmt = QString( "BMP" ); // default format diff --git a/src/VVTK/VVTK_ViewWindow.cxx b/src/VVTK/VVTK_ViewWindow.cxx index cbd0d46a..b0d70802 100755 --- a/src/VVTK/VVTK_ViewWindow.cxx +++ b/src/VVTK/VVTK_ViewWindow.cxx @@ -49,7 +49,8 @@ VVTK_ViewWindow SVTK_ViewWindow(theDesktop), myMainWindow1(NULL), myMainWindow2(NULL), - myView2(NULL) + myView2(NULL), + myDumpImage(QImage()) {} //---------------------------------------------------------------------------- @@ -277,10 +278,20 @@ VVTK_ViewWindow ::dumpView() { if( myMainWindow1->GetInteractor()->hasFocus() ) - return myMainWindow1->dumpView(); + { + if ( myMainWindow1->getToolBar()->hasMouse() || myDumpImage.isNull() ) + return myMainWindow1->dumpView(); + else + return myDumpImage; + } if( myMainWindow2->GetInteractor()->hasFocus() ) - return myMainWindow2->dumpView(); + { + if ( myMainWindow1->getToolBar()->hasMouse() || myDumpImage.isNull() ) + return myMainWindow2->dumpView(); + else + return myDumpImage; + } return QImage(); } @@ -294,3 +305,14 @@ VVTK_ViewWindow myMainWindow2->SetBackgroundColor( theColor ); } + +//---------------------------------------------------------------------------- +void +VVTK_ViewWindow +::RefreshDumpImage() +{ + if( myMainWindow1->GetInteractor()->hasFocus() ) + myDumpImage = myMainWindow1->dumpView(); + else if ( myMainWindow2->GetInteractor()->hasFocus() ) + myDumpImage = myMainWindow2->dumpView(); +} diff --git a/src/VVTK/VVTK_ViewWindow.h b/src/VVTK/VVTK_ViewWindow.h index ca0ab04c..7e2dbf05 100755 --- a/src/VVTK/VVTK_ViewWindow.h +++ b/src/VVTK/VVTK_ViewWindow.h @@ -27,6 +27,8 @@ #include "VVTK.h" #include "SVTK_ViewWindow.h" +#include + #include class VVTK_MainWindow1; @@ -105,6 +107,11 @@ public: setBackgroundColor( const QColor& ); //---------------------------------------------------------------------------- + + //! Refresh dump images of the viewers + virtual + void RefreshDumpImage(); + public slots: //! Redefine SVTK_ViewWindow::onSelectionChanged method virtual @@ -134,6 +141,9 @@ protected: VVTK_MainWindow2* myMainWindow2; //!< The manage segmented view SVTK_View* myView2; //!< The manage segmented view + +private: + QImage myDumpImage; }; #ifdef WIN32