Fix wrong behavior when edit the element information

In the diagram editor, when we edit the element information in the side
panel, each time we tip something in the text field the cursor always go
to the end if the "label" information is empty.
This commit is contained in:
joshua
2022-05-25 23:16:13 +02:00
parent a2b73ea2bc
commit 899caeabe9
2 changed files with 24 additions and 3 deletions

View File

@@ -1347,9 +1347,13 @@ void Element::setElementInformations(DiagramContext dc)
return;
}
DiagramContext old_info = m_data.m_informations;
const auto old_info = m_data.m_informations;
m_data.m_informations = dc;
m_data.m_informations.addValue(QStringLiteral("label"), actualLabel()); //Update the label if there is a formula
const auto actual_label{actualLabel()};
if (!actual_label.isEmpty()) {
m_data.m_informations.addValue(QStringLiteral("label"), actual_label); //Update the label if there is a formula
}
emit elementInfoChange(old_info, m_data.m_informations);
}