0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-03-20 17:23:47 +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){ if (m_strText.compare(value)!=0){
QString oldValue = m_strText; QString oldValue = m_strText;
if (m_trimValue)
m_strText=value.trimmed();
else
m_strText=value; m_strText=value;
if (itemMode() == DesignMode){ if (itemMode() == DesignMode){
@ -466,8 +469,11 @@ void TextItem::setFollowTo(const QString &followTo)
QString oldValue = m_followTo; QString oldValue = m_followTo;
m_followTo = followTo; m_followTo = followTo;
if (!isLoading()){ if (!isLoading()){
TextItem* fi = scene()->findChild<TextItem*>(followTo); TextItem* fi = scene()->findChild<TextItem*>(oldValue);
if (fi && initFollower(followTo)){ if (fi) fi->clearFollower();
fi = scene()->findChild<TextItem*>(followTo);
if (fi && fi != this){
if (initFollower(followTo)){
notify("followTo",oldValue,followTo); notify("followTo",oldValue,followTo);
} else { } else {
m_followTo = ""; m_followTo = "";
@ -480,6 +486,15 @@ void TextItem::setFollowTo(const QString &followTo)
); );
notify("followTo",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() bool TextItem::hasFollower()
{ {
return m_follower != 0; return m_follower != 0;

View File

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