Salome HOME
Issue #810: hide "Edit" menu after undo/redo
authorasl <asl@opencascade.com>
Tue, 18 Aug 2015 07:11:00 +0000 (10:11 +0300)
committerasl <asl@opencascade.com>
Tue, 18 Aug 2015 08:58:43 +0000 (11:58 +0300)
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 );
 }