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