mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Text of conductor is updated when folio position change, if formula contain the variable %id.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4845 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -1322,17 +1322,22 @@ void Conductor::setProperties(const ConductorProperties &property)
|
|||||||
{
|
{
|
||||||
if (m_properties == property) return;
|
if (m_properties == property) return;
|
||||||
|
|
||||||
|
QString formula = m_properties.m_formula;
|
||||||
m_properties = property;
|
m_properties = property;
|
||||||
|
|
||||||
if (!m_properties.m_formula.isEmpty())
|
if (!m_properties.m_formula.isEmpty())
|
||||||
{
|
{
|
||||||
if (diagram()) {
|
if (diagram())
|
||||||
|
{
|
||||||
QString text = autonum::AssignVariables::formulaToLabel(m_properties.m_formula, m_autoNum_seq, diagram());
|
QString text = autonum::AssignVariables::formulaToLabel(m_properties.m_formula, m_autoNum_seq, diagram());
|
||||||
m_properties.text = text;
|
m_properties.text = text;
|
||||||
}
|
}
|
||||||
else if (m_properties.text.isEmpty()){
|
else if (m_properties.text.isEmpty())
|
||||||
|
{
|
||||||
m_properties.text = m_properties.m_formula;
|
m_properties.text = m_properties.m_formula;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setUpConnectionForFormula(formula, m_properties.m_formula);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_text_item->setPlainText(m_properties.text);
|
m_text_item->setPlainText(m_properties.text);
|
||||||
@@ -1486,6 +1491,25 @@ void Conductor::setSequenceNum(autonum::sequentialNumbers sn)
|
|||||||
refreshText();
|
refreshText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Conductor::setUpConnectionForFormula
|
||||||
|
* setup connection according to the variable of formula
|
||||||
|
* @param old_formula
|
||||||
|
* @param new_formula
|
||||||
|
*/
|
||||||
|
void Conductor::setUpConnectionForFormula(QString old_formula, QString new_formula)
|
||||||
|
{
|
||||||
|
if (diagram() && old_formula.contains("%id"))
|
||||||
|
disconnect(diagram()->project(), &QETProject::projectDiagramsOrderChanged, this, &Conductor::refreshText);
|
||||||
|
|
||||||
|
//Label is frozen, so we don't update it.
|
||||||
|
if (m_freeze_label == true)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (diagram() && new_formula.contains("%id"))
|
||||||
|
connect(diagram()->project(), &QETProject::projectDiagramsOrderChanged, this, &Conductor::refreshText);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@param a point
|
@param a point
|
||||||
@param b point
|
@param b point
|
||||||
@@ -1755,6 +1779,14 @@ QList <Conductor *> relatedConductors(const Conductor *conductor) {
|
|||||||
* Unfreeze this conductor label if false
|
* Unfreeze this conductor label if false
|
||||||
* @param freeze
|
* @param freeze
|
||||||
*/
|
*/
|
||||||
void Conductor::setFreezeLabel(bool freeze) {
|
void Conductor::setFreezeLabel(bool freeze)
|
||||||
|
{
|
||||||
m_freeze_label = freeze;
|
m_freeze_label = freeze;
|
||||||
|
|
||||||
|
if (m_freeze_label != freeze)
|
||||||
|
{
|
||||||
|
m_freeze_label = freeze;
|
||||||
|
QString f = m_properties.m_formula;
|
||||||
|
setUpConnectionForFormula(f,f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,9 @@ class Conductor : public QObject, public QGraphicsPathItem
|
|||||||
autonum::sequentialNumbers sequenceNum () const {return m_autoNum_seq;}
|
autonum::sequentialNumbers sequenceNum () const {return m_autoNum_seq;}
|
||||||
autonum::sequentialNumbers& rSequenceNum() {return m_autoNum_seq;}
|
autonum::sequentialNumbers& rSequenceNum() {return m_autoNum_seq;}
|
||||||
void setSequenceNum(autonum::sequentialNumbers sn);
|
void setSequenceNum(autonum::sequentialNumbers sn);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void setUpConnectionForFormula(QString old_formula, QString new_formula);
|
||||||
autonum::sequentialNumbers m_autoNum_seq;
|
autonum::sequentialNumbers m_autoNum_seq;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user