Computer Assisted Medical Intervention Tool Kit  version 5.2
PropertyObject.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2024 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, TIMC, 38000 Grenoble, France
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 #ifndef PROPERTYOBJECT_H
27 #define PROPERTYOBJECT_H
28 
29 // Qt includes
30 #include <QObject>
31 
32 // CamiTK includes
33 #include "CamiTKAPI.h"
34 #include "Property.h"
35 #include "InterfacePersistence.h"
36 
37 namespace camitk {
38 
65 
72 class CAMITK_API PropertyObject : public QObject, public InterfacePersistence {
73 
74  Q_OBJECT
75 
76 public:
81  PropertyObject(QString name);
82 
84  ~PropertyObject() override;
85 
96  virtual bool addProperty(Property*);
97 
108  Q_INVOKABLE virtual const camitk::Property* getProperty(QString name) const;
109  Q_INVOKABLE virtual camitk::Property* getProperty(QString name);
110 
114  virtual void removeProperty(Property*);
115 
117  virtual unsigned int getNumberOfProperties() const;
118 
120  virtual QString getPropertyName(unsigned int index) const;
121 
123  virtual QVariant getPropertyValue(unsigned int index);
124 
126  virtual QVariant getPropertyValue(const QString name) const;
127 
129  void loadFromSettings(const QString& settingGroupName);
130 
132  void saveToSettings(const QString& settingGroupName);
133 
135  static QString toCamelCase(const QString&);
136 
143  virtual QVariant toVariant() const override;
144 
146  virtual void fromVariant(const QVariant&) override;
148 
149 private:
153  QMap<QString, Property*> propertiesMap;
155 };
156 
157 }
158 
159 #endif // PROPERTYOBJECT_H
#define CAMITK_API
Definition: CamiTKAPI.h:49
Interface for all objects that should be serialized by the PersistenceManager.
Definition: InterfacePersistence.h:36
This class describes a property object.
Definition: PropertyObject.h:72
This class describes a property that can be used in components and actions or any class that needs to...
Definition: Property.h:280
Definition: Action.cpp:36