From: abn Date: Thu, 14 Apr 2016 09:16:12 +0000 (+0200) Subject: SALOME_Session_Server indicating to SUIT_Application when X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=89237f665f704cc8879e00a89419990f962738e3;p=modules%2Fgui.git SALOME_Session_Server indicating to SUIT_Application when the main event loop is starting. Useful for QtTesting tests in MED module. --- diff --git a/src/SUIT/SUIT_Application.cxx b/src/SUIT/SUIT_Application.cxx index 95a42da89..50f5f8c08 100755 --- a/src/SUIT/SUIT_Application.cxx +++ b/src/SUIT/SUIT_Application.cxx @@ -58,7 +58,8 @@ SUIT_Application::SUIT_Application() : QObject( 0 ), myStudy( 0 ), myDesktop( 0 ), - myStatusLabel( 0 ) + myStatusLabel( 0 ), + myEventLoopStarted(false) { if ( SUIT_Session::session() ) SUIT_Session::session()->insertApplication( this ); @@ -727,3 +728,10 @@ void SUIT_Application::onHelpContextModule( const QString& /*theComponentName*/, const QString& /*theContext*/ ) { } + + +void SUIT_Application::onMainEventLoopStarting() +{ + myEventLoopStarted = true; + emit mainEventLoopStarting(); +} diff --git a/src/SUIT/SUIT_Application.h b/src/SUIT/SUIT_Application.h index a9225c3f9..6400a4907 100755 --- a/src/SUIT/SUIT_Application.h +++ b/src/SUIT/SUIT_Application.h @@ -115,16 +115,19 @@ public: virtual int viewManagerId ( const SUIT_ViewManager* ) const = 0; virtual void viewManagers( const QString&, QList& ) const = 0; QAction* action( const int ) const; + bool isMainEventLoopStarted() const { return myEventLoopStarted; } signals: void applicationClosed( SUIT_Application* ); void activated( SUIT_Application* ); // void moving(); void infoChanged( QString ); + void mainEventLoopStarting(); public slots: virtual void updateCommandsStatus(); virtual void onHelpContextModule( const QString&, const QString&, const QString& = QString() ); + virtual void onMainEventLoopStarting(); private slots: void onInfoClear(); @@ -191,6 +194,8 @@ private: SUIT_ShortcutMgr* myShortcutMgr; QLabel* myStatusLabel; + + bool myEventLoopStarted; }; //! This function must return a new application instance. diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index d84b326b9..919075243 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -77,6 +77,7 @@ #include #include #include +#include /*! - read arguments, define list of server to launch with their arguments. * - wait for naming service @@ -577,6 +578,9 @@ int main( int argc, char **argv ) if ( splash ) splash->finish( aGUIApp->desktop() ); + // Post an event that will be processed as soon as the main event loop is starting - useful for QtTesting + // test scenarios, in the MED module for example. + QTimer::singleShot(0, aGUIApp, SLOT(onMainEventLoopStarting())); result = _qappl.exec(); splash = 0;