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>
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 VProperty * | getProperty (const QString &id) const |
Gets a property by it's ID. More... | |
virtual VProperty * | takeProperty (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... | |
VProperty * | getRootProperty (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 VPropertySet * | clone () 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 | |
VPropertySetPrivate * | d_ptr |
The data. More... | |
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.
VPE::VPropertySet::VPropertySet | ( | ) |
Default constructor, creating an empty property set.
Definition at line 31 of file vpropertyset.cpp.
|
virtual |
Destructor.
Definition at line 37 of file vpropertyset.cpp.
|
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.
property | The property to add |
id | The 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. |
parentid | The 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().
|
virtual |
Adds the property to the model and attaches it to the parent property.
property | The property to add |
id | The 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_property | The 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().
|
virtual |
Clears the set and (optionally) deletes all properties.
delete_properties | Set this to false, if you don't want the properties to get deleted. |
Definition at line 141 of file vpropertyset.cpp.
VPE::VPropertySet * VPE::VPropertySet::clone | ( | ) | const |
Clones the property set.
Definition at line 203 of file vpropertyset.cpp.
|
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().
|
virtual |
Returns the number of properties with in ID that are directly accessable by getProperty()
Definition at line 136 of file vpropertyset.cpp.
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.
|
virtual |
Gets a property by it's ID.
Definition at line 102 of file vpropertyset.cpp.
|
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.
prop | The property of which to get the ID. |
look_for_parent_id | If this is TRUE and the property has no ID, all the parent properties are checked. |
Definition at line 154 of file vpropertyset.cpp.
References VPE::VProperty::getParent().
Referenced by VPE::VSerializedProperty::initChildren(), and VPE::VSerializedProperty::VSerializedProperty().
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().
VPE::VProperty * VPE::VPropertySet::getRootProperty | ( | int | row | ) | const |
Returns the root property in a certain row.
row | The root row in which to look for the root property |
Definition at line 193 of file vpropertyset.cpp.
int VPE::VPropertySet::getRootPropertyCount | ( | ) | const |
Returns the number of independent properties.
Definition at line 198 of file vpropertyset.cpp.
|
virtual |
Checks whether a property belongs to this set and returns the result.
property | The property to check for |
Definition at line 92 of file vpropertyset.cpp.
|
protectedvirtual |
Checks whether a property belongs to this set and returns the result.
property | The property to check for |
parent | The parent property from which to start checking all the children |
Definition at line 214 of file vpropertyset.cpp.
References VPE::VProperty::getChildren().
|
virtual |
Removes a property from the set and deletes it.
Definition at line 116 of file vpropertyset.cpp.
|
virtual |
Removes a property from the set and deletes it optionally.
Definition at line 122 of file vpropertyset.cpp.
References VPE::VProperty::setParent().
|
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().
|
virtual |
Removes a property from the set and returns it.
Definition at line 107 of file vpropertyset.cpp.
|
protected |
The data.
Definition at line 135 of file vpropertyset.h.