Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYTraficWidget.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012-2024> <EDF-DTG> <FRANCE>
3  * This file is part of Code_TYMPAN (R).
4  * Code_TYMPAN (R) is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * Code_TYMPAN (R) 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.
11  * See the GNU General Public License for more details.
12  * You should have received a copy of the GNU General Public License along
13  * with Code_TYMPAN (R). If not, see <https://www.gnu.org/licenses/>.
14  */
15 
26 
27 // Added by qt3to4:
28 #include <QGridLayout>
29 #include <QLabel>
30 #include <QtWidgets>
31 
32 #include "TYTraficWidget.h"
33 #include "TYElementWidget.h"
34 
35 #define TR(id) OLocalizator::getString("TYTraficWidget", (id))
36 
37 TYTraficWidget::TYTraficWidget(TYTrafic* pElement, QWidget* _pParent /*=NULL*/) : TYWidget(pElement, _pParent)
38 {
39  QString num;
40 
41  _elmW = new TYElementWidget(pElement, this);
43  _lineEditDebitPL->setText(num.setNum(getElement()->getDebitPL(), 'f', 2));
44  QLabel* pUnitDebitPL = new QLabel();
45  pUnitDebitPL->setText(TR("id_unite_debit"));
46 
48  _lineEditDebitVL->setText(num.setNum(getElement()->getDebitVL(), 'f', 2));
49  QLabel* pUnitDebitVL = new QLabel();
50  pUnitDebitVL->setText(TR("id_unite_debit"));
51 
52  _labelDebitPL = new QLabel();
53  _labelDebitPL->setText(TR("id_debitpl_label"));
54 
55  _labelDebitVL = new QLabel();
56  _labelDebitVL->setText(TR("id_debitvl_label"));
57 
58  _groupBoxLayout = new QGridLayout();
59  _groupBoxLayout->addWidget(_lineEditDebitPL, 1, 1);
60  _groupBoxLayout->addWidget(pUnitDebitPL, 1, 2);
61  _groupBoxLayout->addWidget(_lineEditDebitVL, 0, 1);
62  _groupBoxLayout->addWidget(pUnitDebitVL, 0, 2);
63  _groupBoxLayout->addWidget(_labelDebitPL, 1, 0);
64  _groupBoxLayout->addWidget(_labelDebitVL, 0, 0);
65 
66  _groupBox = new QGroupBox(this);
67  _groupBox->setTitle(TR(""));
68  _groupBox->setLayout(_groupBoxLayout);
69 
70  resize(300, 150);
71  setWindowTitle(TR("id_caption"));
72  _traficLayout = new QGridLayout();
73  _traficLayout->addWidget(_elmW, 0, 0);
74  _traficLayout->addWidget(_groupBox, 1, 0);
75 
76  setLayout(_traficLayout);
77 }
78 
80 
82 {
84 
85  QString num;
86 
87  _lineEditDebitPL->setText(num.setNum(getElement()->getDebitPL(), 'f', 2));
88  _lineEditDebitVL->setText(num.setNum(getElement()->getDebitVL(), 'f', 2));
89 }
90 
92 {
93  _elmW->apply();
94 
95  if (_lineEditDebitPL->text().toDouble() >= 0)
96  {
97  getElement()->setDebitPL(_lineEditDebitPL->text().toDouble());
98  }
99  if (_lineEditDebitVL->text().toDouble() >= 0)
100  {
101  getElement()->setDebitVL(_lineEditDebitVL->text().toDouble());
102  }
103 
104  emit modified();
105 }
outil IHM pour un element (fichier header)
outil IHM pour une entrée utilisateur (fichier header)
#define TR(id)
outil IHM pour un traffic (fichier header)
classe de l'objet IHM pour un element
virtual void apply()
virtual void updateContent()
virtual void apply()
QGridLayout * _traficLayout
TYElementWidget * _elmW
virtual ~TYTraficWidget()
QGridLayout * _groupBoxLayout
virtual void updateContent()
TYLineEdit * _lineEditDebitVL
QGroupBox * _groupBox
QLabel * _labelDebitPL
TYTraficWidget(TYTrafic *pElement, QWidget *_pParent=NULL)
QLabel * _labelDebitVL
TYLineEdit * _lineEditDebitPL
classe de l'objet IHM pour un objet metier de type TYElement
Definition: TYWidget.h:43
void modified()