[MeasureGui] Add measurement value to label text

This commit is contained in:
hlorus
2024-05-07 10:55:53 +02:00
committed by Chris Hennes
parent 3d2de62cbc
commit 2b9e9d6ca5

View File

@@ -282,6 +282,10 @@ void ViewProviderMeasureBase::updateData(const App::Property* prop)
return;
}
if (strcmp(prop->getName(), "Label") == 0) {
doUpdate = true;
}
// Check if one of the input properties has been changed
auto inputProps = obj->getInputProps();
if (std::find(inputProps.begin(), inputProps.end(), std::string(prop->getName())) != inputProps.end()) {
@@ -299,6 +303,11 @@ void ViewProviderMeasureBase::updateData(const App::Property* prop)
if (doUpdate) {
redrawAnnotation();
// Update label
std::string userLabel(obj->Label.getValue());
std::string name = userLabel.substr(0, userLabel.find(":"));
obj->Label.setValue((name + ": ") + obj->getResultString().toStdString());
}
ViewProviderDocumentObject::updateData(prop);