From: vsr Date: Fri, 15 Apr 2005 06:11:25 +0000 (+0000) Subject: PAL8598: Provide an access to "Dump View" functionality from the context popup menu... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3baebff0f6ccf1cc517fdb5355c8f34c15530104;p=modules%2Fkernel.git PAL8598: Provide an access to "Dump View" functionality from the context popup menu for the viewer --- diff --git a/src/SALOMEGUI/QAD_ViewFrame.cxx b/src/SALOMEGUI/QAD_ViewFrame.cxx index c22c7a4a8..ff25d5aa3 100644 --- a/src/SALOMEGUI/QAD_ViewFrame.cxx +++ b/src/SALOMEGUI/QAD_ViewFrame.cxx @@ -78,7 +78,6 @@ void QAD_ViewFrame::onViewDump() { if (!getViewWidget()) return; - QApplication::setOverrideCursor( Qt::waitCursor ); QPixmap px = QPixmap::grabWindow(getViewWidget()->winId()); QApplication::restoreOverrideCursor(); @@ -105,3 +104,29 @@ void QAD_ViewFrame::onViewDump() } } } + +#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 ); +} diff --git a/src/SALOMEGUI/QAD_ViewFrame.h b/src/SALOMEGUI/QAD_ViewFrame.h index 7ea86fb5f..572eccddf 100644 --- a/src/SALOMEGUI/QAD_ViewFrame.h +++ b/src/SALOMEGUI/QAD_ViewFrame.h @@ -51,6 +51,8 @@ public: QAD_ViewFrame(QWidget* parent = 0); virtual ~QAD_ViewFrame(); + bool event ( QEvent* e ); + void cleanup(); virtual ViewType getTypeView() const = 0; @@ -128,6 +130,11 @@ public slots: 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 diff --git a/src/SALOMEGUI/QAD_msg_en.po b/src/SALOMEGUI/QAD_msg_en.po index feca9f9e5..631141152 100644 --- a/src/SALOMEGUI/QAD_msg_en.po +++ b/src/SALOMEGUI/QAD_msg_en.po @@ -333,6 +333,9 @@ msgstr "Viewer" msgid "MEN_VP3D_CHANGEBGR" msgstr "Change background..." +msgid "MEN_VP3D_DUMPVIEW" +msgstr "Camera Dump..." + msgid "MEN_APP_DISPLAY" msgstr "Display"