Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / XGUI / XGUI_MainWindow.cpp
index a0cefc1d3e881a4ac865ae3de153f12786b4c4b6..4b8c9e0918f1ff863213d116d277b848b610dc39 100644 (file)
@@ -13,6 +13,7 @@
 #include <QAction>
 #include <QDockWidget>
 #include <QApplication>
+#include <QTimer>
 
 XGUI_MainWindow::XGUI_MainWindow(QWidget* parent)
     : QMainWindow(parent), 
@@ -171,15 +172,18 @@ void XGUI_MainWindow::activateView()
   QMdiArea* aMdiArea = static_cast<QMdiArea*>(centralWidget());
 
   QList<QMdiSubWindow*> aWndList = aMdiArea->subWindowList();
+  QMdiSubWindow* aTargetView = 0;
   foreach(QMdiSubWindow* aWnd, aWndList) {
     if (aWnd->windowTitle() == aWndTitle) {
       aWnd->raise();
       aWnd->activateWindow();
-      aWnd->setFocus();
+      aTargetView = aWnd;
       break;
     }
   }
   QApplication::processEvents();
+  if (aTargetView)
+    QTimer::singleShot(20, aTargetView, SLOT(setFocus()));
 }
 
 void XGUI_MainWindow::onViewActivated(QMdiSubWindow* theSubWnd)