This class describes a property object. More...
#include <PropertyObject.h>
Public Member Functions | |
| virtual bool | addProperty (Property *) |
| Tag a new CamiTK property to this object. | |
| virtual unsigned int | getNumberOfProperties () const |
| get the current number of property | |
| virtual Q_INVOKABLE camitk::Property * | getProperty (QString name) |
| virtual Q_INVOKABLE const camitk::Property * | getProperty (QString name) const |
| Get a Property given its name. | |
| virtual QString | getPropertyName (unsigned int index) const |
| get the name of the property at the given index, null string if index is out of bounds (i.e., isNull() == true) | |
| virtual QVariant | getPropertyValue (const QString name) const |
| convenient method to get the value of a given property, returns a non valid QVariant if no property with that name exists | |
| virtual QVariant | getPropertyValue (unsigned int index) |
| get the value of the property at the given index, a non valid QVariant if the index is out of bounds (i.e., isValid() == false) | |
| void | loadFromSettings (const QString &settingGroupName) |
| initializes all property values from setting values found in the given group name | |
| PropertyObject (QString name) | |
| Default constructor. | |
| virtual void | removeProperty (Property *) |
| Remove a CamiTK property of this object. | |
| void | saveToSettings (const QString &settingGroupName) |
| save setting in the given group name using all the property values | |
| ~PropertyObject () override | |
| Destructor. | |
InterfacePersistence | |
| |
| virtual QVariant | toVariant () const override |
| virtual void | fromVariant (const QVariant &) override |
| Load data from a QVariant to initialize the current object. | |
| virtual QUuid | getUuid () const override |
| Get the unique ID of the propertyObject (usually the uuid of the containing object). | |
| virtual bool | setUuid (QUuid) override |
| Set the unique ID of the propertyObject (usually the uuid of the containing object). | |
| Public Member Functions inherited from camitk::InterfacePersistence | |
| virtual | ~InterfacePersistence ()=default |
Static Public Member Functions | |
| static QString | toCamelCase (const QString &) |
| utility method to transform property name to camel case. Quite useful to make sure all settings are stored as lowerCamelCase | |
This class describes a property object.
A property object is simply a QObject tagged with some CamiTK Properties The idea is to have an object which implements all the necessary methods to take advantages of the CamiTK Properties within the ObjectController
PropertyObject can be saved/loaded from settings. A typical use in this case is to
See the Application class for an example of a property object load/save to settings.
| camitk::PropertyObject::PropertyObject | ( | QString | name | ) |
Default constructor.
| name | The name of the PropertyObject instance. This one would be displayed in any SettingsDialog entries. |
References addProperty().
|
override |
Destructor.
|
virtual |
Tag a new CamiTK property to this object.
If the property already exist, it will just change its value.
Referenced by PropertyObject().
|
overridevirtual |
Load data from a QVariant to initialize the current object.
Implements camitk::InterfacePersistence.
References camitk::PersistenceManager::loadProperties().
Referenced by camitk::PersistenceManager::loadWorkspace().
|
virtual |
get the current number of property
Referenced by camitk::Core::getConfigAsJson(), loadFromSettings(), and saveToSettings().
|
virtual |
|
virtual |
Get a Property given its name.
| name | the property name |
Referenced by camitk::Core::getConfigAsJson(), loadFromSettings(), and toVariant().
|
virtual |
get the name of the property at the given index, null string if index is out of bounds (i.e., isNull() == true)
Referenced by camitk::Core::getConfigAsJson(), getPropertyValue(), loadFromSettings(), and saveToSettings().
|
virtual |
convenient method to get the value of a given property, returns a non valid QVariant if no property with that name exists
|
virtual |
get the value of the property at the given index, a non valid QVariant if the index is out of bounds (i.e., isValid() == false)
References getPropertyName().
Referenced by getUuid(), loadFromSettings(), saveToSettings(), setUuid(), and toVariant().
|
overridevirtual |
Get the unique ID of the propertyObject (usually the uuid of the containing object).
Implements camitk::InterfacePersistence.
References getPropertyValue().
| void camitk::PropertyObject::loadFromSettings | ( | const QString & | settingGroupName | ) |
initializes all property values from setting values found in the given group name
References getNumberOfProperties(), getProperty(), getPropertyName(), getPropertyValue(), camitk::Application::getSettings(), and toCamelCase().
|
virtual |
Remove a CamiTK property of this object.
| void camitk::PropertyObject::saveToSettings | ( | const QString & | settingGroupName | ) |
save setting in the given group name using all the property values
References getNumberOfProperties(), getPropertyName(), getPropertyValue(), camitk::Application::getSettings(), and toCamelCase().
|
overridevirtual |
Set the unique ID of the propertyObject (usually the uuid of the containing object).
Implements camitk::InterfacePersistence.
References getPropertyValue().
|
static |
utility method to transform property name to camel case. Quite useful to make sure all settings are stored as lowerCamelCase
Referenced by loadFromSettings(), and saveToSettings().
|
overridevirtual |
Convert all data from the object to a QVariant (usually a QVariantMap)
Implements camitk::InterfacePersistence.
References getProperty(), and getPropertyValue().
Referenced by camitk::PersistenceManager::saveWorkspace().