Seamly2D
Code documentation
VPE::VProperty Class Reference

#include <vproperty.h>

Inheritance diagram for VPE::VProperty:
Collaboration diagram for VPE::VProperty:

Public Types

enum  DPC_DisplayColumn { DPC_Name = 0 , DPC_Data }
 

Public Slots

virtual void childValueChanged (const QVariant &value, int typeForParent)
 

Signals

void childChanged (const QVariant &value, int typeForParent)
 

Public Member Functions

 VProperty (const QString &name, QVariant::Type type=QVariant::String)
 Standard constructor, takes a name and a parent property as argument. More...
 
virtual ~VProperty () Q_DECL_OVERRIDE
 Destructor. More...
 
virtual QString type () const
 Returns a string containing the type of the property. More...
 
virtual QVariant data (int column=DPC_Name, int role=Qt::DisplayRole) const
 Get the data how it should be displayed. More...
 
virtual bool setData (const QVariant &data, int role=Qt::EditRole)
 This is used by the model to set the data. More...
 
virtual bool paint (QPainter *, const QStyleOptionViewItem &, const QModelIndex &, const QAbstractItemDelegate *) const
 This is called by the delegate when the property value is being drawn. The standard implementation doesn't do anything. If you reimplement this in a sub property, make sure to return true or the delegate will draw the item. More...
 
virtual QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &, const QAbstractItemDelegate *)
 Returns an editor widget, or NULL if it doesn't supply one. More...
 
virtual bool setEditorData (QWidget *editor)
 Sets the property's data to the editor (returns false, if the standard delegate should do that) More...
 
virtual QVariant getEditorData (const QWidget *editor) const
 Gets the data from the widget. More...
 
virtual Qt::ItemFlags flags (int column=DPC_Name) const
 Returns item flags. More...
 
virtual void setValue (const QVariant &value)
 Sets the value of the property. More...
 
virtual QVariant getValue () const
 Returns the value of the property as a QVariant. More...
 
virtual QString serialize () const
 Serializes the value to a string. More...
 
virtual void deserialize (const QString &value)
 Deserializes the value from a string. More...
 
virtual void setName (const QString &name)
 Sets the name of the property. More...
 
virtual QString getName () const
 Gets the name of the property. More...
 
virtual void setDescription (const QString &desc)
 Sets the name of the property. More...
 
virtual QString getDescription () const
 Gets the name of the property. More...
 
virtual int addChild (VProperty *child)
 Adds a child to this property. More...
 
virtual QList< VProperty * > & getChildren ()
 Returns a reference to the list of children. More...
 
virtual const QList< VProperty * > & getChildren () const
 Returns a reference to the list of children. More...
 
virtual VPropertygetChild (int row) const
 Returns the child at a certain row. More...
 
virtual int getRowCount () const
 Gets the number of children. More...
 
virtual VPropertygetParent () const
 Gets the parent of this property. More...
 
virtual void setParent (VProperty *parent)
 Sets the parent of this property. More...
 
virtual void removeChild (VProperty *child)
 Removes a child from the children list, doesn't delete the child! More...
 
virtual int getChildRow (VProperty *child) const
 Returns the row the child has. More...
 
virtual bool getUpdateParent () const
 Returns whether the views have to update the parent of this property if it changes. More...
 
virtual bool getUpdateChildren () const
 Returns whether the views have to update the children of this property if it changes. More...
 
virtual void setUpdateBehaviour (bool update_parent, bool update_children)
 Sets whether the views should update Parents or children after this property changes. More...
 
virtual void setSettings (const QMap< QString, QVariant > &settings)
 Sets the settings by calling the overloaded setSetting(const QString &key, const QVariant &value) for each item in the map. More...
 
virtual QMap< QString, QVariant > getSettings () const
 Get the settings. More...
 
virtual void setSetting (const QString &key, const QVariant &value)
 Sets the settings. This function has to be implemented in a subclass in order to have an effect. More...
 
virtual QVariant getSetting (const QString &key) const
 Get the settings. This function has to be implemented in a subclass in order to have an effect. More...
 
virtual QStringList getSettingKeys () const
 Returns the list of keys of the property's settings. More...
 
virtual Q_REQUIRED_RESULT VPropertyclone (bool include_children=true, VProperty *container=nullptr) const
 Clones this property. More...
 
Property propertyType () const
 
void setPropertyType (const Property &type)
 
virtual void updateParent (const QVariant &value)
 

Protected Member Functions

 VProperty (VPropertyPrivate *d)
 Protected constructor. More...
 

Protected Attributes

VPropertyPrivated_ptr
 The protected structure holding the member variables (to assure binary compatibility) More...
 

Detailed Description

Definition at line 56 of file vproperty.h.

Member Enumeration Documentation

◆ DPC_DisplayColumn

Enumerator
DPC_Name 
DPC_Data 

Definition at line 60 of file vproperty.h.

Constructor & Destructor Documentation

◆ VProperty() [1/2]

VPE::VProperty::VProperty ( const QString &  name,
QVariant::Type  type = QVariant::String 
)
explicit

Standard constructor, takes a name and a parent property as argument.

Definition at line 36 of file vproperty.cpp.

Referenced by VFormulaProperty::clone().

◆ ~VProperty()

VPE::VProperty::~VProperty ( )
virtual

Destructor.

Definition at line 49 of file vproperty.cpp.

◆ VProperty() [2/2]

VPE::VProperty::VProperty ( VPropertyPrivate d)
explicitprotected

Protected constructor.

Definition at line 43 of file vproperty.cpp.

Member Function Documentation

◆ addChild()

int VPE::VProperty::addChild ( VProperty child)
virtual

◆ childChanged

void VPE::VProperty::childChanged ( const QVariant &  value,
int  typeForParent 
)
signal

◆ childValueChanged

void VPE::VProperty::childValueChanged ( const QVariant &  value,
int  typeForParent 
)
virtualslot

Definition at line 410 of file vproperty.cpp.

Referenced by VPE::VPropertyFormWidget::build().

◆ clone()

VPE::VProperty * VPE::VProperty::clone ( bool  include_children = true,
VProperty container = nullptr 
) const
virtual

Clones this property.

Parameters
include_childrenIndicates whether to also clone the children
containerIf a property is being passed here, no new VProperty is being created but instead it is tried to fill all the data into container. This can also be used when subclassing this function.
Returns
Returns the newly created property (or container, if it was not NULL)

Reimplemented in VPE::VWidgetProperty, VPE::VStringProperty, VPE::VShortcutProperty, VPE::VPointFProperty, VPE::VObjectProperty, VPE::SpinboxProperty, VPE::LineTypeProperty, VPE::VLineColorProperty, VPE::VLabelProperty, VPE::VFileProperty, VPE::VEnumProperty, VPE::VEmptyProperty, VPE::PlainTextProperty, VPE::LineWeightProperty, VPE::QVector3DProperty, VPE::VColorProperty, VPE::VBoolProperty, and VPE::DoubleSpinboxProperty.

Definition at line 372 of file vproperty.cpp.

References addChild(), clone(), setDescription(), setName(), setPropertyType(), setSettings(), setUpdateBehaviour(), and setValue().

Referenced by VPE::VBoolProperty::clone(), VPE::VColorProperty::clone(), VPE::QVector3DProperty::clone(), clone(), VPE::LineWeightProperty::clone(), VPE::PlainTextProperty::clone(), VPE::VEmptyProperty::clone(), VPE::VEnumProperty::clone(), VPE::VFileProperty::clone(), VPE::VLabelProperty::clone(), VPE::VLineColorProperty::clone(), VPE::LineTypeProperty::clone(), VPE::SpinboxProperty::clone(), VPE::VObjectProperty::clone(), VPE::VPointFProperty::clone(), VPE::VShortcutProperty::clone(), VPE::VStringProperty::clone(), VPE::VWidgetProperty::clone(), and VPE::VPropertySet::cloneProperty().

◆ createEditor()

QWidget * VPE::VProperty::createEditor ( QWidget *  parent,
const QStyleOptionViewItem &  ,
const QAbstractItemDelegate *   
)
virtual

Returns an editor widget, or NULL if it doesn't supply one.

Parameters
parentThe widget to which the editor will be added as a child \options Render options \delegate A pointer to the QAbstractItemDelegate requesting the editor. This can be used to connect signals and slots.

Reimplemented in VPE::VStringProperty, VPE::VShortcutProperty, VPE::VObjectProperty, VPE::SpinboxProperty, VPE::LineTypeProperty, VPE::VLineColorProperty, VPE::VLabelProperty, VPE::VFileProperty, VPE::VEnumProperty, VPE::VEmptyProperty, VPE::VColorProperty, VPE::PlainTextProperty, VPE::LineWeightProperty, VFormulaProperty, and VPE::DoubleSpinboxProperty.

Definition at line 105 of file vproperty.cpp.

Referenced by VPE::VPropertyDelegate::createEditor().

◆ data()

◆ deserialize()

void VPE::VProperty::deserialize ( const QString &  value)
virtual

Deserializes the value from a string.

Definition at line 192 of file vproperty.cpp.

Referenced by VPE::VPropertyFactoryManager::createProperty().

◆ flags()

Qt::ItemFlags VPE::VProperty::flags ( int  column = DPC_Name) const
virtual

◆ getChild()

VPE::VProperty * VPE::VProperty::getChild ( int  row) const
virtual

Returns the child at a certain row.

Definition at line 234 of file vproperty.cpp.

Referenced by VPE::VPropertySet::cloneProperty(), and VPE::VPropertyModel::index().

◆ getChildren() [1/2]

◆ getChildren() [2/2]

const QList< VPE::VProperty * > & VPE::VProperty::getChildren ( ) const
virtual

Returns a reference to the list of children.

Definition at line 228 of file vproperty.cpp.

◆ getChildRow()

int VPE::VProperty::getChildRow ( VProperty child) const
virtual

Returns the row the child has.

Definition at line 308 of file vproperty.cpp.

Referenced by VPE::VPropertyModel::getIndexFromProperty(), and VPE::VPropertyModel::parent().

◆ getDescription()

QString VPE::VProperty::getDescription ( ) const
virtual

Gets the name of the property.

Definition at line 216 of file vproperty.cpp.

Referenced by VPE::VPropertyFormWidget::buildEditor(), and VPE::VPropertyFormWidget::VPropertyFormWidget().

◆ getEditorData()

◆ getName()

QString VPE::VProperty::getName ( ) const
virtual

Gets the name of the property.

Definition at line 204 of file vproperty.cpp.

Referenced by VPE::VPropertyFormWidget::buildEditor(), VFormulaProperty::clone(), and VPE::VPropertyFormWidget::VPropertyFormWidget().

◆ getParent()

◆ getRowCount()

int VPE::VProperty::getRowCount ( ) const
virtual

◆ getSetting()

QVariant VPE::VProperty::getSetting ( const QString &  key) const
virtual

◆ getSettingKeys()

QStringList VPE::VProperty::getSettingKeys ( ) const
virtual

Returns the list of keys of the property's settings.

Reimplemented in VPE::VStringProperty, VPE::SpinboxProperty, VPE::VLabelProperty, VPE::VFileProperty, VPE::VEnumProperty, VPE::PlainTextProperty, and VPE::DoubleSpinboxProperty.

Definition at line 367 of file vproperty.cpp.

◆ getSettings()

QMap< QString, QVariant > VPE::VProperty::getSettings ( ) const
virtual

Get the settings.

Definition at line 342 of file vproperty.cpp.

◆ getUpdateChildren()

bool VPE::VProperty::getUpdateChildren ( ) const
virtual

Returns whether the views have to update the children of this property if it changes.

Definition at line 320 of file vproperty.cpp.

◆ getUpdateParent()

bool VPE::VProperty::getUpdateParent ( ) const
virtual

Returns whether the views have to update the parent of this property if it changes.

Definition at line 314 of file vproperty.cpp.

Referenced by VPE::VPropertyModel::setData().

◆ getValue()

QVariant VPE::VProperty::getValue ( ) const
virtual

Returns the value of the property as a QVariant.

Reimplemented in VPE::VPointFProperty, VPE::QVector3DProperty, and VFormulaProperty.

Definition at line 181 of file vproperty.cpp.

◆ paint()

bool VPE::VProperty::paint ( QPainter *  ,
const QStyleOptionViewItem &  ,
const QModelIndex &  ,
const QAbstractItemDelegate *   
) const
virtual

This is called by the delegate when the property value is being drawn. The standard implementation doesn't do anything. If you reimplement this in a sub property, make sure to return true or the delegate will draw the item.

Definition at line 98 of file vproperty.cpp.

◆ propertyType()

VPE::Property VPE::VProperty::propertyType ( ) const

◆ removeChild()

void VPE::VProperty::removeChild ( VProperty child)
virtual

Removes a child from the children list, doesn't delete the child!

Removes a child from the children list.

Definition at line 297 of file vproperty.cpp.

References getParent(), and setParent().

Referenced by VPE::QVector3DProperty::clone(), VPE::VPointFProperty::clone(), and setParent().

◆ serialize()

QString VPE::VProperty::serialize ( ) const
virtual

Serializes the value to a string.

Definition at line 187 of file vproperty.cpp.

◆ setData()

bool VPE::VProperty::setData ( const QVariant &  data,
int  role = Qt::EditRole 
)
virtual

This is used by the model to set the data.

Parameters
dataThe data to set
roleThe role. Default is Qt::EditRole
Returns
Returns true, if the data was changed, false if not.

Reimplemented in VPE::VBoolProperty.

Definition at line 86 of file vproperty.cpp.

Referenced by VPE::VPropertyModel::setData().

◆ setDescription()

void VPE::VProperty::setDescription ( const QString &  desc)
virtual

Sets the name of the property.

Definition at line 210 of file vproperty.cpp.

Referenced by clone(), and VPE::VPropertyFactoryManager::createProperty().

◆ setEditorData()

bool VPE::VProperty::setEditorData ( QWidget *  editor)
virtual

Sets the property's data to the editor (returns false, if the standard delegate should do that)

Reimplemented in VPE::VShortcutProperty, VPE::VFileProperty, VPE::VColorProperty, and VFormulaProperty.

Definition at line 117 of file vproperty.cpp.

Referenced by VPE::VPropertyFormWidget::loadData(), and VPE::VPropertyDelegate::setEditorData().

◆ setName()

void VPE::VProperty::setName ( const QString &  name)
virtual

Sets the name of the property.

Definition at line 198 of file vproperty.cpp.

Referenced by clone().

◆ setParent()

void VPE::VProperty::setParent ( VProperty parent)
virtual

Sets the parent of this property.

Definition at line 257 of file vproperty.cpp.

References removeChild().

Referenced by addChild(), removeChild(), and VPE::VPropertySet::removeProperty().

◆ setPropertyType()

void VPE::VProperty::setPropertyType ( const Property type)

Definition at line 400 of file vproperty.cpp.

Referenced by clone().

◆ setSetting()

void VPE::VProperty::setSetting ( const QString &  key,
const QVariant &  value 
)
virtual

Sets the settings. This function has to be implemented in a subclass in order to have an effect.

Reimplemented in VPE::VStringProperty, VPE::SpinboxProperty, VPE::VLabelProperty, VPE::VFileProperty, VPE::VEnumProperty, VPE::PlainTextProperty, and VPE::DoubleSpinboxProperty.

Definition at line 353 of file vproperty.cpp.

◆ setSettings()

void VPE::VProperty::setSettings ( const QMap< QString, QVariant > &  settings)
virtual

◆ setUpdateBehaviour()

void VPE::VProperty::setUpdateBehaviour ( bool  update_parent,
bool  update_children 
)
virtual

Sets whether the views should update Parents or children after this property changes.

Definition at line 326 of file vproperty.cpp.

Referenced by clone(), VPE::QVector3DProperty::QVector3DProperty(), VFormulaProperty::VFormulaProperty(), and VPE::VPointFProperty::VPointFProperty().

◆ setValue()

◆ type()

◆ updateParent()

void VPE::VProperty::updateParent ( const QVariant &  value)
virtual

Member Data Documentation

◆ d_ptr

VPropertyPrivate* VPE::VProperty::d_ptr
protected

The protected structure holding the member variables (to assure binary compatibility)

Definition at line 214 of file vproperty.h.

Referenced by VPE::DoubleSpinboxProperty::createEditor(), VPE::LineWeightProperty::createEditor(), VPE::VEnumProperty::createEditor(), VPE::VLineColorProperty::createEditor(), VPE::LineTypeProperty::createEditor(), VPE::SpinboxProperty::createEditor(), VPE::VObjectProperty::createEditor(), VPE::LineWeightProperty::currentIndexChanged(), VPE::VEnumProperty::currentIndexChanged(), VPE::VLineColorProperty::currentIndexChanged(), VPE::LineTypeProperty::currentIndexChanged(), VPE::VObjectProperty::currentIndexChanged(), VPE::LineWeightProperty::data(), VPE::VEnumProperty::data(), VPE::VLineColorProperty::data(), VPE::LineTypeProperty::data(), VPE::VObjectProperty::data(), VPE::DoubleSpinboxProperty::DoubleSpinboxProperty(), VPE::LineTypeProperty::LineTypeProperty(), VPE::LineWeightProperty::LineWeightProperty(), VPE::PlainTextProperty::PlainTextProperty(), VFormulaProperty::SetFormula(), VPE::LineWeightProperty::setValue(), VPE::VEnumProperty::setValue(), VPE::VLineColorProperty::setValue(), VPE::LineTypeProperty::setValue(), VPE::VObjectProperty::setValue(), VPE::SpinboxProperty::SpinboxProperty(), VPE::SpinboxProperty::valueChanged(), VPE::VBoolProperty::VBoolProperty(), VPE::VEnumProperty::VEnumProperty(), VFormulaProperty::VFormulaProperty(), VPE::VLabelProperty::VLabelProperty(), VPE::VLineColorProperty::VLineColorProperty(), VPE::VObjectProperty::VObjectProperty(), VPE::VPointFProperty::VPointFProperty(), and VPE::VStringProperty::VStringProperty().


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