Salome HOME
Issue 1299 Angle constraint: support of additional and complementary angles. Test...
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetChoice.cpp
index 3fed3ea5f661fba5dba5b5305e58c7d6b239f96c..6c35d6627020c2ca5089fd3f749c2153ae7c1fd2 100644 (file)
@@ -22,9 +22,8 @@
 
 
 ModuleBase_WidgetChoice::ModuleBase_WidgetChoice(QWidget* theParent, 
-                                                 const Config_WidgetAPI* theData, 
-                                                 const std::string& theParentId)
-    : ModuleBase_ModelWidget(theParent, theData, theParentId), myCombo(0), myButtons(0)
+                                                 const Config_WidgetAPI* theData)
+: ModuleBase_ModelWidget(theParent, theData), myCombo(0), myButtons(0)
 {
   QHBoxLayout* aLayout = new QHBoxLayout(this);
   ModuleBase_Tools::adjustMargins(aLayout);
@@ -56,6 +55,7 @@ ModuleBase_WidgetChoice::ModuleBase_WidgetChoice(QWidget* theParent,
       int aId = 0;
       foreach(QString aBtnTxt, aList) {
         QToolButton* aBtn = new QToolButton(aGroupBox);
+        aBtn->setFocusPolicy(Qt::StrongFocus);
         aBtn->setCheckable(true);
         aBtn->setToolTip(aBtnTxt);
 
@@ -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,7 +139,7 @@ bool ModuleBase_WidgetChoice::restoreValueCustom()
 bool ModuleBase_WidgetChoice::focusTo()
 {
   if (myCombo)
-    myCombo->setFocus();
+    ModuleBase_Tools::setFocus(myCombo, "ModuleBase_WidgetChoice::focusTo()");
   else
     return false;
   return true;