Salome HOME
Bugfixes for focus processing in the property panel
[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   myMainLayout->setRowStretch(kRow, 0);
37 }
38
39 void ModuleBase_PageWidget::placePageWidget(ModuleBase_PageBase* theWidget)
40 {
41   QWidget* aWidget = dynamic_cast<QWidget*>(theWidget);
42   if (!aWidget) {
43     #ifdef _DEBUG
44     std::cout << "ModuleBase_PageWidget::placePageWidget: can not cast page" << std::endl;
45     #endif
46     return;
47   }
48   const int kCol = 0;
49   const int kRow = myMainLayout->count();
50   myMainLayout->addWidget(aWidget, kRow, kCol);
51   myMainLayout->setRowStretch(kRow, 0);
52 }
53
54 QLayout* ModuleBase_PageWidget::pageLayout()
55 {
56   return myMainLayout;
57 }