X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_PageBase.cpp;h=027150f22426c45f4538ea262119d8399c3abe91;hb=cdc2caa21375bc96aaad9bb7c3ee1140dac1d738;hp=5adaebf34b668d7f365c883dae5cdeaef8d90488;hpb=3baa523772616910e6fb91a52306e7cb2d9e9468;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_PageBase.cpp b/src/ModuleBase/ModuleBase_PageBase.cpp index 5adaebf34..027150f22 100644 --- a/src/ModuleBase/ModuleBase_PageBase.cpp +++ b/src/ModuleBase/ModuleBase_PageBase.cpp @@ -22,6 +22,11 @@ ModuleBase_PageBase::~ModuleBase_PageBase() } +QWidget* ModuleBase_PageBase::pageWidget() +{ + return dynamic_cast(this); +} + void ModuleBase_PageBase::addModelWidget(ModuleBase_ModelWidget* theWidget) { placeModelWidget(theWidget); @@ -35,20 +40,47 @@ void ModuleBase_PageBase::addPageWidget(ModuleBase_PageBase* thePage) void ModuleBase_PageBase::clearPage() { - qDeleteAll(pageLayout()->children()); + QLayoutItem *aChild; + while ((aChild = pageLayout()->takeAt(0)) != 0) { + if(aChild->widget()) { + aChild->widget()->deleteLater(); + } else { + delete aChild; + } + } myWidgetList.clear(); } -void ModuleBase_PageBase::takeFocus() +bool ModuleBase_PageBase::takeFocus() { if(myWidgetList.isEmpty()) - return; + return false; - myWidgetList.first()->focusTo(); + return myWidgetList.first()->focusTo(); } QList ModuleBase_PageBase::modelWidgets() { return myWidgetList; } + +void ModuleBase_PageBase::alignToTop() +{ + bool hasExpanding = false; + QList aListToCheck; + ModuleBase_ModelWidget* aModelWidget; + foreach(aModelWidget, myWidgetList) { + aListToCheck << aModelWidget->getControls(); + } + foreach(QWidget* eachWidget, aListToCheck) { + QSizePolicy::Policy aVPolicy = eachWidget->sizePolicy().verticalPolicy(); + if(aVPolicy & QSizePolicy::ExpandFlag) { + hasExpanding = true; + break; + } + } + if(!hasExpanding) { + addPageStretch(); + } +}