Salome HOME
Issue #1834: Fix length of lines
[modules/shaper.git] / src / ModuleBase / ModuleBase_PageGroupBox.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2 /*
3  * ModuleBase_PageGroupBox.cpp
4  *
5  *  Created on: Mar 4, 2015
6  *      Author: sbh
7  */
8
9 #include <ModuleBase_PageGroupBox.h>
10 #include <ModuleBase_ModelWidget.h>
11 #include <ModuleBase_Tools.h>
12
13 #include <QGridLayout>
14
15 ModuleBase_PageGroupBox::ModuleBase_PageGroupBox(QWidget* theParent)
16 : QGroupBox(theParent)
17 {
18   myMainLayout = new QGridLayout(this);
19   ModuleBase_Tools::adjustMargins(myMainLayout);
20   setLayout(myMainLayout);
21 }
22
23 ModuleBase_PageGroupBox::~ModuleBase_PageGroupBox()
24 {
25 }
26
27 void ModuleBase_PageGroupBox::addPageStretch()
28 {
29 }
30
31 void ModuleBase_PageGroupBox::placeModelWidget(ModuleBase_ModelWidget* theWidget)
32 {
33   const int kCol = 0;
34   const int kRow = myMainLayout->count();
35   // it seems, that the align on left is not necessary here, but leads to widgets, which are
36   // not extended on full width of the parent page. The case is grouped widgets in
37   // the sketch translation operation
38   myMainLayout->addWidget(theWidget, kRow, kCol, Qt::AlignTop);// | Qt::AlignLeft);
39   myMainLayout->setRowStretch(kRow, 0);
40
41 }
42
43 void ModuleBase_PageGroupBox::placeWidget(QWidget* theWidget)
44 {
45   if (!theWidget) {
46     #ifdef _DEBUG
47     std::cout << "ModuleBase_PageGroupBox::placePageWidget: can not cast page" << std::endl;
48     #endif
49     return;
50   }
51   const int kCol = 0;
52   const int kRow = myMainLayout->count();
53   myMainLayout->addWidget(theWidget, kRow, kCol);
54   myMainLayout->setRowStretch(kRow, 0);
55 }
56
57 QLayout* ModuleBase_PageGroupBox::pageLayout()
58 {
59   return myMainLayout;
60 }