Salome HOME
Modify default icon for the module
[modules/gui.git] / src / Qtx / QtxWorkstack.cxx
index 8fd98059c62a79fd554dc04eb9c82705478f0dde..2ca7b819ab1edbfa2565d23a6fb8bd3d62c12508 100644 (file)
@@ -244,9 +244,12 @@ void QtxWorkstack::onDeactivated( QtxWorkstackArea* area )
   if ( idx == -1 )
     return;
 
+  myWin = 0;
+  myArea = 0;
+
   QtxWorkstackArea* newArea = neighbourArea( area );
-  if ( newArea )
-    newArea->setFocus();
+  if ( newArea && newArea->activeWidget() )
+    newArea->activeWidget()->setFocus();
 
   QApplication::postEvent( this, new QCustomEvent( QEvent::User ) );
 }
@@ -491,6 +494,9 @@ void QtxWorkstack::updateState( QSplitter* split )
   if ( split == mySplit )
     return;
 
+  for ( QPtrListIterator<QSplitter> iter( splitList ); iter.current() && !vis; ++iter )
+    vis = iter.current()->isVisibleTo( iter.current()->parentWidget() );
+
   if ( areaList.isEmpty() && splitList.isEmpty() )
     delete split;
   else if ( vis )
@@ -701,7 +707,7 @@ bool QtxWorkstackArea::eventFilter( QObject* o, QEvent* e )
         wid = wid->parentWidget();
       }
       if ( ok )
-        QApplication::postEvent( this, new QCustomEvent( (QEvent::Type)( e->type() == QEvent::FocusIn ? ActivateEvent : FocusEvent ) ) );
+        QApplication::postEvent( this, new QCustomEvent( (QEvent::Type)( e->type() == QEvent::FocusIn ? ActivateWidget : FocusWidget ) ) );
     }
   }
   return false;
@@ -734,14 +740,14 @@ void QtxWorkstackArea::customEvent( QCustomEvent* e )
 {
   switch ( e->type() )
   {
-  case ActivateEvent:
+  case ActivateWidget:
     emit activated( activeWidget() );
     break;
-  case FocusEvent:
-    if ( activeWidget() )
+  case FocusWidget:
+    if ( activeWidget() && !activeWidget()->focusWidget() )
       activeWidget()->setFocus();
     break;
-  case RemoveEvent:
+  case RemoveWidget:
     removeWidget( (QWidget*)e->data() );
     break;
   }
@@ -798,7 +804,7 @@ void QtxWorkstackArea::onChildDestroyed( QObject* obj )
 
   myChild.remove( wid );
 
-  QApplication::postEvent( this, new QCustomEvent( (QEvent::Type)RemoveEvent, wid ) );
+  QApplication::postEvent( this, new QCustomEvent( (QEvent::Type)RemoveWidget, wid ) );
 }
 
 void QtxWorkstackArea::onChildShown( QtxWorkstackChild* c )