X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_PropertyPanel.cpp;h=413059e2ab41c545f4c3e723f52e43799ee7e2b8;hb=2b21081bbbd86d0432cc408a1194df7804143209;hp=097d9145d8dd7679b6aa59e3b3f6d9eb09a6b26a;hpb=694c3ff1a0449659db85d40303428e6add7cc2c1;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index 097d9145d..413059e2a 100755 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -16,6 +16,9 @@ #include #include +#include +#include + #include #include #include @@ -118,8 +121,9 @@ void XGUI_PropertyPanel::setModelWidgets(const QList& t this, SLOT(activateNextWidget(ModuleBase_ModelWidget*))); connect(aWidget, SIGNAL(keyReleased(QKeyEvent*)), this, SIGNAL(keyReleased(QKeyEvent*))); - //connect(aWidget, SIGNAL(focusNextPrev()), - // this, SLOT(onFocusNextPrev())); + connect(aWidget, SIGNAL(enterClicked()), + this, SIGNAL(enterClicked())); + } } @@ -156,12 +160,19 @@ void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget) activateWidget(NULL); return; } + ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators(); + QList::const_iterator anIt = myWidgets.begin(), aLast = myWidgets.end(); bool isFoundWidget = false; - activateWindow(); + ModuleBase_Tools::activateWindow(this, "XGUI_PropertyPanel::activateNextWidget()"); for (; anIt != aLast; anIt++) { + ModuleBase_ModelWidget* aCurrentWidget = *anIt; if (isFoundWidget || !theWidget) { - if ((*anIt)->focusTo()) { + + if (!aValidators->isCase(aCurrentWidget->feature(), aCurrentWidget->attributeID())) + continue; // this attribute is not participated in the current case + + if (aCurrentWidget->focusTo()) { return; } } @@ -170,11 +181,6 @@ void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget) activateWidget(NULL); } -void XGUI_PropertyPanel::onFocusNextPrev() -{ - setActiveWidget(NULL); -} - bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) { // it wraps the Tabs clicking to follow in the chain: @@ -189,7 +195,7 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) for (int i = 0, aSize = myWidgets.size(); i < aSize && !aFirstControl; i++) aFirstControl = myWidgets[i]->getControlAcceptingFocus(true); if (aFirstControl) - aFirstControl->setFocus(); + ModuleBase_Tools::setFocus(aFirstControl, "XGUI_PropertyPanel::focusNextPrevChild()"); isChangedFocus = true; } else { @@ -211,7 +217,7 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) for (int i = myWidgets.size()-1; i >= 0 && !aLastControl; i--) aLastControl = myWidgets[i]->getControlAcceptingFocus(false); if (aLastControl) - aLastControl->setFocus(); + ModuleBase_Tools::setFocus(aLastControl, "XGUI_PropertyPanel::focusNextPrevChild()"); isChangedFocus = true; } else { @@ -221,7 +227,7 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) aFirstControl = myWidgets[i]->getControlAcceptingFocus(true); if (aFirstControl && aFirstControl->hasFocus()) { QToolButton* aCancelBtn = findChild(PROP_PANEL_CANCEL); - aCancelBtn->setFocus(); + ModuleBase_Tools::setFocus(aCancelBtn, "XGUI_PropertyPanel::focusNextPrevChild()"); isChangedFocus = true; } } @@ -240,13 +246,15 @@ void XGUI_PropertyPanel::activateNextWidget() void XGUI_PropertyPanel::activateWidget(ModuleBase_ModelWidget* theWidget) { + std::string aPreviosAttributeID; + if(myActiveWidget) + aPreviosAttributeID = myActiveWidget->attributeID(); + // Avoid activation of already actve widget. It could happen on focusIn event many times if (setActiveWidget(theWidget)) { - if (myActiveWidget) { - emit widgetActivated(myActiveWidget); - } else if (!isEditingMode()) { - emit noMoreWidgets(); - setFocusOnOkButton(); + emit widgetActivated(myActiveWidget); + if (!myActiveWidget && !isEditingMode()) { + emit noMoreWidgets(aPreviosAttributeID); } } } @@ -257,7 +265,9 @@ bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget) if (theWidget == myActiveWidget) { return false; } + std::string aPreviosAttributeID; if(myActiveWidget) { + aPreviosAttributeID = myActiveWidget->attributeID(); myActiveWidget->deactivate(); myActiveWidget->setHighlighted(false); } @@ -273,7 +283,7 @@ bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget) void XGUI_PropertyPanel::setFocusOnOkButton() { QToolButton* anOkBtn = findChild(PROP_PANEL_OK); - anOkBtn->setFocus(); + ModuleBase_Tools::setFocus(anOkBtn, "XGUI_PropertyPanel::setFocusOnOkButton()"); } void XGUI_PropertyPanel::setCancelEnabled(bool theEnabled) @@ -324,8 +334,7 @@ void XGUI_PropertyPanel::closeEvent(QCloseEvent* theEvent) { ModuleBase_Operation* aOp = myOperationMgr->currentOperation(); if (aOp) { - if (myOperationMgr->canStopOperation(aOp)) { - myOperationMgr->abortAllOperations(); + if (myOperationMgr->abortAllOperations()) { theEvent->accept(); } else theEvent->ignore();