itom  4.1.0
itomParamManager.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom and its software development toolkit (SDK).
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  In addition, as a special exception, the Institut fuer Technische
15  Optik (ITO) gives you certain additional rights.
16  These rights are described in the ITO LGPL Exception version 1.0,
17  which can be found in the file LGPL_EXCEPTION.txt in this package.
18 
19  itom is distributed in the hope that it will be useful, but
20  WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
22  General Public Licence for more details.
23 
24  You should have received a copy of the GNU Library General Public License
25  along with itom. If not, see <http://www.gnu.org/licenses/>.
26 *********************************************************************** */
27 
28 
29 #ifndef ITOMPARAMMANAGER_H
30 #define ITOMPARAMMANAGER_H
31 
32 #include "qtpropertybrowser.h"
33 #include "common/param.h"
34 #include "common/paramMeta.h"
35 
36 #include <qicon.h>
37 
38 namespace ito
39 {
40 
41 class AbstractParamPropertyManagerPrivate;
42 
43 /*
44 Abstract base class for all property managers that are responsible for ito::Param values.
45 */
47 {
48  Q_OBJECT
49 public:
50  AbstractParamPropertyManager(QObject *parent = 0);
52 
53  const ito::ParamBase &paramBase(const QtProperty *property) const;
54  const ito::Param &param(const QtProperty *property) const;
55 
56 public Q_SLOTS:
57  virtual void setParam(QtProperty *property, const ito::Param &param) = 0;
58 
59 protected:
60  virtual QString valueText(const QtProperty *property) const;
61  virtual QIcon valueIcon(const QtProperty *property) const;
62  virtual void initializeProperty(QtProperty *property) = 0;
63  virtual void uninitializeProperty(QtProperty *property);
64 
66 
67 private:
68  Q_DECLARE_PRIVATE(AbstractParamPropertyManager)
69  Q_DISABLE_COPY(AbstractParamPropertyManager)
70 };
71 
72 
73 /*
74 Property Manager for parameters of type ito::ParamBase::Int
75 */
76 class ITOMWIDGETS_EXPORT ParamIntPropertyManager : public AbstractParamPropertyManager
77 {
78  Q_OBJECT
79 public:
80  ParamIntPropertyManager(QObject *parent = 0);
82 
83 protected:
84  QString valueText(const QtProperty *property) const;
85  QIcon valueIcon(const QtProperty *property) const;
86  void initializeProperty(QtProperty *property);
87 
88 Q_SIGNALS:
89  void valueChanged(QtProperty *property, int val);
90  void metaChanged(QtProperty *property, ito::IntMeta meta);
91 
92 public Q_SLOTS:
93  void setParam(QtProperty *property, const ito::Param &param);
94  void setValue(QtProperty *property, int value);
95 
96 private:
97  Q_DISABLE_COPY(ParamIntPropertyManager)
98 };
99 
100 /*
101 Property Manager for parameters of type ito::ParamBase::Char
102 */
104 {
105  Q_OBJECT
106 public:
107  ParamCharPropertyManager(QObject *parent = 0);
109 
110 protected:
111  QString valueText(const QtProperty *property) const;
112  QIcon valueIcon(const QtProperty *property) const;
113  void initializeProperty(QtProperty *property);
114 
115 Q_SIGNALS:
116  void valueChanged(QtProperty *property, char val);
117  void metaChanged(QtProperty *property, ito::CharMeta meta);
118 
119 public Q_SLOTS:
120  void setParam(QtProperty *property, const ito::Param &param);
121  void setValue(QtProperty *property, char value);
122 
123 private:
124  Q_DISABLE_COPY(ParamCharPropertyManager)
125 };
126 
127 /*
128 Property Manager for parameters of type ito::ParamBase::Double
129 */
131 {
132  Q_OBJECT
133 public:
134  ParamDoublePropertyManager(QObject *parent = 0);
136 
137  bool hasPopupSlider() const;
138  void setPopupSlider(bool popup);
139 
140 protected:
141  QString valueText(const QtProperty *property) const;
142  QIcon valueIcon(const QtProperty *property) const;
143  void initializeProperty(QtProperty *property);
144 
145 Q_SIGNALS:
146  void valueChanged(QtProperty *property, double val);
147  void metaChanged(QtProperty *property, ito::DoubleMeta meta);
148 
149 public Q_SLOTS:
150  void setParam(QtProperty *property, const ito::Param &param);
151  void setValue(QtProperty *property, double value);
152 
153 private:
154  Q_DISABLE_COPY(ParamDoublePropertyManager)
155 
156  bool m_popupSlider;
157 };
158 
159 
160 /*
161 Property Manager for parameters of type ito::ParamBase::String
162 */
164 {
165  Q_OBJECT
166 public:
167  ParamStringPropertyManager(QObject *parent = 0);
169 
170 protected:
171  QString valueText(const QtProperty *property) const;
172  void initializeProperty(QtProperty *property);
173 
174 Q_SIGNALS:
175  void valueChanged(QtProperty *property, const QByteArray &value);
176  void metaChanged(QtProperty *property, ito::StringMeta meta);
177 
178 public Q_SLOTS:
179  void setParam(QtProperty *property, const ito::Param &param);
180  void setValue(QtProperty *property, const QByteArray &value);
181 
182 private:
183  Q_DISABLE_COPY(ParamStringPropertyManager)
184 };
185 
186 /*
187 Property Manager for parameters of type ito::ParamBase::Interval and ito::ParamBase::Range
188 */
190 {
191  Q_OBJECT
192 public:
193  ParamIntervalPropertyManager(QObject *parent = 0);
195 
196 protected:
197  QString valueText(const QtProperty *property) const;
198  void initializeProperty(QtProperty *property);
199 
200 Q_SIGNALS:
201  void valueChanged(QtProperty *property, int min, int max);
202  void metaChanged(QtProperty *property, ito::IntervalMeta meta);
203 
204 public Q_SLOTS:
205  void setParam(QtProperty *property, const ito::Param &param);
206  void setValue(QtProperty *property, int min, int max);
207 
208 private:
209  Q_DISABLE_COPY(ParamIntervalPropertyManager)
210 };
211 
212 
214 
215 /*
216 Property Manager for parameters of type ito::ParamBase::Rect
217 */
219 {
220  Q_OBJECT
221 public:
222  ParamRectPropertyManager(QObject *parent = 0);
224 
225 Q_SIGNALS:
226  void valueChanged(QtProperty *property, int left, int top, int width, int height);
227  void metaChanged(QtProperty *property, ito::RectMeta meta);
228 
229 public Q_SLOTS:
230  void setParam(QtProperty *property, const ito::Param &param);
231  void setValue(QtProperty *property, int left, int top, int width, int height);
232 
233  ParamIntervalPropertyManager *subIntervalPropertyManager() const;
234 
235 protected:
236  QString valueText(const QtProperty *property) const;
237  void initializeProperty(QtProperty *property);
238  virtual void uninitializeProperty(QtProperty *property);
240 
241 private:
242  Q_DECLARE_PRIVATE(ParamRectPropertyManager)
243  Q_DISABLE_COPY(ParamRectPropertyManager)
244 
245  Q_PRIVATE_SLOT(d_func(), void slotIntervalChanged(QtProperty *, int, int))
246  Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
247 };
248 
249 
251 
252 /*
253 Property Manager for parameters of type ito::ParamBase::CharArray
254 */
256 {
257  Q_OBJECT
258 public:
259  ParamCharArrayPropertyManager(QObject *parent = 0);
261 
262  typedef char DataType;
263 
264 Q_SIGNALS:
265  void valueChanged(QtProperty *property, int num, const char* values);
266  void metaChanged(QtProperty *property, ito::CharArrayMeta meta);
267 
268 public Q_SLOTS:
269  void setParam(QtProperty *property, const ito::Param &param);
270  void setValue(QtProperty *property, int num, const char* values);
271 
272  ParamCharPropertyManager *subPropertyManager() const;
273 
274 protected:
275  QString valueText(const QtProperty *property) const;
276  void initializeProperty(QtProperty *property);
277  virtual void uninitializeProperty(QtProperty *property);
279 
280 private:
281  Q_DECLARE_PRIVATE(ParamCharArrayPropertyManager)
282  Q_DISABLE_COPY(ParamCharArrayPropertyManager)
283 
284  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, char))
285  Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
286 };
287 
289 
290 /*
291 Property Manager for parameters of type ito::ParamBase::IntArray
292 */
294 {
295  Q_OBJECT
296 public:
297  ParamIntArrayPropertyManager(QObject *parent = 0);
299 
300  typedef int DataType;
301 
302 Q_SIGNALS:
303  void valueChanged(QtProperty *property, int num, const int* values);
304  void metaChanged(QtProperty *property, ito::IntArrayMeta meta);
305 
306 public Q_SLOTS:
307  void setParam(QtProperty *property, const ito::Param &param);
308  void setValue(QtProperty *property, int num, const int* values);
309 
310  ParamIntPropertyManager *subPropertyManager() const;
311 
312 protected:
313  QString valueText(const QtProperty *property) const;
314  void initializeProperty(QtProperty *property);
315  virtual void uninitializeProperty(QtProperty *property);
317 
318 private:
319  Q_DECLARE_PRIVATE(ParamIntArrayPropertyManager)
320  Q_DISABLE_COPY(ParamIntArrayPropertyManager)
321 
322  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, int))
323  Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
324 };
325 
327 
328 /*
329 Property Manager for parameters of type ito::ParamBase::DoubleArray
330 */
332 {
333  Q_OBJECT
334 public:
335  ParamDoubleArrayPropertyManager(QObject *parent = 0);
337 
338  typedef double DataType;
339 
340 Q_SIGNALS:
341  void valueChanged(QtProperty *property, int num, const double* values);
342  void metaChanged(QtProperty *property, ito::DoubleArrayMeta meta);
343 
344 public Q_SLOTS:
345  void setParam(QtProperty *property, const ito::Param &param);
346  void setValue(QtProperty *property, int num, const double* values);
347 
348  ParamDoublePropertyManager *subPropertyManager() const;
349 
350 protected:
351  QString valueText(const QtProperty *property) const;
352  void initializeProperty(QtProperty *property);
353  virtual void uninitializeProperty(QtProperty *property);
355 
356 private:
357  Q_DECLARE_PRIVATE(ParamDoubleArrayPropertyManager)
358  Q_DISABLE_COPY(ParamDoubleArrayPropertyManager)
359 
360  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, double))
361  Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
362 };
363 
364 /*
365 Property Manager for parameters of type ito::ParamBase::HWRef, ito::ParamBase::DObjPtr,
366 ito::ParamBase::PolygonMeshPtr, ito::ParamBase::PointCloudPtr, ito::ParamBase::PointPtr
367 */
369 {
370  Q_OBJECT
371 public:
372  ParamOtherPropertyManager(QObject *parent = 0);
374 
375 protected:
376  QString valueText(const QtProperty *property) const;
377  void initializeProperty(QtProperty *property);
378 
379 public Q_SLOTS:
380  void setParam(QtProperty *property, const ito::Param &param);
381 
382 private:
383  Q_DISABLE_COPY(ParamOtherPropertyManager)
384 };
385 
386 
387 
388 } //end namespace ito
389 
390 #endif
PyObject * setParam(ito::AddInBase *addInObj, PyObject *args)
Definition: pythonPlugins.cpp:1347
Definition: itomParamManager.cpp:45
Definition: itomParamManager.cpp:1136
Definition: paramMeta.h:494
Definition: itomParamManager.cpp:1693
Definition: itomParamManager.h:293
Meta-information for Param of type Int.
Definition: paramMeta.h:183
class for parameter handling e.g. to pass paramters to plugins
Definition: param.h:283
Meta-information for Param of type CharArrayMeta.
Definition: paramMeta.h:448
Definition: apiFunctionsGraph.cpp:39
Definition: itomParamManager.h:103
Definition: itomParamManager.h:218
Definition: itomParamManager.h:130
Definition: itomParamManager.cpp:901
Definition: itomParamManager.h:189
Definition: itomParamManager.cpp:1416
Meta-information for ito::Param of type Double.
Definition: paramMeta.h:233
meta-information for Param of type Char.
Definition: paramMeta.h:132
Definition: itomParamManager.h:331
Definition: itomParamManager.h:368
Meta-information for Param of type IntArrayMeta that represent an interval [minimum, maximum).
Definition: paramMeta.h:638
Definition: itomParamManager.h:163
The QtAbstractPropertyManager provides an interface for property managers.
Definition: qtpropertybrowser.h:101
Meta-information for Param of type DoubleArrayMeta.
Definition: paramMeta.h:540
Definition: param.h:67
Meta-information for Param of type String.
Definition: paramMeta.h:354
Definition: itomParamManager.h:255
Meta-information for Param of type IntArrayMeta that represent a rectangle (left, top...
Definition: paramMeta.h:712
Definition: itomParamManager.h:76
The QtProperty class encapsulates an instance of a property.
Definition: qtpropertybrowser.h:60
Definition: itomParamManager.h:46