Materials: Change display of Quantity values

The default display type of quantity objects is fixed point resulting
in insufficient accuracy when changing unit systems, or when the values
are small. This fix changes the default format from 'Fixed' to the more
apt 'Default' format. This allows the displayed values to scale as
appropriate.

Fixes #18149
This commit is contained in:
David Carter
2024-12-11 09:26:06 -05:00
committed by Chris Hennes
parent 939506007d
commit 7e1b1abddd
12 changed files with 179 additions and 86 deletions

View File

@@ -37,6 +37,7 @@
#include <src/App/InitApplication.h>
#include <Mod/Material/App/MaterialManager.h>
#include <Mod/Material/App/MaterialValue.h>
#include <Mod/Material/App/Model.h>
#include <Mod/Material/App/ModelManager.h>
#include <Mod/Material/App/ModelUuids.h>
@@ -223,7 +224,9 @@ TEST_F(TestMaterial, TestAddAppearanceModel)
QString parseQuantity(const char *string)
{
QString value = QString::fromStdString(string);
return Base::Quantity::parse(value).getUserString();
auto quantity = Base::Quantity::parse(value);
quantity.setFormat(Materials::MaterialValue::getQuantityFormat());
return quantity.getUserString();
}
TEST_F(TestMaterial, TestCalculiXSteel)