Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYSolverParamsWidget.h
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 
22 #ifndef TYSOLVERPARAMSWIDGET_H
23 #define TYSOLVERPARAMSWIDGET_H
24 
25 #include <QMap>
26 #include <QString>
27 #include <QJsonObject>
28 #include <QWidget>
29 #include <QVariant>
30 #include <QGroupBox>
31 #include <QButtonGroup>
32 #include <QCheckBox>
33 #include <QLabel>
34 #include <QLineEdit>
35 
41 {
42 
43 public:
44  TYSolverParamsDataModel(QString paramName, QString type, QStringList valuesLabel = QStringList(),
45  QString defaultValue = "0");
46  static TYSolverParamsDataModel* fromJsonObject(QString paramName, QJsonObject dataModelJson);
48 
50  {
51  return valueLabels.size() > 0;
52  }
53  bool isBool()
54  {
55  return type == "bool";
56  }
57  bool isInt()
58  {
59  return type == "int";
60  }
61  bool isNumber()
62  {
63  return type == "int" || type == "double" || type == "float";
64  }
65 
66  QString paramName;
67  QString type;
68  QString defaultValue;
69  QStringList valueLabels;
70 };
71 
76 class TYSolverParamsWidget : public QWidget
77 {
78  Q_OBJECT
79  Q_PROPERTY(QString value READ value WRITE setValue NOTIFY valueChanged)
80 
81 public:
83  virtual ~TYSolverParamsWidget(){};
84 
85  QString value() const
86  {
87  return m_value;
88  }
89 
91 
92 private:
93  QString m_value;
94 
95 public slots:
96  void setValue(QString value);
97  void setValue(int value);
98  void setValue(bool value);
99 
100 signals:
101  void valueChanged(QString);
102 };
103 
109 {
110  Q_OBJECT
111 public:
113 
114  QLabel* label;
115  QLineEdit* lineEdit;
116 };
117 
123 {
124  Q_OBJECT
125 
126 public:
128 
129  QGroupBox* groupBox;
130  QButtonGroup* buttonGroup;
131 };
132 
138 {
139  Q_OBJECT
140 public:
142 
143  QCheckBox* checkBox;
144 };
145 
146 #endif // TYSOLVERPARAMSWIDGET_H
TYSolverParamsCheckBoxWidget(TYSolverParamsDataModel *dataModel)
Objet contenant les informations concernant les parametres du solveur.
TYSolverParamsDataModel(QString paramName, QString type, QStringList valuesLabel=QStringList(), QString defaultValue="0")
static TYSolverParamsDataModel * fromJsonObject(QString paramName, QJsonObject dataModelJson)
TYSolverParamsInputValueWidget(TYSolverParamsDataModel *dataModel)
TYSolverParamsRadioButtonsWidget(TYSolverParamsDataModel *dataModel)
Objet de base dont doivent heriter les widgets utilises pour controler les parametres du solveur.
void valueChanged(QString)
void setValue(QString value)
TYSolverParamsWidget(TYSolverParamsDataModel *dataModel)
TYSolverParamsDataModel * dataModel