mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
TextItem: Value trimming behavior has been fixed
This commit is contained in:
parent
aeafc9e3b3
commit
1b1c0d52bc
@ -276,10 +276,6 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q
|
||||
BaseDesignIntf::paint(painter, style, widget);
|
||||
}
|
||||
|
||||
QString TextItem::content() const{
|
||||
return m_strText;
|
||||
}
|
||||
|
||||
void TextItem::Init()
|
||||
{
|
||||
m_autoWidth = NoneAutoWidth;
|
||||
@ -299,14 +295,8 @@ 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 && (autoHeight())){
|
||||
// initTextSizes();
|
||||
// }
|
||||
m_strText = value;
|
||||
|
||||
if (!isLoading()){
|
||||
if (autoHeight() || autoWidth() || hasFollower())
|
||||
@ -317,6 +307,10 @@ void TextItem::setContent(const QString &value)
|
||||
}
|
||||
}
|
||||
|
||||
QString TextItem::content() const{
|
||||
return m_strText;
|
||||
}
|
||||
|
||||
void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight)
|
||||
{
|
||||
|
||||
@ -494,28 +488,30 @@ QString TextItem::formatFieldValue()
|
||||
}
|
||||
|
||||
switch (value.type()) {
|
||||
case QVariant::Date:
|
||||
case QVariant::DateTime:
|
||||
return formatDateTime(value.toDateTime());
|
||||
case QVariant::Double:
|
||||
return formatNumber(value.toDouble());
|
||||
default:
|
||||
return value.toString();
|
||||
case QVariant::Date:
|
||||
case QVariant::DateTime:
|
||||
return formatDateTime(value.toDateTime());
|
||||
case QVariant::Double:
|
||||
return formatNumber(value.toDouble());
|
||||
default:
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TextItem::TextPtr TextItem::textDocument() const
|
||||
{
|
||||
TextPtr text(new QTextDocument);
|
||||
QString content = m_trimValue ? m_strText.trimmed() : m_strText;
|
||||
|
||||
if (allowHTML())
|
||||
if (isReplaceCarriageReturns()){
|
||||
text->setHtml(replaceReturns(m_strText));
|
||||
text->setHtml(replaceReturns(content));
|
||||
} else {
|
||||
text->setHtml(m_strText);
|
||||
text->setHtml(content);
|
||||
}
|
||||
else
|
||||
text->setPlainText(m_strText);
|
||||
text->setPlainText(content);
|
||||
|
||||
QTextOption to;
|
||||
to.setAlignment(m_alignment);
|
||||
@ -785,6 +781,7 @@ void TextItem::setTrimValue(bool value)
|
||||
{
|
||||
bool oldValue = m_trimValue;
|
||||
m_trimValue = value;
|
||||
update();
|
||||
notify("trimValue",oldValue,value);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user