gepetto-viewer  6.0.0
An user-friendly Graphical Interface
configuration.hh
Go to the documentation of this file.
1 // Copyright (c) 2015-2018, LAAS-CNRS
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 //
4 // This file is part of gepetto-viewer.
5 // gepetto-viewer is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // gepetto-viewer is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // gepetto-viewer. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef GEPETTO_GUI_CONFIGURATION_DIALOG_HH
18 #define GEPETTO_GUI_CONFIGURATION_DIALOG_HH
19 
21 
22 #include <QDialog>
23 
24 class QDoubleSpinBox;
25 class QLineEdit;
26 
27 namespace gepetto {
28 namespace gui {
29 
31 /*
32  * README The MOC tool from Qt does not expand macros. Thus, the code in comment
33 below
34  * does not work because the classes are not mocced.
35  * The remaining of the file, after this comment, correspond to the macro
36  * expansion at the time of writing.
37 
38 #define DECLARE_PROPERTY_EDITOR(Name, Type) \
39  class Name : public QDialog { \
40  Q_OBJECT \
41  \
42  public: \
43  Name(viewer::Property* prop, QWidget* parent = 0); \
44  \
45  void setValueFromProperty(viewer::Property* prop); \
46  \
47  signals: \
48  void valueChanged(const Type& config); \
49  \
50  public slots: \
51  void set(const Type& v); \
52  \
53  private slots: \
54  void updateValue(); \
55  \
56  private: \
57  void setPyValue(); \
58  \
59  QVector<QDoubleSpinBox*> spinBoxes; \
60  QLineEdit* pyValue; \
61  }
62 
63 DECLARE_PROPERTY_EDITOR(Vector2Dialog, osgVector2);
64 DECLARE_PROPERTY_EDITOR(Vector3Dialog, osgVector3);
65 DECLARE_PROPERTY_EDITOR(Vector4Dialog, osgVector4);
66 DECLARE_PROPERTY_EDITOR(ConfigurationDialog, Configuration);
67 
68 #undef DECLARE_PROPERTY_EDITOR
69 */
70 
71 class Vector2Dialog : public QDialog {
72  Q_OBJECT
73  public:
74  Vector2Dialog(viewer::Property* prop, QWidget* parent = 0);
76  signals:
77  void valueChanged(const osgVector2& config);
78  public slots:
79  void set(const osgVector2& v);
80  private slots:
81  void updateValue();
82 
83  private:
84  void setPyValue();
85  QVector<QDoubleSpinBox*> spinBoxes;
86  QLineEdit* pyValue;
87 };
88 class Vector3Dialog : public QDialog {
89  Q_OBJECT
90  public:
91  Vector3Dialog(viewer::Property* prop, QWidget* parent = 0);
93  signals:
94  void valueChanged(const osgVector3& config);
95  public slots:
96  void set(const osgVector3& v);
97  private slots:
98  void updateValue();
99 
100  private:
101  void setPyValue();
102  QVector<QDoubleSpinBox*> spinBoxes;
103  QLineEdit* pyValue;
104 };
105 class Vector4Dialog : public QDialog {
106  Q_OBJECT
107  public:
108  Vector4Dialog(viewer::Property* prop, QWidget* parent = 0);
110  signals:
111  void valueChanged(const osgVector4& config);
112  public slots:
113  void set(const osgVector4& v);
114  private slots:
115  void updateValue();
116 
117  private:
118  void setPyValue();
119  QVector<QDoubleSpinBox*> spinBoxes;
120  QLineEdit* pyValue;
121 };
122 class ConfigurationDialog : public QDialog {
123  Q_OBJECT
124  public:
125  ConfigurationDialog(viewer::Property* prop, QWidget* parent = 0);
127  signals:
128  void valueChanged(const Configuration& config);
129  public slots:
130  void set(const Configuration& v);
131  private slots:
132  void updateValue();
133 
134  private:
135  void setPyValue();
136  QVector<QDoubleSpinBox*> spinBoxes;
137  QLineEdit* pyValue;
138 };
139 
140 } // namespace gui
141 } // namespace gepetto
142 
143 #endif // GEPETTO_GUI_CONFIGURATION_DIALOG_HH
Definition: configuration.hh:122
void setValueFromProperty(viewer::Property *prop)
void valueChanged(const Configuration &config)
void set(const Configuration &v)
ConfigurationDialog(viewer::Property *prop, QWidget *parent=0)
Definition: configuration.hh:71
Vector2Dialog(viewer::Property *prop, QWidget *parent=0)
void setValueFromProperty(viewer::Property *prop)
void valueChanged(const osgVector2 &config)
void set(const osgVector2 &v)
Definition: configuration.hh:88
Vector3Dialog(viewer::Property *prop, QWidget *parent=0)
void setValueFromProperty(viewer::Property *prop)
void valueChanged(const osgVector3 &config)
void set(const osgVector3 &v)
Definition: configuration.hh:105
Vector4Dialog(viewer::Property *prop, QWidget *parent=0)
void setValueFromProperty(viewer::Property *prop)
void valueChanged(const osgVector4 &config)
void set(const osgVector4 &v)
Abstract base class for runtime properties of Node.
Definition: node-property.h:114
::osg::Vec3f osgVector3
Definition: config-osg.h:99
::osg::Vec2f osgVector2
Definition: config-osg.h:98
::osg::Vec4f osgVector4
Definition: config-osg.h:100
viewer::Configuration Configuration
Definition: configuration.hh:30
Definition: action-search-bar.hh:27
Definition: config-osg.h:115