From: asl Date: Fri, 21 Mar 2008 08:38:08 +0000 (+0000) Subject: PAL18653: sub-menus are hidden always X-Git-Tag: V5_0_0a1~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8915562d3f6261024ea1f1e4e173ea1f7128525b;p=modules%2Fgui.git PAL18653: sub-menus are hidden always --- diff --git a/src/Qtx/QtxPopupMgr.cxx b/src/Qtx/QtxPopupMgr.cxx index 7725e8d6e..36ecc8011 100644 --- a/src/Qtx/QtxPopupMgr.cxx +++ b/src/Qtx/QtxPopupMgr.cxx @@ -366,6 +366,26 @@ int QtxPopupMgr::insertAction( QAction* a, const int pId, const QString& rule, c return res; } +/*! + \return true if action has rule of given type + \param a - action + \param t - rule type +*/ +bool QtxPopupMgr::hasRule( QAction* a, const RuleType t ) const +{ + return a ? expression( a, t, false ) : false; +} + +/*! + \return true if action with given id has rule of given type + \param id - action id + \param t - rule type +*/ +bool QtxPopupMgr::hasRule( const int id, const RuleType t ) const +{ + return hasRule( action( id ), t ); +} + /*! \brief Get rule of type \a type for the action \a a. \param a action @@ -528,7 +548,7 @@ bool QtxPopupMgr::isSatisfied( QAction* act, const RuleType ruleType ) const */ bool QtxPopupMgr::isVisible( const int id, const int place ) const { - return QtxActionMenuMgr::isVisible( id, place ) && isSatisfied( action( id ) ); + return QtxActionMenuMgr::isVisible( id, place ) && ( !hasRule( id ) || isSatisfied( action( id ) ) ); } /*! diff --git a/src/Qtx/QtxPopupMgr.h b/src/Qtx/QtxPopupMgr.h index 9759f8c95..5fc946eeb 100644 --- a/src/Qtx/QtxPopupMgr.h +++ b/src/Qtx/QtxPopupMgr.h @@ -66,6 +66,9 @@ public: void setRule( QAction*, const QString&, const RuleType = VisibleRule ); void setRule( const int, const QString&, const RuleType = VisibleRule ); + bool hasRule( QAction*, const RuleType = VisibleRule ) const; + bool hasRule( const int, const RuleType = VisibleRule ) const; + QtxPopupSelection* selection() const; void setSelection( QtxPopupSelection* );