MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / getString

Method getString

src/Mod/Material/App/Materials.cpp:120–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120QString MaterialProperty::getString() const
121{
122 // This method produces a localized string. For a non-localized string use
123 // getDictionaryString()
124 if (isNull()) {
125 return {};
126 }
127 if (getType() == MaterialValue::Quantity) {
128 auto quantity = getValue().value<Base::Quantity>();
129 return QString::fromStdString(quantity.getUserString());
130 }
131 if (getType() == MaterialValue::Float) {
132 auto value = getValue();
133 if (value.isNull()) {
134 return {};
135 }
136 return QString(QStringLiteral("%L1")).arg(value.toFloat(), 0, 'g', MaterialValue::PRECISION);
137 }
138 return getValue().toString();
139}
140
141QString MaterialProperty::getYAMLString() const
142{

Callers 15

carbonCopyMethod · 0.45
acceptedMethod · 0.45
readMethod · 0.45
setTimeInfoMethod · 0.45
loadMethod · 0.45
isSameMethod · 0.45
testRayPickMethod · 0.45
_copySelectionMethod · 0.45
_find_flat_rootMethod · 0.45

Calls 7

isNullFunction · 0.70
getTypeFunction · 0.70
getValueFunction · 0.70
QStringClass · 0.70
getUserStringMethod · 0.45
isNullMethod · 0.45
toStringMethod · 0.45

Tested by 3

testRayPickMethod · 0.36