From: apl Date: Mon, 26 Dec 2011 09:51:58 +0000 (+0000) Subject: QMenu signals triggered, hovered added for log purposes X-Git-Tag: CTH_1_7_3~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b533b5a97002eabf1e4f14fda1a2231c25146156;p=modules%2Fgui.git QMenu signals triggered, hovered added for log purposes --- diff --git a/src/Qtx/QtxActionMenuMgr.cxx b/src/Qtx/QtxActionMenuMgr.cxx index 94368536e..4ed236fcf 100644 --- a/src/Qtx/QtxActionMenuMgr.cxx +++ b/src/Qtx/QtxActionMenuMgr.cxx @@ -335,6 +335,8 @@ int QtxActionMenuMgr::insert( const QString& title, const int pId, const int gro connect( ma->menu(), SIGNAL( aboutToShow() ), this, SLOT( onAboutToShow() ) ); connect( ma->menu(), SIGNAL( aboutToHide() ), this, SLOT( onAboutToHide() ) ); + connect( ma->menu(), SIGNAL( triggered( QAction* ) ), this, SLOT( onTriggered( QAction* ) ) ); + connect( ma->menu(), SIGNAL( hovered( QAction* ) ), this, SLOT( onHovered( QAction* ) ) ); MenuNode* node = new MenuNode( pNode, myMenus.insert( gid, ma ).key(), idx, group ); @@ -586,6 +588,30 @@ void QtxActionMenuMgr::onAboutToHide() emit menuAboutToHide( m ); } +/*! + \brief Called when the action in menu is triggered + + Emits the signal menuTriggered(QMenu*, QAction*). +*/ +void QtxActionMenuMgr::onTriggered( QAction* theAction ) +{ + QMenu* m = ::qobject_cast( sender() ); + if( m ) + emit menuTriggered( m, theAction ); +} + +/*! + \brief Called when a menu action is highlighted + + Emits the signal menuHovered(QMenu*, QAction*). +*/ +void QtxActionMenuMgr::onHovered( QAction* theAction ) +{ + QMenu* m = ::qobject_cast( sender() ); + if( m ) + emit menuHovered( m, theAction ); +} + /*! \brief Called when the corresponding menu object is destroyed. diff --git a/src/Qtx/QtxActionMenuMgr.h b/src/Qtx/QtxActionMenuMgr.h index 6ee27cf61..d55626443 100644 --- a/src/Qtx/QtxActionMenuMgr.h +++ b/src/Qtx/QtxActionMenuMgr.h @@ -102,11 +102,15 @@ public: private slots: void onAboutToShow(); void onAboutToHide(); + void onTriggered( QAction* ); + void onHovered( QAction* ); void onDestroyed( QObject* ); signals: void menuAboutToShow( QMenu* ); void menuAboutToHide( QMenu* ); + void menuTriggered( QMenu*, QAction* ); + void menuHovered( QMenu*, QAction* ); protected: void setMenuWidget( QWidget* );