]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModuleBase/ModuleBase_PageWidget.cpp
Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom.git into Dev_1.1.0
[modules/shaper.git] / src / ModuleBase / ModuleBase_PageWidget.cpp
1 /*
2  * ModuleBase_PageWidget.cpp
3  *
4  *  Created on: Mar 4, 2015
5  *      Author: sbh
6  */
7
8 #include <ModuleBase_PageWidget.h>
9 #include <ModuleBase_ModelWidget.h>
10 #include <ModuleBase_Tools.h>
11
12 #include <QGridLayout>
13
14 ModuleBase_PageWidget::ModuleBase_PageWidget(QWidget* theParent)
15 : QFrame(theParent)
16 {
17   myMainLayout = new QGridLayout(this);
18   ModuleBase_Tools::adjustMargins(myMainLayout);
19   setLayout(myMainLayout);
20 }
21
22 ModuleBase_PageWidget::~ModuleBase_PageWidget()
23 {
24 }
25
26 void ModuleBase_PageWidget::addPageStretch()
27 {
28   myMainLayout->setRowStretch(myMainLayout->rowCount(), 1);
29 }
30
31 void ModuleBase_PageWidget::placeModelWidget(ModuleBase_ModelWidget* theWidget)
32 {
33   const int kCol = 0;
34   const int kRow = myMainLayout->count();
35   myMainLayout->addWidget(theWidget, kRow, kCol);
36 }
37
38 void ModuleBase_PageWidget::placePageWidget(ModuleBase_PageBase* theWidget)
39 {
40   QWidget* aWidget = dynamic_cast<QWidget*>(theWidget);
41   if (!aWidget) {
42     #ifdef _DEBUG
43     std::cout << "ModuleBase_PageWidget::placePageWidget: can not cast page" << std::endl;
44     #endif
45     return;
46   }
47   const int kCol = 0;
48   const int kRow = myMainLayout->count();
49   myMainLayout->addWidget(aWidget, kRow, kCol);//, Qt::AlignTop | Qt::AlignLeft);
50 }
51
52 QLayout* ModuleBase_PageWidget::pageLayout()
53 {
54   return myMainLayout;
55 }