2 * ModuleBase_PageBase.cpp
4 * Created on: Mar 4, 2015
8 #include <ModuleBase_PageBase.h>
9 #include <ModuleBase_ModelWidget.h>
15 ModuleBase_PageBase::ModuleBase_PageBase()
20 ModuleBase_PageBase::~ModuleBase_PageBase()
25 QWidget* ModuleBase_PageBase::pageWidget()
27 return dynamic_cast<QWidget*>(this);
30 void ModuleBase_PageBase::addModelWidget(ModuleBase_ModelWidget* theWidget)
32 placeModelWidget(theWidget);
33 myWidgetList.append(theWidget);
36 void ModuleBase_PageBase::addPageWidget(ModuleBase_PageBase* thePage)
38 placePageWidget(thePage);
41 void ModuleBase_PageBase::clearPage()
44 while ((aChild = pageLayout()->takeAt(0)) != 0) {
45 if(aChild->widget()) {
46 aChild->widget()->deleteLater();
55 bool ModuleBase_PageBase::takeFocus()
57 if(myWidgetList.isEmpty())
60 return myWidgetList.first()->focusTo();
63 QList<ModuleBase_ModelWidget*> ModuleBase_PageBase::modelWidgets()
68 void ModuleBase_PageBase::alignToTop()
70 bool hasExpanding = false;
71 QList<QWidget *> aListToCheck;
72 ModuleBase_ModelWidget* aModelWidget;
73 foreach(aModelWidget, myWidgetList) {
74 aListToCheck << aModelWidget->getControls();
76 foreach(QWidget* eachWidget, aListToCheck) {
77 QSizePolicy::Policy aVPolicy = eachWidget->sizePolicy().verticalPolicy();
78 if(aVPolicy & QSizePolicy::ExpandFlag) {