Material: Problems editing Quantity properties

There were several issues here, not just one. The following are fixed:

Incorrect display of Quantity items (NaN)
Editing and updating quantity items
Editing and updating items on the first row.

There are still issues with editing lists, but these were known issues at the time of initial merge. This has been split out into issue #13435

fixes #13020
This commit is contained in:
David Carter
2024-04-16 14:57:48 -04:00
committed by Chris Hennes
parent 0c25b29680
commit 8d5e2bc428
12 changed files with 110 additions and 59 deletions

View File

@@ -865,6 +865,15 @@ void Material::setPhysicalValue(const QString& name, const std::shared_ptr<QList
}
}
void Material::setPhysicalValue(const QString& name, const QVariant& value)
{
setPhysicalEditState(name);
if (hasPhysicalProperty(name)) {
_physical[name]->setValue(value);
}
}
void Material::setAppearanceValue(const QString& name, const QString& value)
{
setAppearanceEditState(name);
@@ -893,6 +902,38 @@ void Material::setAppearanceValue(const QString& name,
}
}
void Material::setAppearanceValue(const QString& name, const QVariant& value)
{
setAppearanceEditState(name);
if (hasAppearanceProperty(name)) {
_appearance[name]->setValue(value);
}
}
void Material::setValue(const QString& name, const QString& value)
{
if (hasPhysicalProperty(name)) {
setPhysicalValue(name, value);
}
else if (hasAppearanceProperty(name)) {
setAppearanceValue(name, value);
}
else {
throw PropertyNotFound();
}
}
void Material::setValue(const QString& name, const QVariant& value)
{
if (hasPhysicalProperty(name)) {
setPhysicalValue(name, value);
}
else {
throw PropertyNotFound();
}
}
void Material::setLegacyValue(const QString& name, const QString& value)
{
setEditStateAlter();