Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYMurWidget.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
21 #include <QPushButton>
22 #include <QCheckBox>
23 // Added by qt3to4:
24 #include <QGridLayout>
25 #include <QLabel>
26 
30 #include "TYMurWidget.h"
31 
32 #define TR(id) OLocalizator::getString("TYMurWidget", (id))
33 
34 TYMurWidget::TYMurWidget(TYMur* pElement, QWidget* _pParent /*=NULL*/) : TYWidget(pElement, _pParent)
35 {
36 
37  resize(300, 700);
38  setWindowTitle(TR("id_caption"));
39  _murLayout = new QGridLayout();
40  setLayout(_murLayout);
41 
42  _elmW = new TYAcousticRectangleNodeWidget(pElement, this);
43  _elmW->setLayoutSpacing(0, 0);
44  _murLayout->addWidget(_elmW, 0, 0);
45 
46  QGroupBox* pGroupBoxParoi = new QGroupBox(this);
47  pGroupBoxParoi->setTitle(TR("id_paroi"));
48  QGridLayout* pGroupBoxParoiLayout = new QGridLayout();
49  pGroupBoxParoi->setLayout(pGroupBoxParoiLayout);
50 
51  _lineEditNomParoi = new QLineEdit(pGroupBoxParoi);
52  _lineEditNomParoi->setEnabled(false);
53  pGroupBoxParoiLayout->addWidget(_lineEditNomParoi, 0, 0);
54 
55  _pPushButtonParoi = new QPushButton(pGroupBoxParoi);
56  _pPushButtonParoi->setText(TR("id_proprietes_button"));
57  pGroupBoxParoiLayout->addWidget(_pPushButtonParoi, 0, 1);
58 
59  _labeUseEtage = new QLabel(pGroupBoxParoi);
60  _labeUseEtage->setText(TR("id_useEtage_label"));
61  _checkBoxUseEtage = new QCheckBox(pGroupBoxParoi);
62  _checkBoxUseEtage->setText(TR(""));
63  pGroupBoxParoiLayout->addWidget(_labeUseEtage, 1, 0);
64  pGroupBoxParoiLayout->addWidget(_checkBoxUseEtage, 1, 1);
65 
66  _murLayout->addWidget(pGroupBoxParoi, 1, 0);
67 
68  updateContent();
69 
70  connect(_pPushButtonParoi, &QPushButton::clicked, this, &TYMurWidget::editParoi);
71  connect(_checkBoxUseEtage, &QPushButton::clicked, this, &TYMurWidget::updateUseParoi);
72 }
73 
75 
77 {
79 
80  _lineEditNomParoi->setText(getElement()->getParoi()->getName());
81  _checkBoxUseEtage->setChecked(!(getElement()->isParoiLocked()));
83 }
84 
86 {
87  _elmW->apply();
88  getElement()->setParoiLocked(!(_checkBoxUseEtage->isChecked()));
89 
90  emit modified();
91 }
92 
94 {
95  int ret = getElement()->getParoi()->edit(this);
96 
97  if (ret == QDialog::Accepted)
98  {
99  _lineEditNomParoi->setText(getElement()->getParoi()->getName());
100  }
101 }
102 
104 {
105  _pPushButtonParoi->setEnabled(!(_checkBoxUseEtage->isChecked()));
106 }
outil IHM pour un ensemble de rectangles acoustiques (fichier header)
#define TR(id)
Definition: TYMurWidget.cpp:32
outil IHM pour un mur (fichier header)
Classe de l'objet IHM pour un ensemble de rectangles acoustiques.
void setLayoutSpacing(int margin, int spacing)
TYAcousticRectangleNodeWidget * _elmW
Definition: TYMurWidget.h:86
QLineEdit * _lineEditNomParoi
Definition: TYMurWidget.h:81
QGridLayout * _murLayout
Definition: TYMurWidget.h:80
QCheckBox * _checkBoxUseEtage
Definition: TYMurWidget.h:84
QLabel * _labeUseEtage
Definition: TYMurWidget.h:83
TYMurWidget(TYMur *pElement, QWidget *_pParent=NULL)
Definition: TYMurWidget.cpp:34
virtual ~TYMurWidget()
Definition: TYMurWidget.cpp:74
QPushButton * _pPushButtonParoi
Definition: TYMurWidget.h:78
void updateUseParoi()
virtual void updateContent()
Definition: TYMurWidget.cpp:76
void editParoi()
Definition: TYMurWidget.cpp:93
virtual void apply()
Definition: TYMurWidget.cpp:85
Definition: TYMur.h:36
classe de l'objet IHM pour un objet metier de type TYElement
Definition: TYWidget.h:43
void modified()