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->setSettings(getSettings());
|
||||
container->setUpdateBehaviour(getUpdateParent(), getUpdateChildren());
|
||||
container->setPropertyType(propertyType());
|
||||
|
||||
if(include_children) {
|
||||
foreach(VProperty* tmpChild, d_ptr->Children)
|
||||
|
@ -348,6 +349,11 @@ Property VProperty::propertyType() const
|
|||
return d_ptr->type;
|
||||
}
|
||||
|
||||
void VProperty::setPropertyType(const Property &type)
|
||||
{
|
||||
d_ptr->type = type;
|
||||
}
|
||||
|
||||
void VProperty::UpdateParent(const QVariant &value)
|
||||
{
|
||||
Q_UNUSED(value);
|
||||
|
|
|
@ -162,6 +162,7 @@ public:
|
|||
virtual VProperty* clone(bool include_children = true, VProperty* container = nullptr) const;
|
||||
|
||||
Property propertyType() const;
|
||||
void setPropertyType(const Property &type);
|
||||
|
||||
virtual void UpdateParent(const QVariant &value);
|
||||
public slots:
|
||||
|
|
|
@ -164,19 +164,23 @@ void VPropertyFormWidget::commitData(int row)
|
|||
VProperty* tmpProperty = d_ptr->Properties[row];
|
||||
if(tmpEditorWidget.FormWidget)
|
||||
tmpEditorWidget.FormWidget->commitData();
|
||||
else if(tmpEditorWidget.Editor && tmpProperty) {
|
||||
else if(tmpEditorWidget.Editor && tmpProperty)
|
||||
{
|
||||
QVariant newValue = tmpProperty->getEditorData(tmpEditorWidget.Editor);
|
||||
QVariant oldValue = tmpProperty->data(VProperty::DPC_Data, Qt::EditRole);
|
||||
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);
|
||||
emit propertyDataSubmitted(parent);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpProperty->setValue(newValue);
|
||||
|
|
Loading…
Reference in New Issue
Block a user