Salome HOME
Update copyrights
[modules/shaper.git] / src / ModuleBase / ModuleBase_PageGroupBox.cpp
1 // Copyright (C) 2014-2019  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include <ModuleBase_PageGroupBox.h>
21 #include <ModuleBase_ModelWidget.h>
22 #include <ModuleBase_Tools.h>
23
24 #include <QGridLayout>
25
26 ModuleBase_PageGroupBox::ModuleBase_PageGroupBox(QWidget* theParent)
27 : QGroupBox(theParent)
28 {
29   myMainLayout = new QGridLayout(this);
30   ModuleBase_Tools::adjustMargins(myMainLayout);
31   setLayout(myMainLayout);
32 }
33
34 ModuleBase_PageGroupBox::~ModuleBase_PageGroupBox()
35 {
36 }
37
38 void ModuleBase_PageGroupBox::addPageStretch()
39 {
40 }
41
42 void ModuleBase_PageGroupBox::placeModelWidget(ModuleBase_ModelWidget* theWidget)
43 {
44   const int kCol = 0;
45   const int kRow = myMainLayout->count();
46   // it seems, that the align on left is not necessary here, but leads to widgets, which are
47   // not extended on full width of the parent page. The case is grouped widgets in
48   // the sketch translation operation
49   myMainLayout->addWidget(theWidget, kRow, kCol, Qt::AlignTop);// | Qt::AlignLeft);
50   myMainLayout->setRowStretch(kRow, 0);
51
52 }
53
54 void ModuleBase_PageGroupBox::placeWidget(QWidget* theWidget)
55 {
56   if (!theWidget) {
57     #ifdef _DEBUG
58     std::cout << "ModuleBase_PageGroupBox::placePageWidget: can not cast page" << std::endl;
59     #endif
60     return;
61   }
62   const int kCol = 0;
63   const int kRow = myMainLayout->count();
64   myMainLayout->addWidget(theWidget, kRow, kCol);
65   myMainLayout->setRowStretch(kRow, 0);
66 }
67
68 QLayout* ModuleBase_PageGroupBox::pageLayout()
69 {
70   return myMainLayout;
71 }