this, SIGNAL( vfKeyPress( QKeyEvent* ) ) ) );
QAD_ASSERT( connect( myViewPort, SIGNAL( vpKeyRelease( QKeyEvent* ) ),
this, SIGNAL( vfKeyRelease( QKeyEvent* ) ) ) );
+ QAD_ASSERT( connect( myViewPort, SIGNAL( vpDumpView() ),
+ this, SLOT( onProcessViewDump() ) ) );
}
//=======================================================================
void vpPaint (QPaintEvent*);
void vpDrawExternal (QPainter* painter);
+ void vpDumpView();
+
protected slots:
virtual void onChangeBackgroundColor() = 0;
int id;
myIDs.append ( id = myPopup->insertItem (tr ("MEN_VP3D_CHANGEBGR")) );
QAD_ASSERT ( myPopup->connectItem ( id, this, SLOT(onChangeBackgroundColor())) );
+ myIDs.append ( id = myPopup->insertItem (tr ("MEN_VP3D_DUMPVIEW")) );
+ QAD_ASSERT ( myPopup->connectItem ( id, this, SIGNAL(vpDumpView())) );
// }
}
}
fitDataAction->setStatusTip ( tr( "PRP_PLOT2D_CHANGE_BACKGROUND" ) );
myActions.insert( ChangeBackgroundId, changeBGAction );
connect( changeBGAction, SIGNAL( activated() ), this, SLOT( onChangeBackground() ) );
+
+ // Dump View
+ QActionP* dumpViewAction = new QActionP ( tr( "MEN_VP3D_DUMPVIEW"),
+ tr( "MEN_VP3D_DUMPVIEW" ), 0, this );
+ dumpViewAction->setStatusTip ( tr( "MEN_VP3D_DUMPVIEW" ) );
+ myActions.insert( DumpViewId, dumpViewAction );
+ connect( dumpViewAction, SIGNAL( activated() ), this, SLOT( onProcessViewDump() ) );
}
/*!
Gets window's central widget
// Change background
myPopup->insertSeparator();
myActions[ ChangeBackgroundId ]->addTo( myPopup );
+ myActions[ DumpViewId ]->addTo( myPopup );
}
}
/*!
enum { NoOpId, FitAllId, FitAreaId, ZoomId, PanId, DumpId,
ModeXLinearId, ModeXLogarithmicId, ModeYLinearId, ModeYLogarithmicId,
- LegendId, CurvePointsId, CurveLinesId, CurveSplinesId, SettingsId, FitDataId, ChangeBackgroundId };
+ LegendId, CurvePointsId, CurveLinesId, CurveSplinesId, SettingsId, FitDataId, ChangeBackgroundId, DumpViewId };
public:
/* Construction/destruction */
Plot2d_ViewFrame( QWidget* parent, const QString& title = "" );
{
if (!getViewWidget())
return;
-
QApplication::setOverrideCursor( Qt::waitCursor );
QPixmap px = QPixmap::grabWindow(getViewWidget()->winId());
QApplication::restoreOverrideCursor();
}
}
}
+
+#define DUMP_EVENT QEvent::User + 123
+/*!
+ This method is used to dump the viewer contents to the image file
+ from the context popup menu (uses event mechanizm to assure redrawing
+ the viewer contents before dumping by sending custom event)
+*/
+void QAD_ViewFrame::onProcessViewDump()
+{
+ qApp->postEvent( this, new QPaintEvent( QRect( 0, 0, width(), height() ), TRUE ) );
+ qApp->postEvent( this, new QCustomEvent( DUMP_EVENT ) );
+}
+
+/*!
+ Processes the custom event sent by onProcessViewDump() method to
+ call onViewDump() slot: dumping the view contents to the image file
+ (see desription for onProcessViewDump() method above)
+*/
+bool QAD_ViewFrame::event ( QEvent* e )
+{
+ if ( e->type() == DUMP_EVENT ) {
+ onViewDump();
+ return TRUE;
+ }
+ return QMainWindow::event( e );
+}
QAD_ViewFrame(QWidget* parent = 0);
virtual ~QAD_ViewFrame();
+ bool event ( QEvent* e );
+
void cleanup();
virtual ViewType getTypeView() const = 0;
virtual void onRotateRight() {}
virtual void onRotateUp() {}
virtual void onRotateDown() {}
+
+ /* the next slot is used for dumping viewer contents to the image file;
+ called from the context popup menu
+ */
+ void onProcessViewDump();
};
#endif
msgid "MEN_VP3D_CHANGEBGR"
msgstr "Change background..."
+msgid "MEN_VP3D_DUMPVIEW"
+msgstr "Camera Dump..."
+
msgid "MEN_APP_DISPLAY"
msgstr "Display"
int id;
myIDs.append ( id = myPopup->insertItem (tr ("MEN_VP3D_CHANGEBGR")) );
QAD_ASSERT ( myPopup->connectItem ( id, this, SLOT(onChangeBackgroundColor())) );
+ myIDs.append ( id = myPopup->insertItem (tr ("MEN_VP3D_DUMPVIEW")) );
+ QAD_ASSERT ( myPopup->connectItem ( id, this, SIGNAL(DumpView())) );
// }
}
}
void ButtonPressed(const QMouseEvent *event) ;
void ButtonReleased(const QMouseEvent *event) ;
void KeyPressed(QKeyEvent *event) ;
+ void DumpView();
protected:
vtkRenderWindow* myRW;
void VTKViewer_ViewFrame::InitialSetup() {
m_RW = new VTKViewer_RenderWindow(this, "RenderWindow");
m_RW->getRenderWindow()->AddRenderer(m_Renderer);
+ connect(m_RW, SIGNAL(DumpView()), this, SLOT(onProcessViewDump()));
m_Renderer->GetActiveCamera()->ParallelProjectionOn();
m_Renderer->LightFollowCameraOn();