Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYTraficWidget.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 
26 
27 // Added by qt3to4:
28 #include <QGridLayout>
29 #include <QLabel>
30 
31 #include "TYTraficWidget.h"
32 
33 #define TR(id) OLocalizator::getString("TYTraficWidget", (id))
34 
35 TYTraficWidget::TYTraficWidget(TYTrafic* pElement, QWidget* _pParent /*=NULL*/) : TYWidget(pElement, _pParent)
36 {
37  QString num;
38 
39  _elmW = new TYElementWidget(pElement, this);
41  _lineEditDebitPL->setText(num.setNum(getElement()->getDebitPL(), 'f', 2));
42  QLabel* pUnitDebitPL = new QLabel();
43  pUnitDebitPL->setText(TR("id_unite_debit"));
44 
46  _lineEditDebitVL->setText(num.setNum(getElement()->getDebitVL(), 'f', 2));
47  QLabel* pUnitDebitVL = new QLabel();
48  pUnitDebitVL->setText(TR("id_unite_debit"));
49 
50  _labelDebitPL = new QLabel();
51  _labelDebitPL->setText(TR("id_debitpl_label"));
52 
53  _labelDebitVL = new QLabel();
54  _labelDebitVL->setText(TR("id_debitvl_label"));
55 
56  _groupBoxLayout = new QGridLayout();
57  _groupBoxLayout->addWidget(_lineEditDebitPL, 1, 1);
58  _groupBoxLayout->addWidget(pUnitDebitPL, 1, 2);
59  _groupBoxLayout->addWidget(_lineEditDebitVL, 0, 1);
60  _groupBoxLayout->addWidget(pUnitDebitVL, 0, 2);
61  _groupBoxLayout->addWidget(_labelDebitPL, 1, 0);
62  _groupBoxLayout->addWidget(_labelDebitVL, 0, 0);
63 
64  _groupBox = new QGroupBox(this);
65  _groupBox->setTitle(TR(""));
66  _groupBox->setLayout(_groupBoxLayout);
67 
68  resize(300, 150);
69  setWindowTitle(TR("id_caption"));
70  _traficLayout = new QGridLayout();
71  _traficLayout->addWidget(_elmW, 0, 0);
72  _traficLayout->addWidget(_groupBox, 1, 0);
73 
74  setLayout(_traficLayout);
75 }
76 
78 
80 {
82 
83  QString num;
84 
85  _lineEditDebitPL->setText(num.setNum(getElement()->getDebitPL(), 'f', 2));
86  _lineEditDebitVL->setText(num.setNum(getElement()->getDebitVL(), 'f', 2));
87 }
88 
90 {
91  _elmW->apply();
92 
93  if (_lineEditDebitPL->text().toDouble() >= 0)
94  {
95  getElement()->setDebitPL(_lineEditDebitPL->text().toDouble());
96  }
97  if (_lineEditDebitVL->text().toDouble() >= 0)
98  {
99  getElement()->setDebitVL(_lineEditDebitVL->text().toDouble());
100  }
101 
102  emit modified();
103 }
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()