Merge pull request #1508 from ispyisail/fix/report-text-shift-lazy

Fix report text shifted by its width after a lazy-folio save
This commit is contained in:
Laurent Trinques
2026-10-16 07:07:03 +02:00
committed by GitHub
5 changed files with 410 additions and 1 deletions
@@ -1810,12 +1810,36 @@ void DynamicElementTextItem::setPlainText(const QString &text)
bool update_alignment = true;
bool parsing_only = false;
if (diagram() && (diagram()->project()->state() == QETProject::ProjectParsingRunning))
{
update_alignment = false;
parsing_only = true;
}
if (m_parent_element.data()->state() == QET::GIBuildingFromXml ||
m_parent_element.data()->state() == QET::GILoadingFromXml)
{
update_alignment = false;
parsing_only = false;
}
//A text emptied with its alignment kept (the project not being
//opened) is filled again the same way, even if the project is
//being opened by then: lazy folios build the folios left late with
//the project in that state, and the text would stay where emptying
//moved it (F119)
if (text.isEmpty())
m_emptied_aligned = update_alignment;
else if (!toPlainText().isEmpty())
m_emptied_aligned = false;
else if (parsing_only && m_emptied_aligned)
{
update_alignment = true;
m_emptied_aligned = false;
}
else
m_emptied_aligned = false;
if (update_alignment) {
prepareAlignment();
}
@@ -196,6 +196,8 @@ class DynamicElementTextItem : public DiagramTextItem
CrossRefItem *m_Xref_item = nullptr;
QGraphicsTextItem *m_slave_Xref_item = nullptr;
qreal m_text_width = -1;
/// The text was emptied with its alignment kept (setPlainText())
bool m_emptied_aligned = false;
QPointF m_initial_position;
bool m_keep_visual_rotation = true;
bool m_rotation_point_center = false;