]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/XGUI/XGUI_PropertyPanel.cpp
Salome HOME
#1042 Sometimes when setting distance constraints, the input field is not displayed...
[modules/shaper.git] / src / XGUI / XGUI_PropertyPanel.cpp
index f75ca242bb7db523fdb59c0a5120dc2d64077cc2..762bde305e20d92063faad3d91103046076213a0 100755 (executable)
@@ -121,6 +121,9 @@ void XGUI_PropertyPanel::setModelWidgets(const QList<ModuleBase_ModelWidget*>& t
             this,    SLOT(activateNextWidget(ModuleBase_ModelWidget*)));
     connect(aWidget, SIGNAL(keyReleased(QKeyEvent*)),
             this,    SIGNAL(keyReleased(QKeyEvent*)));
+    connect(aWidget, SIGNAL(enterClicked()),
+            this,    SIGNAL(enterClicked()));
+
   }
 }
 
@@ -161,7 +164,7 @@ void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget)
 
   QList<ModuleBase_ModelWidget*>::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) {
@@ -192,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 {
@@ -214,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 {
@@ -224,7 +227,7 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext)
         aFirstControl = myWidgets[i]->getControlAcceptingFocus(true);
       if (aFirstControl && aFirstControl->hasFocus()) {
         QToolButton* aCancelBtn = findChild<QToolButton*>(PROP_PANEL_CANCEL);
-        aCancelBtn->setFocus();
+        ModuleBase_Tools::setFocus(aCancelBtn, "XGUI_PropertyPanel::focusNextPrevChild()");
         isChangedFocus = true;
       }
     }
@@ -243,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);
     }
   }
 }
@@ -260,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);
   }
@@ -276,7 +283,7 @@ bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget)
 void XGUI_PropertyPanel::setFocusOnOkButton()
 {
   QToolButton* anOkBtn = findChild<QToolButton*>(PROP_PANEL_OK);
-  anOkBtn->setFocus();
+  ModuleBase_Tools::setFocus(anOkBtn, "XGUI_PropertyPanel::setFocusOnOkButton()");
 }
 
 void XGUI_PropertyPanel::setCancelEnabled(bool theEnabled)