]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issues #2173, #2169: Activate PropertyPanel window to accept focus always in double...
authornds <nds@opencascade.com>
Mon, 29 May 2017 12:38:34 +0000 (15:38 +0300)
committernds <nds@opencascade.com>
Mon, 29 May 2017 12:38:34 +0000 (15:38 +0300)
src/ModuleBase/ModuleBase_ModelWidget.cpp
src/XGUI/XGUI_PropertyPanel.cpp
src/XGUI/XGUI_Workshop.cpp

index 01eeccac4fd3e4de52231525e369edb932662dd7..c3efc6b30b840b1a20802463fb566921bc1e880f 100644 (file)
@@ -422,11 +422,7 @@ bool ModuleBase_ModelWidget::eventFilter(QObject* theObject, QEvent *theEvent)
 {
   QWidget* aWidget = qobject_cast<QWidget*>(theObject);
   if (theEvent->type() == QEvent::FocusIn) {
-    #ifdef _DEBUG
-    // The following two lines are for debugging purpose only
     QFocusEvent* aFocusEvent = dynamic_cast<QFocusEvent*>(theEvent);
-    bool isWinFocus = aFocusEvent->reason() == Qt::ActiveWindowFocusReason;
-    #endif
     Qt::FocusReason aReason = aFocusEvent->reason();
     bool aMouseOrKey = aReason == Qt::MouseFocusReason ||
                         /*aReason == Qt::TabFocusReason ||
@@ -479,6 +475,9 @@ ModuleBase_ModelWidget* ModuleBase_ModelWidget::findModelWidget(ModuleBase_IProp
                                                                 QWidget* theWidget)
 {
   ModuleBase_ModelWidget* aModelWidget;
+  if (!theWidget)
+    return aModelWidget;
+
   QObject* aParent = theWidget->parent();
   while (aParent) {
     aModelWidget = qobject_cast<ModuleBase_ModelWidget*>(aParent);
index 3ccea336032f6e8cb801e770ab07d61dcdcbb851..6128bf7a6b8c7a4c85134660c397c8da53122590 100755 (executable)
@@ -244,7 +244,7 @@ void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget,
 
   QList<ModuleBase_ModelWidget*>::const_iterator anIt = myWidgets.begin(), aLast = myWidgets.end();
   bool isFoundWidget = false;
-  //ModuleBase_Tools::activateWindow(this, "XGUI_PropertyPanel::activateNextWidget()");
+  ModuleBase_Tools::activateWindow(this, "XGUI_PropertyPanel::activateNextWidget()");
   for (; anIt != aLast; anIt++) {
     ModuleBase_ModelWidget* aCurrentWidget = *anIt;
     if (isFoundWidget || !theWidget) {
@@ -410,8 +410,8 @@ bool XGUI_PropertyPanel::focusNextPrevChild_(bool theIsNext)
       }
     }
 
-    //ModuleBase_Tools::setFocus(aNewFocusWidget, "XGUI_PropertyPanel::focusNextPrevChild()");
-    aNewFocusWidget->setFocus(theIsNext ? Qt::TabFocusReason : Qt::BacktabFocusReason);
+    ModuleBase_Tools::setFocus(aNewFocusWidget, "XGUI_PropertyPanel::focusNextPrevChild()");
+    //aNewFocusWidget->setFocus(theIsNext ? Qt::TabFocusReason : Qt::BacktabFocusReason);
 
     ModuleBase_ModelWidget* aNewFocusMWidget = ModuleBase_ModelWidget::findModelWidget(this,
                                                                               aNewFocusWidget);
index abbc09841816ef5ebd14489893ba186a1b4efbef..855abacc1a005df52eb3dc1f472729e95ba88dc8 100755 (executable)
@@ -1275,7 +1275,7 @@ void XGUI_Workshop::showPropertyPanel()
   // in order to operation manager could process key events of the panel.
   // otherwise they are ignored. It happens only if the same(activateWindow) is
   // not happened by property panel activation(e.g. resume operation of Sketch)
-  //ModuleBase_Tools::activateWindow(myPropertyPanel, "XGUI_Workshop::showPropertyPanel()");
+  ModuleBase_Tools::activateWindow(myPropertyPanel, "XGUI_Workshop::showPropertyPanel()");
   ModuleBase_Tools::setFocus(myPropertyPanel, "XGUI_Workshop::showPropertyPanel()");
 }
 
@@ -1294,9 +1294,9 @@ void XGUI_Workshop::hidePropertyPanel()
   // set the focus on it. As a result, shortcuts of the application, like
   // are processed by this console. For example Undo actions.
   // It is possible that this code is to be moved to SHAPER package
-  //QMainWindow* aDesktop = desktop();
-  //ModuleBase_Tools::activateWindow(aDesktop, "XGUI_Workshop::hidePropertyPanel()");
-  //ModuleBase_Tools::setFocus(aDesktop, "XGUI_Workshop::showPropertyPanel()");
+  QMainWindow* aDesktop = desktop();
+  ModuleBase_Tools::activateWindow(aDesktop, "XGUI_Workshop::hidePropertyPanel()");
+  ModuleBase_Tools::setFocus(aDesktop, "XGUI_Workshop::showPropertyPanel()");
 }
 
 //******************************************************