From 166a0ac6886bc421a57a7facd056e826d7f53ec2 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 13 Apr 2016 13:38:07 +0300 Subject: [PATCH] allowHTMLInFields property has been added --- limereport/items/lrtextitem.cpp | 20 ++++++++++++++++++-- limereport/items/lrtextitem.h | 7 ++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index a2b558b..ea96609 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -55,7 +55,9 @@ bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(x namespace LimeReport{ TextItem::TextItem(QObject *owner, QGraphicsItem *parent) - : ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false){ + : ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false), + m_allowHTMLInFields(false) +{ m_text = new QTextDocument(); Init(); } @@ -280,6 +282,20 @@ void TextItem::initText() m_textSize=m_text->size(); } +bool TextItem::allowHTMLInFields() const +{ + return m_allowHTMLInFields; +} + +void TextItem::setAllowHTMLInFields(bool allowHTMLInFields) +{ + if (m_allowHTMLInFields != allowHTMLInFields){ + m_allowHTMLInFields = allowHTMLInFields; + notify("allowHTMLInFields",!m_allowHTMLInFields,allowHTMLInFields); + update(); + } +} + bool TextItem::allowHTML() const { return m_allowHTML; @@ -347,7 +363,7 @@ void TextItem::setAlignment(Qt::Alignment value) void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass) { QString context=content(); - ExpandType expandType = allowHTML()?ReplaceHTMLSymbols:NoEscapeSymbols; + ExpandType expandType = (allowHTML() && !allowHTMLInFields())?ReplaceHTMLSymbols:NoEscapeSymbols; switch(pass){ case FirstPass: context=expandUserVariables(context, pass, expandType, dataManager); diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index 2c1c702..d95cb3c 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -55,9 +55,10 @@ class TextItem : public LimeReport::ContentItemDesignIntf { Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColorProperty) Q_PROPERTY(QColor fontColor READ fontColor WRITE setFontColorProperty) Q_PROPERTY(AngleType angle READ angle WRITE setAngle) - Q_PROPERTY(int foregroundOpacity READ foregroundOpacity WRITE setForegroundOpacity()) + Q_PROPERTY(int foregroundOpacity READ foregroundOpacity WRITE setForegroundOpacity) Q_PROPERTY(bool trimValue READ trimValue WRITE setTrimValue) Q_PROPERTY(bool allowHTML READ allowHTML WRITE setAllowHTML) + Q_PROPERTY(bool allowHTMLInFields READ allowHTMLInFields WRITE setAllowHTMLInFields) public: enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength}; @@ -114,6 +115,9 @@ public: bool allowHTML() const; void setAllowHTML(bool allowHTML); + bool allowHTMLInFields() const; + void setAllowHTMLInFields(bool allowHTMLInFields); + protected: void updateLayout(); bool isNeedExpandContent() const; @@ -135,6 +139,7 @@ private: int m_foregroundOpacity; bool m_trimValue; bool m_allowHTML; + bool m_allowHTMLInFields; }; }