Salome HOME
Issue #1854 Recover feature control update
[modules/shaper.git] / src / ModuleBase / ModuleBase_PageBase.cpp
index f7057783e2633f072be18742f01f11fdd0b6f77f..daf1bd034e5dbf61f8b64047e6d61f51659e161b 100644 (file)
@@ -1,3 +1,4 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
 /*
  * ModuleBase_PageBase.cpp
  *
@@ -38,12 +39,19 @@ void ModuleBase_PageBase::addPageWidget(ModuleBase_PageBase* thePage)
   placePageWidget(thePage);
 }
 
+void ModuleBase_PageBase::addWidget(QWidget* theWidget)
+{
+  placeWidget(theWidget);
+}
+
 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;
     }
@@ -51,9 +59,9 @@ void ModuleBase_PageBase::clearPage()
 
   // 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 
+  // 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. 
+  // without necessity.
   // In this patch we clear the stretch information specifying the default value: 0.
   QGridLayout* aLayout = dynamic_cast<QGridLayout*>( pageLayout() );
   if( aLayout )
@@ -62,7 +70,6 @@ void ModuleBase_PageBase::clearPage()
     for( int i=0; i<r; i++ )
       aLayout->setRowStretch( i, 0 );
   }
-  myWidgetList.clear();
 }
 
 
@@ -74,7 +81,7 @@ bool ModuleBase_PageBase::takeFocus()
   return myWidgetList.first()->focusTo();
 }
 
-QList<ModuleBase_ModelWidget*> ModuleBase_PageBase::modelWidgets()
+QList<ModuleBase_ModelWidget*> ModuleBase_PageBase::modelWidgets() const
 {
   return myWidgetList;
 }
@@ -98,3 +105,9 @@ void ModuleBase_PageBase::alignToTop()
     addPageStretch();
   }
 }
+
+void ModuleBase_PageBase::placePageWidget(ModuleBase_PageBase* theWidget)
+{
+  QWidget* aWidget = dynamic_cast<QWidget*>(theWidget);
+  placeWidget(aWidget);
+}