0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-25 00:54:39 +03:00

followTo has been fixed

This commit is contained in:
Arin Alexander 2016-12-24 11:49:56 +03:00
parent 3807ac0c57
commit 658a6e7e09
2 changed files with 30 additions and 9 deletions

View File

@ -223,6 +223,9 @@ void TextItem::setContent(const QString &value)
{
if (m_strText.compare(value)!=0){
QString oldValue = m_strText;
if (m_trimValue)
m_strText=value.trimmed();
else
m_strText=value;
if (itemMode() == DesignMode){
@ -466,8 +469,11 @@ void TextItem::setFollowTo(const QString &followTo)
QString oldValue = m_followTo;
m_followTo = followTo;
if (!isLoading()){
TextItem* fi = scene()->findChild<TextItem*>(followTo);
if (fi && initFollower(followTo)){
TextItem* fi = scene()->findChild<TextItem*>(oldValue);
if (fi) fi->clearFollower();
fi = scene()->findChild<TextItem*>(followTo);
if (fi && fi != this){
if (initFollower(followTo)){
notify("followTo",oldValue,followTo);
} else {
m_followTo = "";
@ -480,6 +486,15 @@ void TextItem::setFollowTo(const QString &followTo)
);
notify("followTo",followTo,"");
}
} else if (m_followTo != ""){
QMessageBox::critical(
0,
tr("Error"),
tr("TextItem \" %1 \" not found !")
.arg(m_followTo)
);
notify("followTo",followTo,"");
}
}
}
}
@ -491,6 +506,11 @@ void TextItem::setFollower(TextItem *follower)
}
}
void TextItem::clearFollower()
{
m_follower = 0;
}
bool TextItem::hasFollower()
{
return m_follower != 0;

View File

@ -147,6 +147,7 @@ public:
QString followTo() const;
void setFollowTo(const QString &followTo);
void setFollower(TextItem* follower);
void clearFollower();
bool hasFollower();
TextItem* follower(){ return m_follower;}
bool initFollower(QString follower);