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