mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-03 01:04:13 +02:00
fix: update composite text %{label} when folio changes
DynamicElementTextItem::updateLabel() resolved %{label} in composite
text using the stale value from elementInformations()["label"], which
is only set once at load time and never updated when the folio/page
number changes.
Use element->actualLabel() instead, which resolves the label formula
(including %F, %f, %id) against the current folio at call time.
This commit is contained in:
@@ -1289,9 +1289,15 @@ void DynamicElementTextItem::updateLabel()
|
||||
|
||||
|
||||
if(m_text_from == ElementInfo && element) {
|
||||
setPlainText(element->actualLabel());
|
||||
QString new_label = element->actualLabel();
|
||||
if (toPlainText() != new_label) {
|
||||
setPlainText(new_label);
|
||||
}
|
||||
}
|
||||
else if (m_text_from == CompositeText) {
|
||||
// Use actualLabel() to ensure %{label} reflects the current
|
||||
// resolved label (e.g. after a folio/page-number change)
|
||||
dc.addValue(QStringLiteral("label"), element->actualLabel());
|
||||
setPlainText(autonum::AssignVariables::replaceVariable(m_composite_text, dc));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user