Minor fix : master XRef is not updated when variable %F is used

This commit is contained in:
joshua 2021-06-28 21:24:28 +02:00
parent 8f051fc612
commit 5912a99c16
5 changed files with 21 additions and 5 deletions

View File

@ -331,6 +331,7 @@ void BorderTitleBlock::importTitleBlock(const TitleBlockProperties &ip) {
// through setFolioData(),
// which in turn calls updateDiagramContextForTitleBlock().
emit(needTitleBlockTemplate(ip.template_name));
emit informationChanged();
}
/**

View File

@ -245,6 +245,12 @@ class BorderTitleBlock : public QObject
since it does not know of its parent project.
*/
void needTitleBlockTemplate(const QString &);
/**
* @brief infoChanged
* Signal emitted when the informations changed.
*/
void informationChanged();
// attributes
private:

View File

@ -92,6 +92,9 @@ Diagram::Diagram(QETProject *project) :
pen.setColor(Qt::black);
conductor_setter_ -> setPen(pen);
connect(&border_and_titleblock,
&BorderTitleBlock::informationChanged,
this, &Diagram::diagramInformationChanged);
connect(&border_and_titleblock,
&BorderTitleBlock::needTitleBlockTemplate,
this, &Diagram::setTitleBlockTemplate);

View File

@ -283,6 +283,7 @@ class Diagram : public QGraphicsScene
void findElementRequired(const ElementsLocation &);
void diagramActivated();
void diagramInformationChanged();
};
Q_DECLARE_METATYPE(Diagram *)

View File

@ -128,6 +128,15 @@ void CrossRefItem::setUpConnection()
m_update_connection << connect(m_element,
&Element::linkedElementChanged,
this, &CrossRefItem::linkedChanged);
auto diagram_ = dynamic_cast<Diagram *>(this->scene());
auto formula_ = m_properties.masterLabel();
if (diagram_ &&
formula_.contains("%F"))
{
m_update_connection << connect(diagram_ , &Diagram::diagramInformationChanged,
this, &CrossRefItem::updateLabel);
}
linkedChanged();
updateLabel();
}
@ -161,13 +170,9 @@ QPainterPath CrossRefItem::shape() const{
QString CrossRefItem::elementPositionText(
const Element *elmt, const bool &add_prefix) const
{
XRefProperties xrp =
m_element->diagram()->project()->defaultXRefProperties(
m_element->kindInformations()["type"].toString());
QString formula = xrp.masterLabel();
autonum::sequentialNumbers seq;
QString txt = autonum::AssignVariables::formulaToLabel(
formula,
m_properties.masterLabel(),
seq, elmt->diagram(),
elmt);