Salome HOME
Do not use align to the left in the page group box widget.
[modules/shaper.git] / src / ModuleBase / ModuleBase_PageGroupBox.cpp
1 /*
2  * ModuleBase_PageGroupBox.cpp
3  *
4  *  Created on: Mar 4, 2015
5  *      Author: sbh
6  */
7
8 #include <ModuleBase_PageGroupBox.h>
9 #include <ModuleBase_ModelWidget.h>
10 #include <ModuleBase_Tools.h>
11
12 #include <QGridLayout>
13
14 ModuleBase_PageGroupBox::ModuleBase_PageGroupBox(QWidget* theParent)
15 : QGroupBox(theParent)
16 {
17   myMainLayout = new QGridLayout(this);
18   ModuleBase_Tools::adjustMargins(myMainLayout);
19   setLayout(myMainLayout);
20 }
21
22 ModuleBase_PageGroupBox::~ModuleBase_PageGroupBox()
23 {
24 }
25
26 void ModuleBase_PageGroupBox::addPageStretch()
27 {
28 }
29
30 void ModuleBase_PageGroupBox::placeModelWidget(ModuleBase_ModelWidget* theWidget)
31 {
32   const int kCol = 0;
33   const int kRow = myMainLayout->count();
34   // it seems, that the align on left is not necessary here, but leads to widgets, which are
35   // not extended on full width of the parent page. The case is grouped widgets in
36   // the sketch translation operation
37   myMainLayout->addWidget(theWidget, kRow, kCol, Qt::AlignTop);// | Qt::AlignLeft);
38   myMainLayout->setRowStretch(kRow, 0);
39
40 }
41
42 void ModuleBase_PageGroupBox::placePageWidget(ModuleBase_PageBase* theWidget)
43 {
44   QWidget* aWidget = dynamic_cast<QWidget*>(theWidget);
45   if (!aWidget) {
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(aWidget, kRow, kCol);
54   myMainLayout->setRowStretch(kRow, 0);
55 }
56
57 QLayout* ModuleBase_PageGroupBox::pageLayout()
58 {
59   return myMainLayout;
60 }