Salome HOME
Fix regression in unit tests
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetChoice.cpp
index 4b09ffab63f7f6fd637f3132ca66ebb2789934a4..024b736788cdc5962c2c5ad6559c6b569635a706 100644 (file)
@@ -77,6 +77,7 @@ ModuleBase_WidgetChoice::ModuleBase_WidgetChoice(QWidget* theParent,
     }
     myButtons->button(0)->setChecked(true);
     connect(myButtons, SIGNAL(buttonClicked(int)), this, SLOT(onCurrentIndexChanged(int)));
+    connect(myButtons, SIGNAL(buttonClicked(int)), this, SIGNAL(itemSelected(int)));
   } else {
     myLabel = new QLabel(aLabelText, this);
     if (!aLabelIcon.isEmpty())
@@ -94,6 +95,7 @@ ModuleBase_WidgetChoice::ModuleBase_WidgetChoice(QWidget* theParent,
     myCombo->addItems(aList);
 
     connect(myCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged(int)));
+    connect(myCombo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(itemSelected(int)));
   }
 }
 
@@ -128,6 +130,7 @@ bool ModuleBase_WidgetChoice::restoreValueCustom()
       bool isBlocked = myButtons->blockSignals(true);
       myButtons->button(aIntAttr->value())->setChecked(true);
       myButtons->blockSignals(isBlocked);
+      emit itemSelected(aIntAttr->value());
     }
   }
   return true;
@@ -136,9 +139,9 @@ bool ModuleBase_WidgetChoice::restoreValueCustom()
 bool ModuleBase_WidgetChoice::focusTo()
 {
   if (myCombo)
-    myCombo->setFocus();
+    ModuleBase_Tools::setFocus(myCombo, "ModuleBase_WidgetChoice::focusTo()");
   else
-    myButtons->button(0)->setFocus();
+    return false;
   return true;
 }