Salome HOME
allow submenus in popups
authorCédric Aguerre <cedric.aguerre@edf.fr>
Mon, 20 Jul 2015 09:38:20 +0000 (11:38 +0200)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Mon, 20 Jul 2015 09:38:20 +0000 (11:38 +0200)
src/GuiHelpers/StandardApp_Module.cxx
src/GuiHelpers/StandardApp_Module.hxx

index c27a1a6e35e02a5dd5bbe834b5ccdc803d8a0326..d32468702da0627c80f82e3562757a9f8dd4daa4 100644 (file)
@@ -169,14 +169,17 @@ void StandardApp_Module::addActionInMenubar(int actionId, int menuId) {
  * Add the specified action as an item in the popup menu, with the
  * specified visible rule. The default is "visible for object browser".
  */
-void StandardApp_Module::addActionInPopupMenu(int actionId,const QString& rule) {
+void StandardApp_Module::addActionInPopupMenu(int actionId,const QString& menus,const QString& rule) {
   // _GBO_ for a fine customization of the rule (for example with a
   // test on the type of the selected object), see the LIGTH module:
   // implement "LightApp_Selection*    createSelection() const;"
   int parentId = -1;
   QtxPopupMgr* mgr = this->popupMgr();
   this->action( actionId )->setIconVisibleInMenu(true);
-  mgr->insert ( this->action( actionId ), parentId, 0 );
+  if (! menus.isEmpty())
+    mgr->insert ( this->action( actionId ), menus, parentId, 0 );
+  else
+    mgr->insert ( this->action( actionId ), parentId, 0 );
   mgr->setRule( this->action( actionId ), rule, QtxPopupMgr::VisibleRule );
 }
 
index b3177daf599b03b0df0cc79b2f4a171029f42e7d..26acb0e2c1cf4a6e612f531876ff23d2b276a296 100644 (file)
@@ -16,7 +16,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// Author : Guillaume Boulant (EDF) 
+// Author : Guillaume Boulant (EDF)
 
 #ifndef _STANDARDAPP_MODULE_HXX_
 #define _STANDARDAPP_MODULE_HXX_
@@ -86,7 +86,7 @@ public slots:
 public:
   /* Creates an action with standard default values */
   int createStandardAction(const QString& label,
-                          QObject * slotobject,
+                           QObject * slotobject,
                            const char* slotmember,
                            const QString& iconName=QString(),
                            const QString& tooltip=QString(),
@@ -94,7 +94,7 @@ public:
 
   void addActionInToolbar(int actionId);
   void addActionInMenubar(int actionId, int menuId=UNSPECIFIED_INT);
-  void addActionInPopupMenu(int actionId,const QString& rule="client='ObjectBrowser'");
+  void addActionInPopupMenu(int actionId,const QString& menus="",const QString& rule="client='ObjectBrowser'");
 
 protected:
   /* Implement this to create additionnal widget (e.g. docked widget) */
@@ -125,7 +125,7 @@ protected:
   };
   virtual void setDockLayout(DockLayoutType layoutType);
   virtual void unsetDockLayout();
-  
+
   SUIT_ResourceMgr* _resourceMgr;
   int _defaultMenuId;
   int _defaultToolbarId;