From: nds Date: Mon, 29 May 2017 12:38:34 +0000 (+0300) Subject: Issues #2173, #2169: Activate PropertyPanel window to accept focus always in double... X-Git-Tag: V_2.7.1.1~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6c2dd8666c7e78cb8558c89d3f4bae7f2b07dad0;p=modules%2Fshaper.git Issues #2173, #2169: Activate PropertyPanel window to accept focus always in double editor(even after click in the viewer) --- diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index 01eeccac4..c3efc6b30 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -422,11 +422,7 @@ bool ModuleBase_ModelWidget::eventFilter(QObject* theObject, QEvent *theEvent) { QWidget* aWidget = qobject_cast(theObject); if (theEvent->type() == QEvent::FocusIn) { - #ifdef _DEBUG - // The following two lines are for debugging purpose only QFocusEvent* aFocusEvent = dynamic_cast(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(aParent); diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index 3ccea3360..6128bf7a6 100755 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -244,7 +244,7 @@ void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget, QList::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); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index abbc09841..855abacc1 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -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()"); } //******************************************************