Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYSetCameraCoordinates.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 
21 #include <qpushbutton.h>
22 #include <qlabel.h>
23 #include <qlayout.h>
24 #include <qcursor.h>
25 #include <qgroupbox.h>
26 #include <qpixmap.h>
27 // Added by qt3to4:
28 #include <QGridLayout>
29 #include <QBoxLayout>
30 #include <QHBoxLayout>
31 #include <QVBoxLayout>
32 
36 #include "TYSetCameraCoordinates.h"
37 
38 #define TR(id) OLocalizator::getString("TYSetCameraCoordinates", (id))
39 
41 {
42  setModal(true);
43 
44  setWindowTitle(TR("id_caption"));
45  setFixedSize(220, 150);
46 
47  QGridLayout* pLayout = new QGridLayout();
48  pLayout->setContentsMargins(10, 10, 10, 10);
49  setLayout(pLayout);
50 
51  QLabel* pLabelMainText = new QLabel(this);
52  pLabelMainText->setText(TR("id_maintext"));
53  pLayout->addWidget(pLabelMainText, 0, 0, 1, 2);
54 
55  QLabel* pLabelCoordX = new QLabel(this);
56  pLabelCoordX->setText(TR("id_coordX"));
57  pLayout->addWidget(pLabelCoordX, 1, 0);
58 
60  _pXCoordLineEdit->setFixedSize(50, 20);
61  QObject::connect(_pXCoordLineEdit, &QLineEdit::textChanged, this,
63  pLayout->addWidget(_pXCoordLineEdit, 1, 1, Qt::AlignRight);
64 
65  QLabel* pLabelCoordY = new QLabel(this);
66  pLabelCoordY->setText(TR("id_coordY"));
67  pLayout->addWidget(pLabelCoordY, 2, 0);
68 
70  _pYCoordLineEdit->setFixedSize(50, 20);
71  QObject::connect(_pYCoordLineEdit, &QLineEdit::textChanged, this,
73  pLayout->addWidget(_pYCoordLineEdit, 2, 1, Qt::AlignRight);
74 
75  QLabel* pLabelCoordZ = new QLabel(this);
76  pLabelCoordZ->setText(TR("id_coordZ"));
77  pLayout->addWidget(pLabelCoordZ, 3, 0);
78 
80  _pZCoordLineEdit->setFixedSize(50, 20);
81  QObject::connect(_pZCoordLineEdit, &QLineEdit::textChanged, this,
83  pLayout->addWidget(_pZCoordLineEdit, 3, 1, Qt::AlignRight);
84 
85  QPushButton* pOKButton = new QPushButton(TR("id_oktext"), this);
86  QObject::connect(pOKButton, &QPushButton::clicked, this, &TYSetCameraCoordinates::accept);
87  pLayout->addWidget(pOKButton, 4, 0);
88 
89  QPushButton* pCancelButton = new QPushButton(TR("id_canceltext"), this);
90  QObject::connect(pCancelButton, &QPushButton::clicked, this, &TYSetCameraCoordinates::reject);
91  pLayout->addWidget(pCancelButton, 4, 1);
92 
93  _xCoord = _yCoord = _zCoord = 0;
94 }
95 
97 
99 {
100  _xCoord = _pXCoordLineEdit->text().toInt();
101 }
102 
104 {
105  _yCoord = _pYCoordLineEdit->text().toInt();
106 }
107 
109 {
110  _zCoord = _pZCoordLineEdit->text().toInt();
111 }
112 
114 {
115  _xCoord = xCoord;
116  _pXCoordLineEdit->setText(QString("%1").arg(_xCoord));
117 }
118 
120 {
121  _yCoord = yCoord;
122  _pYCoordLineEdit->setText(QString("%1").arg(_yCoord));
123 }
124 
126 {
127  _zCoord = zCoord;
128  _pZCoordLineEdit->setText(QString("%1").arg(_zCoord));
129 }
outil IHM pour une entrée utilisateur (fichier header)
Classe generique pour une fenetre de modeleur (fichier header)
#define TR(id)
Repositionnement de la camera en fonction de coordonnees specifiees (fichier header)
Generic class for a modeler window.
TYSetCameraCoordinates(TYModelerFrame *pModeler)