CSV export : correctly export label

This commit is contained in:
joshua
2019-11-07 21:21:07 +01:00
parent 32a4d9c3fe
commit fc73d53d73
6 changed files with 54 additions and 41 deletions

View File

@@ -1419,7 +1419,10 @@ QString Element::linkTypeToString() const
*/
void Element::setElementInformations(DiagramContext dc)
{
if (m_element_informations == dc) return;
if (m_element_informations == dc) {
return;
}
DiagramContext old_info = m_element_informations;
m_element_informations = dc;
emit elementInfoChange(old_info, m_element_informations);
@@ -1480,7 +1483,7 @@ void Element::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
* @param e QGraphicsSceneHoverEvent
*/
void Element::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
Q_UNUSED(e);
Q_UNUSED(e)
foreach (Element *elmt, linkedElements())
elmt -> setHighlighted(true);
@@ -1497,7 +1500,7 @@ void Element::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
* @param e QGraphicsSceneHoverEvent
*/
void Element::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) {
Q_UNUSED(e);
Q_UNUSED(e)
foreach (Element *elmt, linkedElements())
elmt -> setHighlighted(false);
@@ -1536,8 +1539,7 @@ void Element::setUpFormula(bool code_letter)
if(!m_freeze_label && !formula.isEmpty())
{
DiagramContext dc = m_element_informations;
QString label = autonum::AssignVariables::formulaToLabel(formula, m_autoNum_seq, diagram(), this);
m_element_informations.addValue("label", label);
m_element_informations.addValue("label", actualLabel());
emit elementInfoChange(dc, m_element_informations);
}
}
@@ -1576,7 +1578,22 @@ void Element::freezeNewAddedElement() {
if (this->diagram()->freezeNewElements() || this->diagram()->project()->isFreezeNewElements()) {
freezeLabel(true);
}
else return;
else return;
}
/**
* @brief Element::actualLabel
* Always return the current label to be displayed.
* This function is usefull when label is based on formula, because label can change at any time.
* @return
*/
QString Element::actualLabel()
{
if (m_element_informations.value("formula").toString().isEmpty()) {
return m_element_informations.value("label").toString();
} else {
return autonum::AssignVariables::formulaToLabel(m_element_informations.value("formula").toString(), m_autoNum_seq, diagram(), this);
}
}
/**