From 7da0c41173b75f113e94c6e6b3a1ea8f8772a347 Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Wed, 18 Jan 2017 16:24:48 +0100 Subject: [PATCH] add method QWidget* getViewWidget( const int ) --- src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx | 27 +++++++++++++++++++++++ src/SALOME_PYQT/SalomePyQt/SalomePyQt.h | 1 + src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip | 1 + 3 files changed, 29 insertions(+) diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx index 67c57f31d..81f274046 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -2850,6 +2850,33 @@ bool SalomePyQt::activateView( const int id ) return ProcessEvent( new TActivateView( id ) ); } +/*! + * + */ + +class TGetViewWidget: public SALOME_Event +{ +public: + typedef QWidget* TResult; + TResult myResult; + int myWndId; + TGetViewWidget( const int id ) + : myResult( 0 ), + myWndId( id ) {} + virtual void Execute() + { + SUIT_ViewWindow* wnd = getWnd( myWndId ); + if ( wnd ) { + myResult = (QWidget*)wnd; + } + } +}; +QWidget* SalomePyQt::getViewWidget( const int id) +{ + return ProcessEvent( new TGetViewWidget( id ) ); +} + + /*! \fn int SalomePyQt::createView( const QString& type, bool visible = true, const int width = 0, const int height = 0 ); \brief Create new view and activate it diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h index 4194fa3b6..dac525e79 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h @@ -287,6 +287,7 @@ public: static bool setViewSize( const int, const int, const int = 0 ); static QList findViews( const QString& ); static bool activateView( const int ); + static QWidget* getViewWidget( const int ); static int createView( const QString&, bool visible = true, const int width = 0, const int height = 0 ); static int createView( const QString&, QWidget* ); static bool closeView( const int ); diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip index c481c2444..cc09d9038 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip @@ -404,6 +404,7 @@ public: static bool setViewSize( const int, const int, const int = 0 ) /ReleaseGIL/ ; static QList findViews( const QString& ) /ReleaseGIL/ ; static bool activateView( const int ) /ReleaseGIL/ ; + static QWidget* getViewWidget( const int ) /ReleaseGIL/ ; static int createView( const QString&, bool visible = true, const int width = 0, const int height = 0 ) /ReleaseGIL/ ; static int createView( const QString&, QWidget* ) /ReleaseGIL/ ; static bool closeView( const int ) /ReleaseGIL/ ; -- 2.39.2