Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYRectangleWidget.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 
23 // Added by qt3to4:
24 #include <QGridLayout>
25 #include <QTreeWidget>
26 #include <QTreeWidgetItem>
27 
29 #include "TYRectangleWidget.h"
30 
31 #define TR(id) OLocalizator::getString("TYRectangleWidget", (id))
32 
35 
36 TYRectangleWidget::TYRectangleWidget(TYRectangle* pElement, QWidget* _pParent /*=NULL*/)
37  : TYWidget(pElement, _pParent)
38 {
39 
40  _elmW = new TYElementWidget(pElement, this);
41  _surfaceW = new TYSurfaceInterfaceWidget(pElement, this);
42 
43  resize(300, 350);
44  setWindowTitle(TR("id_caption"));
45  _rectangleLayout = new QGridLayout();
46  setLayout(_rectangleLayout);
47  _rectangleLayout->addWidget(_elmW, 0, 0);
48  _rectangleLayout->addWidget(_surfaceW, 1, 0);
49 
50  _groupBox = new QGroupBox(this);
51  _groupBox->setTitle(TR("id_pts"));
52  _groupBoxLayout = new QGridLayout();
53  _groupBox->setLayout(_groupBoxLayout);
54 
55  _listViewTabPt = new QTreeWidget(_groupBox);
56  QStringList stringList;
57  stringList.append(TR("id_x"));
58  stringList.append(TR("id_y"));
59  stringList.append(TR("id_z"));
60  _listViewTabPt->setColumnCount(3);
61  _listViewTabPt->setHeaderLabels(stringList);
62  _listViewTabPt->setSelectionMode(QTreeWidget::NoSelection);
63  _listViewTabPt->setRootIsDecorated(true);
64 
65  _groupBoxLayout->addWidget(_listViewTabPt, 0, 0);
66 
67  _rectangleLayout->addWidget(_groupBox, 2, 0);
68 
69  updateContent();
70 }
71 
73 
75 {
78 
79  _listViewTabPt->clear();
80  for (int i = 0; i < 4; i++)
81  {
82  QTreeWidgetItem* item = new QTreeWidgetItem(_listViewTabPt, 0);
83  item->setText(0, QString().setNum(getElement()->_pts[i]._x, 'f', 2));
84  item->setText(1, QString().setNum(getElement()->_pts[i]._y, 'f', 2));
85  item->setText(2, QString().setNum(getElement()->_pts[i]._z, 'f', 2));
86  }
87 }
88 
90 {
91  _elmW->apply();
92  _surfaceW->apply();
93 
94  emit modified();
95 }
#define TR(id)
outil IHM pour un rectangle (fichier header)
outil IHM pour la gestion des objets de type SurfaceInterface (fichier header)
classe de l'objet IHM pour un element
virtual void apply()
virtual void updateContent()
TYSurfaceInterfaceWidget * _surfaceW
QGridLayout * _rectangleLayout
virtual void apply()
QGridLayout * _groupBoxLayout
QTreeWidget * _listViewTabPt
virtual void updateContent()
TYElementWidget * _elmW
TYRectangleWidget(TYRectangle *pElement, QWidget *_pParent=NULL)
classe de l'objet IHM pour la gestion des objets de type SurfaceInterface
classe de l'objet IHM pour un objet metier de type TYElement
Definition: TYWidget.h:43
void modified()