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(), // through setFolioData(),
// which in turn calls updateDiagramContextForTitleBlock(). // which in turn calls updateDiagramContextForTitleBlock().
emit(needTitleBlockTemplate(ip.template_name)); emit(needTitleBlockTemplate(ip.template_name));
emit informationChanged();
} }
/** /**

View File

@ -246,6 +246,12 @@ class BorderTitleBlock : public QObject
*/ */
void needTitleBlockTemplate(const QString &); void needTitleBlockTemplate(const QString &);
/**
* @brief infoChanged
* Signal emitted when the informations changed.
*/
void informationChanged();
// attributes // attributes
private: private:
// titleblock basic data // titleblock basic data

View File

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

View File

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

View File

@ -128,6 +128,15 @@ void CrossRefItem::setUpConnection()
m_update_connection << connect(m_element, m_update_connection << connect(m_element,
&Element::linkedElementChanged, &Element::linkedElementChanged,
this, &CrossRefItem::linkedChanged); 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(); linkedChanged();
updateLabel(); updateLabel();
} }
@ -161,13 +170,9 @@ QPainterPath CrossRefItem::shape() const{
QString CrossRefItem::elementPositionText( QString CrossRefItem::elementPositionText(
const Element *elmt, const bool &add_prefix) const 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; autonum::sequentialNumbers seq;
QString txt = autonum::AssignVariables::formulaToLabel( QString txt = autonum::AssignVariables::formulaToLabel(
formula, m_properties.masterLabel(),
seq, elmt->diagram(), seq, elmt->diagram(),
elmt); elmt);