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:
committed by
Chris Hennes
parent
939506007d
commit
7e1b1abddd
@@ -117,6 +117,7 @@ std::shared_ptr<Material2DArray> MaterialYamlEntry::read2DArray(const YAML::Node
|
||||
for (std::size_t j = 0; j < yamlRow.size(); j++) {
|
||||
Base::Quantity qq =
|
||||
Base::Quantity::parse(QString::fromStdString(yamlRow[j].as<std::string>()));
|
||||
qq.setFormat(MaterialValue::getQuantityFormat());
|
||||
row->push_back(QVariant::fromValue(qq));
|
||||
}
|
||||
array2d->addRow(row);
|
||||
@@ -143,6 +144,7 @@ std::shared_ptr<Material3DArray> MaterialYamlEntry::read3DArray(const YAML::Node
|
||||
for (auto it = yamlDepth.begin(); it != yamlDepth.end(); it++) {
|
||||
auto depthValue =
|
||||
Base::Quantity::parse(QString::fromStdString(it->first.as<std::string>()));
|
||||
depthValue.setFormat(MaterialValue::getQuantityFormat());
|
||||
|
||||
array3d->addDepth(depth, depthValue);
|
||||
|
||||
@@ -152,8 +154,10 @@ std::shared_ptr<Material3DArray> MaterialYamlEntry::read3DArray(const YAML::Node
|
||||
|
||||
auto row = std::make_shared<QList<Base::Quantity>>();
|
||||
for (std::size_t j = 0; j < yamlRow.size(); j++) {
|
||||
row->push_back(Base::Quantity::parse(
|
||||
QString::fromStdString(yamlRow[j].as<std::string>())));
|
||||
auto qq = Base::Quantity::parse(
|
||||
QString::fromStdString(yamlRow[j].as<std::string>()));
|
||||
qq.setFormat(MaterialValue::getQuantityFormat());
|
||||
row->push_back(qq);
|
||||
}
|
||||
array3d->addRow(depth, row);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user