Bug fix : Conductor text with formula that contain %id isn't good when open project (variable %id is replaced by 0 in each folio)

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4746 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2016-10-17 14:26:13 +00:00
parent ccf7e1dbde
commit 6ea169e1f7
6 changed files with 64 additions and 41 deletions

View File

@@ -48,7 +48,6 @@ Conductor::Conductor(Terminal *p1, Terminal* p2) :
terminal1(p1),
terminal2(p2),
setSeq(true),
freeze_label(false),
bMouseOver(false),
m_handler(10),
text_item(0),
@@ -1446,6 +1445,15 @@ void Conductor::setText(const QString &t) {
text_item -> setPlainText(label);
}
/**
* @brief Conductor::refreshText
* Refresh the text of this conductor.
* recalcule and set the text according to the formula.
*/
void Conductor::refreshText() {
setText(m_freeze_label? text_item->toPlainText() : properties().text);
}
/**
* @brief Conductor::setProperties
* Set new properties for this conductor
@@ -1478,8 +1486,8 @@ void Conductor::setProperties(const ConductorProperties &properties)
else
m_frozen_label = properties_.text;
}
if (freeze_label)
freezeLabel();
setFreezeLabel(m_freeze_label);
if (properties_.type != ConductorProperties::Multi)
text_item -> setVisible(false);
else
@@ -1883,22 +1891,23 @@ QList <Conductor *> relatedConductors(const Conductor *conductor) {
}
/**
* @brief Conductor::freezeLabel
* Freeze this conductor label
* @brief Conductor::setFreezeLabel
* Freeze this conductor label if true
* Unfreeze this conductor label if false
* @param freeze
*/
void Conductor::freezeLabel() {
QString freezelabel = this->text_item->toPlainText();
m_frozen_label = properties_.text;
this->setText(freezelabel);
this->properties_.text = freezelabel;
}
void Conductor::setFreezeLabel(bool freeze) {
m_freeze_label = freeze;
/**
* @brief Conductor::unfreezeLabel
* Unfreeze this conductor label
*/
void Conductor::unfreezeLabel() {
this->setText(m_frozen_label);
if (m_frozen_label == "") return;
properties_.text = m_frozen_label;
if (m_freeze_label) {
QString freezelabel = this->text_item->toPlainText();
m_frozen_label = properties_.text;
this->setText(freezelabel);
this->properties_.text = freezelabel;
}
else {
this->setText(m_frozen_label);
if (m_frozen_label == "") return;
properties_.text = m_frozen_label;
}
}