Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYElementWidget.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 
25 // Added by qt3to4:
26 #include <QGridLayout>
27 #include <QLabel>
28 
29 #include "TYElementWidget.h"
30 
31 #define TR(id) OLocalizator::getString("TYElementWidget", (id))
32 
33 TYElementWidget::TYElementWidget(TYElement* pElement, QWidget* _pParent /*=NULL*/)
34  : TYWidget(pElement, _pParent)
35 {
36 
37  // resize( 300, 40 );
38  setWindowTitle(TR("id_caption"));
39 
40  _lineEditName = new QLineEdit("lineEditName");
41 
42  _labelName = new QLabel("labelName");
43  _labelName->setText(TR("id_name_label"));
44 
45  _groupBoxLayout = new QGridLayout();
46  _groupBoxLayout->addWidget(_labelName, 0, 0);
47  _groupBoxLayout->addWidget(_lineEditName, 0, 1);
48 
49  _groupBox = new QGroupBox(this);
50  _groupBox->setTitle(TR(""));
51  _groupBox->setLayout(_groupBoxLayout);
52 
53  QGridLayout* ElementLayout = new QGridLayout();
54  ElementLayout->setContentsMargins(0, 0, 0, 0);
55  ElementLayout->addWidget(_groupBox, 0, 0);
56 
57  setContentsMargins(0, 0, 0, 0);
58 
59  setLayout(ElementLayout);
60 }
61 
63 
65 {
66  if (getElement() != nullptr)
67  {
68  _lineEditName->setText(getElement()->getName());
69  }
70 }
71 
73 {
74  if (getElement() != nullptr)
75  {
76  getElement()->setName(_lineEditName->text());
77  }
78 
79  TYElement::setIsSavedOk(true); // Il faut sauvegarder le fichier
80 
81  emit modified();
82 }
83 
85 
87 {
88  _lineEditName->setText(name);
89 }
#define TR(id)
outil IHM pour un element (fichier header)
const char * name
virtual void apply()
virtual void updateContent()
QGroupBox * _groupBox
QLineEdit * _lineEditName
virtual void updateEditName(const QString &name)
TYElementWidget(TYElement *pElement, QWidget *_pParent=NULL)
virtual ~TYElementWidget()
virtual void reject()
QGridLayout * _groupBoxLayout
static void setIsSavedOk(const bool &toSave)
Definition: TYElement.h:915
classe de l'objet IHM pour un objet metier de type TYElement
Definition: TYWidget.h:43
void modified()