Salome HOME
Doxygen warning fixes
[modules/shaper.git] / src / ModuleBase / ModuleBase_PageBase.cpp
index dac665edd3fbb0fd089e2c90e43ca7c14156d3b2..ed9fb7694031d374eb4120e8ee216a60a9afe5bd 100644 (file)
@@ -40,24 +40,39 @@ void ModuleBase_PageBase::addPageWidget(ModuleBase_PageBase* thePage)
 
 void ModuleBase_PageBase::clearPage()
 {
+  myWidgetList.clear();
+
   QLayoutItem *aChild;
   while ((aChild = pageLayout()->takeAt(0)) != 0) {
     if(aChild->widget()) {
-      aChild->widget()->deleteLater();
+      delete aChild->widget();
     } else {
       delete aChild;
     }
   }
-  myWidgetList.clear();
+
+  // Issue #460: this patch is necessary since the row stretch information
+  // is stored independently on the items: when the items are removed
+  // from the layout the stretch information is kept, so in the next 
+  // filling of the layout some "additional" (old) rows may be stretched
+  // without necessity. 
+  // In this patch we clear the stretch information specifying the default value: 0.
+  QGridLayout* aLayout = dynamic_cast<QGridLayout*>( pageLayout() );
+  if( aLayout )
+  {
+    int r = aLayout->rowCount();
+    for( int i=0; i<r; i++ )
+      aLayout->setRowStretch( i, 0 );
+  }
 }
 
 
-void ModuleBase_PageBase::takeFocus()
+bool ModuleBase_PageBase::takeFocus()
 {
   if(myWidgetList.isEmpty())
-    return;
+    return false;
 
-  myWidgetList.first()->focusTo();
+  return myWidgetList.first()->focusTo();
 }
 
 QList<ModuleBase_ModelWidget*> ModuleBase_PageBase::modelWidgets()