Salome HOME
suite
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetOptionalBox.cpp
index 656bb73099780db3458f8210fdb386f505559042..93a11f902b4bc250395487b25098318eb2aeb4cf 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -54,6 +54,7 @@ ModuleBase_WidgetOptionalBox::ModuleBase_WidgetOptionalBox(QWidget* theParent,
 
   myHaveFrame = theData->getBooleanAttribute("has_frame", true);
   myEnableOnCheck = theData->getBooleanAttribute("enable_on_check", true);
+  myAlwaysShowTitle = theData->getBooleanAttribute("show_title", false);
 
   bool isChecked = theData->getBooleanAttribute(ATTR_DEFAULT, false);
   setDefaultValue(isChecked ? "true" : "false");
@@ -92,8 +93,9 @@ void ModuleBase_WidgetOptionalBox::onPageClicked()
   storeValue();
   updateControlsVisibility();
 
-  if (!isEditingMode())
-    emit focusOutWidget(this);
+  // The widget doesn't accept a focus
+  //if (!isEditingMode())
+  //  emit focusOutWidget(this);
 }
 
 void ModuleBase_WidgetOptionalBox::addPageStretch()
@@ -201,7 +203,10 @@ void ModuleBase_WidgetOptionalBox::createControl(const OptionType& theType)
 
     myCheckBoxLayout = new QHBoxLayout(myCheckBoxFrame);
     ModuleBase_Tools::adjustMargins(myCheckBoxLayout);
-    myCheckBox = new QCheckBox(myCheckBoxFrame);
+    if (myAlwaysShowTitle)
+      myCheckBox = new QCheckBox(translate(myGroupTitle), myCheckBoxFrame);
+    else
+      myCheckBox = new QCheckBox(myCheckBoxFrame);
     myCheckBox->setChecked(getDefaultValue() == "true");
     myCheckBoxLayout->addWidget(myCheckBox);