From: vsr Date: Thu, 24 Nov 2011 09:13:52 +0000 (+0000) Subject: Merge from V6_1_BR 24/11/2011 (TRIPOLI debug) X-Git-Tag: V6_4_0rc1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=832e012183bc87c8420f414fed824de11c77357f;p=modules%2Fgui.git Merge from V6_1_BR 24/11/2011 (TRIPOLI debug) --- diff --git a/src/LightApp/LightApp_ModuleAction.cxx b/src/LightApp/LightApp_ModuleAction.cxx index d178991d3..4f7b136a2 100755 --- a/src/LightApp/LightApp_ModuleAction.cxx +++ b/src/LightApp/LightApp_ModuleAction.cxx @@ -25,6 +25,8 @@ #include #include #include +#include +#include /*! \class LightApp_ModuleAction::ActionSet @@ -181,6 +183,23 @@ QWidget* LightApp_ModuleAction::ComboAction::createWidget( QWidget* parent ) \param item identifier */ +/*! + \class LightApp_ModuleAction::ActivateEvent + \brief Internal class to represent custom event for transfer the activation item id. + \internal +*/ +class LightApp_ModuleAction::ActivateEvent : public QEvent +{ +public: + ActivateEvent( QEvent::Type type, int id ) : QEvent( type ), myId( id ) {}; + ~ActivateEvent() {}; + + int id() const { return myId; } + +private: + int myId; +}; + /*! \class LightApp_ModuleAction \brief An action, representing the list of modules to be inserted to the @@ -413,6 +432,19 @@ void LightApp_ModuleAction::removedFrom( QWidget* w ) w->removeAction( mySet ); } +/*! + \brief Perform delayed activation with specified id. + \param e custom event + \return \c true if the event was processed successfully and \c false otherwise. +*/ +bool LightApp_ModuleAction::event( QEvent* e ) +{ + if ( e->type() == QEvent::MaxUser ) + activate( ((ActivateEvent*)e)->id(), false ); + else + return QtxAction::event( e ); +} + /*! \fn void LightApp_ModuleAction::moduleActivated( const QString& name ); \brief Emitted when the module is activated @@ -568,5 +600,5 @@ void LightApp_ModuleAction::onChanged() */ void LightApp_ModuleAction::onComboActivated( int id ) { - activate( id, false ); + QApplication::postEvent( this, new ActivateEvent( QEvent::MaxUser, id ) ); } diff --git a/src/LightApp/LightApp_ModuleAction.h b/src/LightApp/LightApp_ModuleAction.h index c170e1b38..8c6bdd31c 100755 --- a/src/LightApp/LightApp_ModuleAction.h +++ b/src/LightApp/LightApp_ModuleAction.h @@ -40,6 +40,7 @@ class LIGHTAPP_EXPORT LightApp_ModuleAction : public QtxAction private: class ActionSet; class ComboAction; + class ActivateEvent; public: enum { None = 0x00, Buttons = 0x01, ComboItem = 0x02, All = Buttons | ComboItem }; @@ -67,6 +68,8 @@ protected: virtual void addedTo( QWidget* ); virtual void removedFrom( QWidget* ); + virtual bool event( QEvent* ); + signals: void moduleActivated( const QString& ); @@ -99,11 +102,11 @@ public: QList widgets() const; -protected: - virtual QWidget* createWidget( QWidget* ); - signals: void activatedId( int ); + +protected: + virtual QWidget* createWidget( QWidget* ); }; #endif // LIGHTAPP_MODULEACTION_H