Salome HOME
Issue #1383 Preview button: correction for the case: switch off auto_preview in extru...
[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 #include <iostream>
15
16 ModuleBase_PageWidget::ModuleBase_PageWidget(QWidget* theParent)
17 : QFrame(theParent)
18 {
19   myMainLayout = new QGridLayout(this);
20   ModuleBase_Tools::adjustMargins(myMainLayout);
21   setLayout(myMainLayout);
22 }
23
24 ModuleBase_PageWidget::~ModuleBase_PageWidget()
25 {
26 }
27
28 void ModuleBase_PageWidget::addPageStretch()
29 {
30   myMainLayout->setRowStretch(myMainLayout->rowCount(), 1);
31 }
32
33 void ModuleBase_PageWidget::placeModelWidget(ModuleBase_ModelWidget* theWidget)
34 {
35   const int kCol = 0;
36   const int kRow = myMainLayout->count();
37   myMainLayout->addWidget(theWidget, kRow, kCol);
38   myMainLayout->setRowStretch(kRow, 0);
39 }
40
41 void ModuleBase_PageWidget::placeWidget(QWidget* theWidget)
42 {
43   if (!theWidget) {
44     #ifdef _DEBUG
45     std::cout << "ModuleBase_PageWidget::placePageWidget: can not cast page" << std::endl;
46     #endif
47     return;
48   }
49   const int kCol = 0;
50   const int kRow = myMainLayout->count();
51   myMainLayout->addWidget(theWidget, kRow, kCol);
52   myMainLayout->setRowStretch(kRow, 0);
53 }
54
55 QLayout* ModuleBase_PageWidget::pageLayout()
56 {
57   return myMainLayout;
58 }