Salome HOME
Property pannel refactoring: focus processing in paged widgets
[modules/shaper.git] / src / ModuleBase / ModuleBase_PageWidget.cpp
1 /*
2  * ModuleBase_PageWidget.cpp
3  *
4  *  Created on: Mar 4, 2015
5  *      Author: sbh
6  */
7
8 #include <ModuleBase_PageWidget.h>
9 #include <ModuleBase_ModelWidget.h>
10 #include <ModuleBase_Tools.h>
11
12 #include <QGridLayout>
13
14 ModuleBase_PageWidget::ModuleBase_PageWidget(QWidget* theParent)
15 : QFrame(theParent)
16 {
17   myMainLayout = new QGridLayout(this);
18   ModuleBase_Tools::adjustMargins(myMainLayout);
19   setLayout(myMainLayout);
20 }
21
22 ModuleBase_PageWidget::~ModuleBase_PageWidget()
23 {
24 }
25
26 void ModuleBase_PageWidget::placeModelWidget(ModuleBase_ModelWidget* theWidget)
27 {
28   const int kCol = 0;
29   const int kRow = myMainLayout->count();
30   myMainLayout->addWidget(theWidget, kRow, kCol, Qt::AlignTop | Qt::AlignLeft);
31 }
32
33 void ModuleBase_PageWidget::placePageWidget(ModuleBase_PageBase* theWidget)
34 {
35   QWidget* aWidget = dynamic_cast<QWidget*>(theWidget);
36   if (!aWidget) {
37     #ifdef _DEBUG
38     std::cout << "ModuleBase_PageWidget::placePageWidget: can not cast page" << std::endl;
39     #endif
40     return;
41   }
42   const int kCol = 0;
43   const int kRow = myMainLayout->count();
44   myMainLayout->addWidget(aWidget, kRow, kCol, Qt::AlignTop | Qt::AlignLeft);
45 }
46
47 QLayout* ModuleBase_PageWidget::pageLayout()
48 {
49   return myMainLayout;
50 }