Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / ModuleBase / ModuleBase_PageGroupBox.cpp
1 // Copyright (C) 2014-2017  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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #include <ModuleBase_PageGroupBox.h>
22 #include <ModuleBase_ModelWidget.h>
23 #include <ModuleBase_Tools.h>
24
25 #include <QGridLayout>
26
27 ModuleBase_PageGroupBox::ModuleBase_PageGroupBox(QWidget* theParent)
28 : QGroupBox(theParent)
29 {
30   myMainLayout = new QGridLayout(this);
31   ModuleBase_Tools::adjustMargins(myMainLayout);
32   setLayout(myMainLayout);
33 }
34
35 ModuleBase_PageGroupBox::~ModuleBase_PageGroupBox()
36 {
37 }
38
39 void ModuleBase_PageGroupBox::addPageStretch()
40 {
41 }
42
43 void ModuleBase_PageGroupBox::placeModelWidget(ModuleBase_ModelWidget* theWidget)
44 {
45   const int kCol = 0;
46   const int kRow = myMainLayout->count();
47   // it seems, that the align on left is not necessary here, but leads to widgets, which are
48   // not extended on full width of the parent page. The case is grouped widgets in
49   // the sketch translation operation
50   myMainLayout->addWidget(theWidget, kRow, kCol, Qt::AlignTop);// | Qt::AlignLeft);
51   myMainLayout->setRowStretch(kRow, 0);
52
53 }
54
55 void ModuleBase_PageGroupBox::placeWidget(QWidget* theWidget)
56 {
57   if (!theWidget) {
58     #ifdef _DEBUG
59     std::cout << "ModuleBase_PageGroupBox::placePageWidget: can not cast page" << std::endl;
60     #endif
61     return;
62   }
63   const int kCol = 0;
64   const int kRow = myMainLayout->count();
65   myMainLayout->addWidget(theWidget, kRow, kCol);
66   myMainLayout->setRowStretch(kRow, 0);
67 }
68
69 QLayout* ModuleBase_PageGroupBox::pageLayout()
70 {
71   return myMainLayout;
72 }