Fix clone property and commit data for "simple" property type.
--HG-- branch : feature
This commit is contained in:
parent
ae4bab9d07
commit
a251c9e378
|
@ -334,6 +334,7 @@ VProperty* VProperty::clone(bool include_children, VProperty* container) const
|
||||||
container->setValue(getValue());
|
container->setValue(getValue());
|
||||||
container->setSettings(getSettings());
|
container->setSettings(getSettings());
|
||||||
container->setUpdateBehaviour(getUpdateParent(), getUpdateChildren());
|
container->setUpdateBehaviour(getUpdateParent(), getUpdateChildren());
|
||||||
|
container->setPropertyType(propertyType());
|
||||||
|
|
||||||
if(include_children) {
|
if(include_children) {
|
||||||
foreach(VProperty* tmpChild, d_ptr->Children)
|
foreach(VProperty* tmpChild, d_ptr->Children)
|
||||||
|
@ -348,6 +349,11 @@ Property VProperty::propertyType() const
|
||||||
return d_ptr->type;
|
return d_ptr->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VProperty::setPropertyType(const Property &type)
|
||||||
|
{
|
||||||
|
d_ptr->type = type;
|
||||||
|
}
|
||||||
|
|
||||||
void VProperty::UpdateParent(const QVariant &value)
|
void VProperty::UpdateParent(const QVariant &value)
|
||||||
{
|
{
|
||||||
Q_UNUSED(value);
|
Q_UNUSED(value);
|
||||||
|
|
|
@ -162,6 +162,7 @@ public:
|
||||||
virtual VProperty* clone(bool include_children = true, VProperty* container = nullptr) const;
|
virtual VProperty* clone(bool include_children = true, VProperty* container = nullptr) const;
|
||||||
|
|
||||||
Property propertyType() const;
|
Property propertyType() const;
|
||||||
|
void setPropertyType(const Property &type);
|
||||||
|
|
||||||
virtual void UpdateParent(const QVariant &value);
|
virtual void UpdateParent(const QVariant &value);
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -164,19 +164,23 @@ void VPropertyFormWidget::commitData(int row)
|
||||||
VProperty* tmpProperty = d_ptr->Properties[row];
|
VProperty* tmpProperty = d_ptr->Properties[row];
|
||||||
if(tmpEditorWidget.FormWidget)
|
if(tmpEditorWidget.FormWidget)
|
||||||
tmpEditorWidget.FormWidget->commitData();
|
tmpEditorWidget.FormWidget->commitData();
|
||||||
else if(tmpEditorWidget.Editor && tmpProperty) {
|
else if(tmpEditorWidget.Editor && tmpProperty)
|
||||||
|
{
|
||||||
QVariant newValue = tmpProperty->getEditorData(tmpEditorWidget.Editor);
|
QVariant newValue = tmpProperty->getEditorData(tmpEditorWidget.Editor);
|
||||||
QVariant oldValue = tmpProperty->data(VProperty::DPC_Data, Qt::EditRole);
|
QVariant oldValue = tmpProperty->data(VProperty::DPC_Data, Qt::EditRole);
|
||||||
if (oldValue != newValue)
|
if (oldValue != newValue)
|
||||||
{
|
{
|
||||||
if (VProperty *parent = tmpProperty->getParent())
|
VProperty *parent = tmpProperty->getParent();
|
||||||
|
if (parent == nullptr)
|
||||||
{
|
{
|
||||||
if (parent->propertyType() == Property::Complex)
|
tmpProperty->setValue(newValue);
|
||||||
|
emit propertyDataSubmitted(tmpProperty);
|
||||||
|
}
|
||||||
|
else if (parent->propertyType() == Property::Complex)
|
||||||
{
|
{
|
||||||
tmpProperty->UpdateParent(newValue);
|
tmpProperty->UpdateParent(newValue);
|
||||||
emit propertyDataSubmitted(parent);
|
emit propertyDataSubmitted(parent);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmpProperty->setValue(newValue);
|
tmpProperty->setValue(newValue);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user