mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-21 22:04:13 +02:00
Add %T, the target folio's title, to report and cross reference formulas
A folio report could name the folio it points to by position (%f), folio number (%F), installation (%M) and location (%LM), but not by its title. EPLAN and other tools print references like "+UV1/1 Versorgung UG/EG.0", which with %T is the formula "+%LM/%F %T.%c". - FormulaContext carries the folio title, filled from the title block. - %T is replaced on its own only, not as the start of a longer word. - A report whose formula uses %T follows the target folio's title block (BorderTitleBlock::informationChanged), as %F already follows its folio number. - The report and cross reference property pages list %T. tst_reportfoliotitle checks the replacement, that %total and title block variables keep their values, and an empty title. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
#include "assignvariables.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "../diagram.h"
|
||||
#include "../diagramposition.h"
|
||||
#include "../qetapp.h"
|
||||
@@ -229,6 +231,7 @@ namespace autonum
|
||||
FormulaContext context;
|
||||
const BorderTitleBlock &border = diagram->border_and_titleblock;
|
||||
context.folio = border.folio();
|
||||
context.folio_title = border.title();
|
||||
context.folio_index = diagram->folioIndex();
|
||||
context.folio_total = border.folioTotal();
|
||||
context.plant = border.plant();
|
||||
@@ -411,6 +414,9 @@ namespace autonum
|
||||
QString::number(m_context.folio_total));
|
||||
m_assigned_label.replace("%M", m_context.plant);
|
||||
m_assigned_label.replace("%LM", m_context.locmach);
|
||||
//%T on its own only, not the start of a longer word
|
||||
static const QRegularExpression folio_title(QStringLiteral("%T(?![A-Za-z0-9_])"));
|
||||
m_assigned_label.replace(folio_title, m_context.folio_title);
|
||||
|
||||
QSettings settings;
|
||||
if (m_context.has_element)
|
||||
|
||||
@@ -69,6 +69,8 @@ namespace autonum
|
||||
{
|
||||
/// border_and_titleblock.folio(), folioIndex(), folioTotal()...
|
||||
QString folio;
|
||||
/// the folio's title, %T
|
||||
QString folio_title;
|
||||
int folio_index = 0;
|
||||
int folio_total = 0;
|
||||
QString plant;
|
||||
|
||||
@@ -1261,6 +1261,8 @@ void DynamicElementTextItem::setConnectionForReportFormula(const QString &formul
|
||||
connect(other_diagram->project(), &QETProject::projectDiagramsOrderChanged, this, &DynamicElementTextItem::updateReportText);
|
||||
connect(other_diagram->project(), &QETProject::diagramRemoved, this, &DynamicElementTextItem::updateReportText);
|
||||
}
|
||||
if (other_diagram && string.contains("%T"))
|
||||
connect(&other_diagram->border_and_titleblock, &BorderTitleBlock::informationChanged, this, &DynamicElementTextItem::updateReportText);
|
||||
if (string.contains("%l"))
|
||||
connect(other_elmt, &Element::yChanged, this, &DynamicElementTextItem::updateReportText);
|
||||
if (string.contains("%c"))
|
||||
@@ -1286,6 +1288,8 @@ void DynamicElementTextItem::removeConnectionForReportFormula(const QString &for
|
||||
|
||||
if (other_diagram && (string.contains("%f") || string.contains("%id")))
|
||||
disconnect(other_diagram->project(), &QETProject::projectDiagramsOrderChanged, this, &DynamicElementTextItem::updateReportText);
|
||||
if (other_diagram && string.contains("%T"))
|
||||
disconnect(&other_diagram->border_and_titleblock, &BorderTitleBlock::informationChanged, this, &DynamicElementTextItem::updateReportText);
|
||||
if (string.contains("%l"))
|
||||
disconnect(other_element, &Element::yChanged, this, &DynamicElementTextItem::updateReportText);
|
||||
if (string.contains("%c"))
|
||||
|
||||
@@ -38,6 +38,7 @@ Create your own text using the following variables:
|
||||
%F: the sheet number
|
||||
%M: the installation
|
||||
%LM: the location
|
||||
%T: the sheet title
|
||||
%l: the row number
|
||||
%c: the column number</string>
|
||||
</property>
|
||||
|
||||
@@ -285,7 +285,8 @@
|
||||
%l: the row number
|
||||
%c: the column number
|
||||
%M: the installation
|
||||
%LM: the location</string>
|
||||
%LM: the location
|
||||
%T: the sheet title</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user