Salome HOME
Merge branch 'python_parametric_api' of https://git.salome-platform.org/git/modules...
[modules/shaper.git] / src / XGUI / XGUI_HistoryMenu.cpp
index bfdae5390686816d58f6cd6fb00056083e99dccb..5f1ee6fa863020654cda263e5b691ff563ba7de6 100644 (file)
@@ -82,9 +82,23 @@ void XGUI_HistoryMenu::setStackSelectedTo(QListWidgetItem * theItem)
   myHistoryList->repaint();
 }
 
+void hideUpToMenuBar( QMenu* theMenu )
+{
+  theMenu->hide();
+  foreach( QWidget* aWidget, theMenu->menuAction()->associatedWidgets() )
+  {
+    QMenu* aMenu = qobject_cast<QMenu*>( aWidget );
+    if( aMenu )
+    {
+      aMenu->hide();
+      hideUpToMenuBar( aMenu );
+    }
+  }
+}
+
 void XGUI_HistoryMenu::onItemPressed(QListWidgetItem * theItem)
 {
   int selectedSize = myHistoryList->row(theItem) + 1;
   emit actionSelected(selectedSize);
-  hide();
+  hideUpToMenuBar( this );
 }