]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
add tab window programmatically activation methods for QtxWorkstack, STD_TabDesktop
authorapl <apl@opencascade.com>
Tue, 12 Mar 2013 08:12:54 +0000 (08:12 +0000)
committerapl <apl@opencascade.com>
Tue, 12 Mar 2013 08:12:54 +0000 (08:12 +0000)
src/Qtx/QtxWorkstack.cxx
src/Qtx/QtxWorkstack.h
src/STD/STD_TabDesktop.cxx
src/STD/STD_TabDesktop.h

index 5f0909694815a0f7541b44a80f361f712834fac2..efd9859c53a6e7664d80424e002e2f1ee3a0947c 100644 (file)
@@ -2542,6 +2542,31 @@ void QtxWorkstack::splitHorizontal()
   split( Qt::Vertical );
 }
 
+/*!
+  \brief Activates window, make its container tab active.
+  \param theWnd window to activate.
+*/
+void QtxWorkstack::setActiveWindow( QWidget* theWnd )
+{
+  QtxWorkstackArea* aWndArea = wgArea( theWnd );
+  if ( aWndArea == 0 )
+    return;
+
+  aWndArea->setActiveWidget( theWnd );
+
+  QWidget* aCurrFocus = QApplication::focusWidget();
+  if ( !theWnd->isAncestorOf( aCurrFocus ) )
+  {
+    QWidget* aLastSubFocus = theWnd->focusWidget();
+    if ( aLastSubFocus )
+      aLastSubFocus->setFocus();
+    else
+      theWnd->setFocus();
+  }
+
+  setActiveArea( aWndArea );
+}
+
 /*!
   \brief Called when user activates "Rename" menu item.
 
index 36a40ed0c68949e6c0ca49028044b0cd4f29069b..7648704dc62920f8805dcdcd464bde3d83eac4cb 100644 (file)
@@ -126,6 +126,7 @@ signals:
 public slots:
   void                splitVertical();
   void                splitHorizontal();
+  void                setActiveWindow( QWidget* );
 
 private slots:
   void                onRename();
index 780359e029ac9dd943f63dc53f32238e76bc3122..9d0d5cc6cd3a5d01dd97a7a998723c9ca1375465 100644 (file)
@@ -174,6 +174,15 @@ QtxWorkstack* STD_TabDesktop::workstack() const
   return myWorkstack;
 }
 
+/*!
+  \brief set subwindow of the desktop to be the active one.
+  \param theWnd the window to be set as active.
+*/
+void STD_TabDesktop::setActiveWindow( QWidget* theWnd )
+{
+  workstack()->setActiveWindow( theWnd );
+}
+
 /*!
   Emit window activated.
 */
index f05bbe399edebca325e1aba664630b8b7f8ffcb3..d08caa6f85a6cb42f6cb3c6dccccd8bd38edc95f 100644 (file)
@@ -55,6 +55,9 @@ public:
 
   QtxWorkstack*            workstack() const;
 
+public slots:
+  void                     setActiveWindow( QWidget* );
+
 private slots:
   void                     onWindowActivated( QWidget* );