Material: Add thermal reference temperature (#13026)

* Material: Add thermal reference temperature

Fixes #13019

Adds the property 'Thermal Expansion Reference Temperature' to
the Thermal properties

* Fix delegates
This commit is contained in:
David Carter
2024-04-01 12:00:45 -04:00
committed by GitHub
parent 6b721ac797
commit 8776c5bf98
5 changed files with 30 additions and 13 deletions

View File

@@ -106,8 +106,13 @@ void BaseDelegate::paintQuantity(QPainter* painter,
else {
QVariant item = getValue(index);
auto quantity = item.value<Base::Quantity>();
QString text = quantity.getUserString();
painter->drawText(option.rect, 0, text);
if (quantity.isValid()) {
QString text = quantity.getUserString();
painter->drawText(option.rect, 0, text);
}
else {
painter->drawText(option.rect, 0, QString());
}
}
painter->restore();
@@ -350,8 +355,10 @@ void BaseDelegate::setModelData(QWidget* editor,
}
else if (type == Materials::MaterialValue::Quantity) {
auto input = dynamic_cast<Gui::InputField*>(editor);
value = input->text();
return;
// value = input->text();
// return;
auto quantity = Base::Quantity::parse(input->text());
value = QVariant::fromValue(quantity);
}
else if (type == Materials::MaterialValue::Integer) {
auto spinner = dynamic_cast<Gui::IntSpinBox*>(editor);