Seamly2D
Code documentation
VPE::VPropertySet Class Reference

VPropertySet is a simple class for managing a set of properties. If you don't need all the Model-functionality, chose this class over VPropertyModel. More...

#include <vpropertyset.h>

Collaboration diagram for VPE::VPropertySet:

Public Member Functions

 VPropertySet ()
 Default constructor, creating an empty property set. More...
 
virtual ~VPropertySet ()
 Destructor. More...
 
virtual bool addProperty (VProperty *property, const QString &id, const QString &parentid)
 Adds the property to the model and attaches it to the parentid. Note that if the property has a parent which is not part of this set, it will be removed from that parent. More...
 
virtual bool addProperty (VProperty *property, const QString &id, VProperty *parent_property=nullptr)
 Adds the property to the model and attaches it to the parent property. More...
 
virtual bool hasProperty (VProperty *property) const
 Checks whether a property belongs to this set and returns the result. More...
 
virtual VPropertygetProperty (const QString &id) const
 Gets a property by it's ID. More...
 
virtual VPropertytakeProperty (const QString &id)
 Removes a property from the set and returns it. More...
 
virtual void removeProperty (const QString &id)
 Removes a property from the set and deletes it. More...
 
virtual void removeProperty (VProperty *prop, bool delete_property=true)
 Removes a property from the set and deletes it optionally. More...
 
virtual int count () const
 Returns the number of properties with in ID that are directly accessable by getProperty() More...
 
virtual void clear (bool delete_properties=true)
 Clears the set and (optionally) deletes all properties. More...
 
virtual QString getPropertyID (const VProperty *prop, bool look_for_parent_id=true) const
 Returns the ID of the property within the set The concept of property IDs is, that the object that manages the properties and not the properties themselves handle the IDs. More...
 
const QMap< QString, VProperty * > & getPropertiesMap () const
 Returns a const reference to the map of properties. More...
 
const QList< VProperty * > & getRootProperties () const
 Returns a const reference to the list of root properties. More...
 
VPropertygetRootProperty (int row) const
 Returns the root property in a certain row. More...
 
int getRootPropertyCount () const
 Returns the number of independent properties. More...
 
Q_REQUIRED_RESULT VPropertySetclone () const
 Clones the property set. More...
 

Protected Member Functions

virtual bool hasProperty (VProperty *property, VProperty *parent) const
 Checks whether a property belongs to this set and returns the result. More...
 
void cloneProperty (VProperty *property_to_clone, VProperty *parent_property, VPropertySet *output_set) const
 Clones a property into another property set. More...
 
virtual void removePropertyFromSet (VProperty *prop)
 Recursivly removes a property's child properties from the set, but not from the parent. More...
 

Protected Attributes

VPropertySetPrivated_ptr
 The data. More...
 

Detailed Description

VPropertySet is a simple class for managing a set of properties. If you don't need all the Model-functionality, chose this class over VPropertyModel.

Definition at line 47 of file vpropertyset.h.

Constructor & Destructor Documentation

◆ VPropertySet()

VPE::VPropertySet::VPropertySet ( )

Default constructor, creating an empty property set.

Definition at line 31 of file vpropertyset.cpp.

◆ ~VPropertySet()

VPE::VPropertySet::~VPropertySet ( )
virtual

Destructor.

Definition at line 37 of file vpropertyset.cpp.

Member Function Documentation

◆ addProperty() [1/2]

bool VPE::VPropertySet::addProperty ( VProperty property,
const QString &  id,
const QString &  parentid 
)
virtual

Adds the property to the model and attaches it to the parentid. Note that if the property has a parent which is not part of this set, it will be removed from that parent.

Parameters
propertyThe property to add
idThe property ID. If id is empty, the property will not be accessable by it's id but still be added. If the property was filed under another ID before, that will no longer be valid.
parentidThe property's ID to which to add the property as child. Pass empty string to add it to the root properties.

Definition at line 45 of file vpropertyset.cpp.

Referenced by cloneProperty().

◆ addProperty() [2/2]

bool VPE::VPropertySet::addProperty ( VProperty property,
const QString &  id,
VProperty parent_property = nullptr 
)
virtual

Adds the property to the model and attaches it to the parent property.

Parameters
propertyThe property to add
idThe property ID. If id is empty, the property will not be accessable by it's id but still be added. If the property was filed under another ID before, that will no longer be valid.
parent_propertyThe property to which to add the property as child. Pass NULL to add it to the root properties.

Definition at line 57 of file vpropertyset.cpp.

References VPE::VProperty::addChild(), and VPE::VProperty::getParent().

◆ clear()

void VPE::VPropertySet::clear ( bool  delete_properties = true)
virtual

Clears the set and (optionally) deletes all properties.

Parameters
delete_propertiesSet this to false, if you don't want the properties to get deleted.

Definition at line 141 of file vpropertyset.cpp.

◆ clone()

VPE::VPropertySet * VPE::VPropertySet::clone ( ) const

Clones the property set.

Definition at line 203 of file vpropertyset.cpp.

◆ cloneProperty()

void VPE::VPropertySet::cloneProperty ( VProperty property_to_clone,
VProperty parent_property,
VPropertySet output_set 
) const
protected

Clones a property into another property set.

Definition at line 237 of file vpropertyset.cpp.

References addProperty(), VPE::VProperty::clone(), VPE::VProperty::getChild(), and VPE::VProperty::getRowCount().

◆ count()

int VPE::VPropertySet::count ( ) const
virtual

Returns the number of properties with in ID that are directly accessable by getProperty()

Definition at line 136 of file vpropertyset.cpp.

◆ getPropertiesMap()

const QMap< QString, VPE::VProperty * > & VPE::VPropertySet::getPropertiesMap ( ) const

Returns a const reference to the map of properties.

Definition at line 183 of file vpropertyset.cpp.

◆ getProperty()

VPE::VProperty * VPE::VPropertySet::getProperty ( const QString &  id) const
virtual

Gets a property by it's ID.

Definition at line 102 of file vpropertyset.cpp.

◆ getPropertyID()

QString VPE::VPropertySet::getPropertyID ( const VProperty prop,
bool  look_for_parent_id = true 
) const
virtual

Returns the ID of the property within the set The concept of property IDs is, that the object that manages the properties and not the properties themselves handle the IDs.

Parameters
propThe property of which to get the ID.
look_for_parent_idIf this is TRUE and the property has no ID, all the parent properties are checked.
Returns
Returns the ID under which the property is stored within the set

Definition at line 154 of file vpropertyset.cpp.

References VPE::VProperty::getParent().

Referenced by VPE::VSerializedProperty::initChildren(), and VPE::VSerializedProperty::VSerializedProperty().

◆ getRootProperties()

const QList< VPE::VProperty * > & VPE::VPropertySet::getRootProperties ( ) const

Returns a const reference to the list of root properties.

Definition at line 188 of file vpropertyset.cpp.

Referenced by VPE::VPropertyFormView::setModel(), VPE::VPropertyFormView::setPropertySet(), and VPE::VPropertyFormView::updatePropertyList().

◆ getRootProperty()

VPE::VProperty * VPE::VPropertySet::getRootProperty ( int  row) const

Returns the root property in a certain row.

Parameters
rowThe root row in which to look for the root property

Definition at line 193 of file vpropertyset.cpp.

◆ getRootPropertyCount()

int VPE::VPropertySet::getRootPropertyCount ( ) const

Returns the number of independent properties.

Definition at line 198 of file vpropertyset.cpp.

◆ hasProperty() [1/2]

bool VPE::VPropertySet::hasProperty ( VProperty property) const
virtual

Checks whether a property belongs to this set and returns the result.

Parameters
propertyThe property to check for
Returns
True, if the property is part of this set, false otherwise

Definition at line 92 of file vpropertyset.cpp.

◆ hasProperty() [2/2]

bool VPE::VPropertySet::hasProperty ( VProperty property,
VProperty parent 
) const
protectedvirtual

Checks whether a property belongs to this set and returns the result.

Parameters
propertyThe property to check for
parentThe parent property from which to start checking all the children
Returns
True, if the property is part of this set, false otherwise

Definition at line 214 of file vpropertyset.cpp.

References VPE::VProperty::getChildren().

◆ removeProperty() [1/2]

void VPE::VPropertySet::removeProperty ( const QString &  id)
virtual

Removes a property from the set and deletes it.

Definition at line 116 of file vpropertyset.cpp.

◆ removeProperty() [2/2]

void VPE::VPropertySet::removeProperty ( VProperty prop,
bool  delete_property = true 
)
virtual

Removes a property from the set and deletes it optionally.

Definition at line 122 of file vpropertyset.cpp.

References VPE::VProperty::setParent().

◆ removePropertyFromSet()

void VPE::VPropertySet::removePropertyFromSet ( VProperty prop)
protectedvirtual

Recursivly removes a property's child properties from the set, but not from the parent.

Definition at line 257 of file vpropertyset.cpp.

References VPE::VProperty::getChildren().

◆ takeProperty()

VPE::VProperty * VPE::VPropertySet::takeProperty ( const QString &  id)
virtual

Removes a property from the set and returns it.

Definition at line 107 of file vpropertyset.cpp.

Member Data Documentation

◆ d_ptr

VPropertySetPrivate* VPE::VPropertySet::d_ptr
protected

The data.

Definition at line 135 of file vpropertyset.h.


The documentation for this class was generated from the following files: